python3Packages.retworkx: 0.3.4 -> 0.4.0
Also compile from source using Rust. Now possible b/c pyo3/maturin work on Rust stable.
This commit is contained in:
parent
1e8b74f393
commit
5c60872dfb
@ -1,53 +1,60 @@
|
|||||||
{ lib
|
{ lib
|
||||||
, buildPythonPackage
|
, rustPlatform
|
||||||
, pythonOlder
|
|
||||||
, pythonAtLeast
|
|
||||||
, python
|
, python
|
||||||
|
, fetchpatch
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, fetchPypi
|
, pipInstallHook
|
||||||
|
, maturin
|
||||||
|
, pip
|
||||||
# Check inputs
|
# Check inputs
|
||||||
, pytestCheckHook
|
, pytestCheckHook
|
||||||
|
, numpy
|
||||||
}:
|
}:
|
||||||
let
|
|
||||||
rx-version = "0.3.4";
|
|
||||||
|
|
||||||
wheel-hashes = {
|
rustPlatform.buildRustPackage rec {
|
||||||
"3.7" = { python = "cp37"; sha256 = "1hfrdj8svkfdraa299gcj18a601l4zn646fkgq7m56brpagssf9l"; };
|
pname = "retworkx";
|
||||||
"3.8" = { python = "cp38"; sha256 = "0jm10ywaqr0b456pcp01pb7035nawlndfi998jv8p1a2f5xwjgiq"; };
|
version = "0.4.0";
|
||||||
};
|
|
||||||
lookup = set: key: default: if (builtins.hasAttr key set) then (builtins.getAttr key set) else default;
|
|
||||||
wheel-args = lookup
|
|
||||||
wheel-hashes
|
|
||||||
python.pythonVersion
|
|
||||||
(throw "retworkx python version & hash not included. Override attribute `wheel-args` with version & hash at https://pypi.org/project/retworkx");
|
|
||||||
|
|
||||||
github-source = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "Qiskit";
|
owner = "Qiskit";
|
||||||
repo = "retworkx";
|
repo = "retworkx";
|
||||||
rev = rx-version;
|
rev = version;
|
||||||
sha256 = "0cd3x64y49q9a3jrkiknlfkiccxkxgl624x5pqk7gm34s1lnzl8h";
|
sha256 = "1xqp6d39apkjvd0ad9vw81cp2iqzhpagfa4p171xqm3bwfn2imdc";
|
||||||
};
|
|
||||||
in
|
|
||||||
buildPythonPackage rec {
|
|
||||||
pname = "retworkx";
|
|
||||||
version = rx-version;
|
|
||||||
format = "wheel";
|
|
||||||
|
|
||||||
disabled = pythonOlder "3.5" || pythonAtLeast "3.9"; # compiled versions only included for 3.5 <= py <= 3.8
|
|
||||||
|
|
||||||
src = fetchPypi {
|
|
||||||
inherit pname version format;
|
|
||||||
inherit (wheel-args) python sha256;
|
|
||||||
abi = if pythonOlder "3.8" then "${wheel-args.python}m" else wheel-args.python;
|
|
||||||
platform = "manylinux2010_x86_64"; # i686, aarch64, and ppc64 also available, restricting to x86 for simplicity
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pythonImportsCheck = [ "retworkx" ];
|
cargoSha256 = "0bma0l14jv5qhcsxck7vw3ak1w3c8v84cq4hii86i4iqk523zns5";
|
||||||
|
cargoPatches = [
|
||||||
|
( fetchpatch {
|
||||||
|
name = "retworkx-cargo-lock.patch";
|
||||||
|
url = "https://github.com/Qiskit/retworkx/commit/a02fd33d357a92dbe9530696a6d85aa59fe8a5b9.patch";
|
||||||
|
sha256 = "0gvxr1nqp9ll4skfks4p4d964pshal25kb1nbfzhpyipnzddizr5";
|
||||||
|
} )
|
||||||
|
];
|
||||||
|
|
||||||
checkInputs = [ pytestCheckHook ];
|
propagatedBuildInputs = [ python ];
|
||||||
|
|
||||||
|
nativeBuildInputs = [ pipInstallHook maturin pip ];
|
||||||
|
|
||||||
|
# Need to check AFTER python wheel is installed (b/c using Rust Build, not buildPythonPackage)
|
||||||
|
doCheck = false;
|
||||||
|
doInstallCheck = true;
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
runHook preBuild
|
||||||
|
maturin build --release --manylinux off --strip --interpreter ${python.interpreter}
|
||||||
|
runHook postBuild
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
install -Dm644 -t dist target/wheels/*.whl
|
||||||
|
pipInstallPhase
|
||||||
|
'';
|
||||||
|
|
||||||
|
installCheckInputs = [ pytestCheckHook numpy ];
|
||||||
preCheck = ''
|
preCheck = ''
|
||||||
pushd $(mktemp -d)
|
export TESTDIR=$(mktemp -d)
|
||||||
cp -r ${github-source}/$sourceRoot/tests .
|
cp -r $TMP/$sourceRoot/tests $TESTDIR
|
||||||
|
pushd $TESTDIR
|
||||||
'';
|
'';
|
||||||
postCheck = "popd";
|
postCheck = "popd";
|
||||||
|
|
||||||
@ -55,8 +62,8 @@ buildPythonPackage rec {
|
|||||||
description = "A python graph library implemented in Rust.";
|
description = "A python graph library implemented in Rust.";
|
||||||
homepage = "https://retworkx.readthedocs.io/en/latest/index.html";
|
homepage = "https://retworkx.readthedocs.io/en/latest/index.html";
|
||||||
downloadPage = "https://github.com/Qiskit/retworkx/releases";
|
downloadPage = "https://github.com/Qiskit/retworkx/releases";
|
||||||
|
changelog = "https://github.com/Qiskit/retworkx/releases/tag/${version}";
|
||||||
license = licenses.asl20;
|
license = licenses.asl20;
|
||||||
maintainers = with maintainers; [ drewrisinger ];
|
maintainers = with maintainers; [ drewrisinger ];
|
||||||
platforms = platforms.x86_64;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -5936,7 +5936,8 @@ in {
|
|||||||
|
|
||||||
readchar = callPackage ../development/python-modules/readchar { };
|
readchar = callPackage ../development/python-modules/readchar { };
|
||||||
|
|
||||||
retworkx = callPackage ../development/python-modules/retworkx { };
|
retworkx = disabledIf (pythonOlder "3.5")
|
||||||
|
(toPythonModule (callPackage ../development/python-modules/retworkx { } ));
|
||||||
|
|
||||||
rivet = disabledIf (!isPy3k) (toPythonModule (pkgs.rivet.override {
|
rivet = disabledIf (!isPy3k) (toPythonModule (pkgs.rivet.override {
|
||||||
python3 = python;
|
python3 = python;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user