Files
nixpkgs/pkgs/development/python-modules/retworkx/default.nix
T

70 lines
1.8 KiB
Nix
Raw Normal View History

2020-04-10 17:36:03 -04:00
{ lib
2020-08-14 18:22:50 -04:00
, rustPlatform
2020-06-22 17:02:13 -04:00
, python
2020-08-14 18:22:50 -04:00
, fetchpatch
2020-04-10 17:36:03 -04:00
, fetchFromGitHub
2020-08-14 18:22:50 -04:00
, pipInstallHook
, maturin
, pip
2020-04-10 17:36:03 -04:00
# Check inputs
, pytestCheckHook
2020-08-14 18:22:50 -04:00
, numpy
2020-04-10 17:36:03 -04:00
}:
2020-06-22 17:02:13 -04:00
2020-08-14 18:22:50 -04:00
rustPlatform.buildRustPackage rec {
pname = "retworkx";
version = "0.4.0";
2020-04-10 17:36:03 -04:00
2020-08-14 18:22:50 -04:00
src = fetchFromGitHub {
2020-04-10 17:36:03 -04:00
owner = "Qiskit";
repo = "retworkx";
2020-08-14 18:22:50 -04:00
rev = version;
sha256 = "1xqp6d39apkjvd0ad9vw81cp2iqzhpagfa4p171xqm3bwfn2imdc";
2020-04-10 17:36:03 -04:00
};
2020-08-14 18:22:50 -04:00
cargoSha256 = "0bma0l14jv5qhcsxck7vw3ak1w3c8v84cq4hii86i4iqk523zns5";
cargoPatches = [
( fetchpatch {
name = "retworkx-cargo-lock.patch";
url = "https://github.com/Qiskit/retworkx/commit/a02fd33d357a92dbe9530696a6d85aa59fe8a5b9.patch";
sha256 = "0gvxr1nqp9ll4skfks4p4d964pshal25kb1nbfzhpyipnzddizr5";
} )
];
2020-04-10 17:36:03 -04:00
2020-08-14 18:22:50 -04:00
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 ];
2020-04-10 17:36:03 -04:00
preCheck = ''
2020-08-14 18:22:50 -04:00
export TESTDIR=$(mktemp -d)
cp -r $TMP/$sourceRoot/tests $TESTDIR
pushd $TESTDIR
2020-04-10 17:36:03 -04:00
'';
postCheck = "popd";
meta = with lib; {
description = "A python graph library implemented in Rust.";
homepage = "https://retworkx.readthedocs.io/en/latest/index.html";
downloadPage = "https://github.com/Qiskit/retworkx/releases";
2020-08-14 18:22:50 -04:00
changelog = "https://github.com/Qiskit/retworkx/releases/tag/${version}";
2020-04-10 17:36:03 -04:00
license = licenses.asl20;
maintainers = with maintainers; [ drewrisinger ];
};
}