python310Packages.polars: 0.13.19 -> 0.15.13: Fix compilation error

This commit is contained in:
Michael Schantz Klausen 2023-01-09 08:15:36 +01:00 committed by Yt
parent ef283f6448
commit d744fdbab9

View File

@ -5,13 +5,14 @@
, rustPlatform
, libiconv
, fetchzip
, typing-extensions
}:
let
pname = "polars";
version = "0.13.19";
version = "0.15.13";
rootSource = fetchzip {
url = "https://github.com/pola-rs/${pname}/archive/refs/tags/py-polars-v${version}.tar.gz";
sha256 = "sha256-JOHjxTTPzS9Dd/ODp4r0ebU9hEonxrbjURJoq0BQCyI=";
url = "https://github.com/pola-rs/${pname}/archive/refs/tags/py-${version}.tar.gz";
sha256 = "sha256-bk2opNLN3L+fkzXVfUU5O37UmA27ijmnAElCHjsuI+o=";
};
in
buildPythonPackage {
@ -19,8 +20,13 @@ buildPythonPackage {
format = "pyproject";
disabled = pythonOlder "3.6";
src = rootSource;
# Cargo.lock files is sometimes behind actual release which throws an error,
# thus the `sed` command
# Make sure to check that the right substitutions are made when updating the package
preBuild = ''
cd py-polars
sed -i 's/version = "0.15.11"/version = "${version}"/g' Cargo.lock
'';
cargoDeps = rustPlatform.fetchCargoTarball {
@ -29,10 +35,15 @@ buildPythonPackage {
cd py-polars
'';
name = "${pname}-${version}";
sha256 = "sha256-KEt8lITY4El2afuh2cxnrDkXGN3MZgfKQU3Pe2jECF0=";
sha256 = "sha256-u7ascftUPz8K+gWwjjxdXXFJf++M+8P9QE/KVJkO5DM=";
};
cargoRoot = "py-polars";
# Revisit this whenever package or Rust is upgraded
RUSTC_BOOTSTRAP = 1;
propagatedBuildInputs = if pythonOlder "3.10" then [ typing-extensions ] else [];
nativeBuildInputs = with rustPlatform; [ cargoSetupHook maturinBuildHook ];
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
@ -49,36 +60,7 @@ buildPythonPackage {
# ];
meta = with lib; {
# Adding cmake to nativeBuildInputs and using `dontUseCmakeConfigure = true;`
# The following error still happens
# Compiling arrow2 v0.10.1 (https://github.com/ritchie46/arrow2?branch=polars#da703ae3)
# error[E0554]: `#![feature]` may not be used on the stable release channel
# --> /build/polars-0.13.19-vendor.tar.gz/arrow2/src/lib.rs:8:39
# |
# 8 | #![cfg_attr(feature = "simd", feature(portable_simd))]
# | ^^^^^^^^^^^^^
# error: aborting due to previous error
# For more information about this error, try `rustc --explain E0554`.
# error: could not compile `arrow2` due to 2 previous errors
# warning: build failed, waiting for other jobs to finish...
# maturin failed
# Caused by: Failed to build a native library through cargo
# Caused by: Cargo build finished with "exit status: 101": `cargo rustc --message-format json --manifest-path Cargo.toml -j 8 --frozen --target x86_64-unknown-linux-gnu --release --lib -- -C link-arg=-s`
# error: builder for '/nix/store/qfnqi5hs3x4xdb6d4f6rpaf63n1w74yn-python3.10-polars-0.13.19.drv' failed with exit code 1;
# last 10 log lines:
# > error: aborting due to previous error
# >
# >
# > For more information about this error, try `rustc --explain E0554`.
# >
# > error: could not compile `arrow2` due to 2 previous errors
# > warning: build failed, waiting for other jobs to finish...
# > maturin failed
# > Caused by: Failed to build a native library through cargo
# > Caused by: Cargo build finished with "exit status: 101": `cargo rustc --message-format json --manifest-path Cargo.toml -j 8 --frozen --target x86_64-unknown-linux-gnu --release --lib -- -C link-arg=-s`
# For full logs, run 'nix log /nix/store/qfnqi5hs3x4xdb6d4f6rpaf63n1w74yn-python3.10-polars-0.13.19.drv'.
broken = true;
broken = (stdenv.isLinux && stdenv.isAarch64) || stdenv.isDarwin;
description = "Fast multi-threaded DataFrame library in Rust | Python | Node.js ";
homepage = "https://github.com/pola-rs/polars";
license = licenses.asl20;