2020-04-10 22:36:03 +01:00
|
|
|
{ lib
|
2020-08-14 23:22:50 +01:00
|
|
|
, rustPlatform
|
2020-06-22 22:02:13 +01:00
|
|
|
, python
|
2020-04-10 22:36:03 +01:00
|
|
|
, fetchFromGitHub
|
2020-08-14 23:22:50 +01:00
|
|
|
, pipInstallHook
|
|
|
|
, maturin
|
|
|
|
, pip
|
2020-04-10 22:36:03 +01:00
|
|
|
# Check inputs
|
|
|
|
, pytestCheckHook
|
2020-08-14 23:22:50 +01:00
|
|
|
, numpy
|
2020-04-10 22:36:03 +01:00
|
|
|
}:
|
2020-06-22 22:02:13 +01:00
|
|
|
|
2020-08-14 23:22:50 +01:00
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "retworkx";
|
2020-11-04 17:57:15 +00:00
|
|
|
version = "0.6.0";
|
2020-04-10 22:36:03 +01:00
|
|
|
|
2020-08-14 23:22:50 +01:00
|
|
|
src = fetchFromGitHub {
|
2020-04-10 22:36:03 +01:00
|
|
|
owner = "Qiskit";
|
|
|
|
repo = "retworkx";
|
2020-08-14 23:22:50 +01:00
|
|
|
rev = version;
|
2020-11-04 17:57:15 +00:00
|
|
|
sha256 = "11n30ldg3y3y6qxg3hbj837pnbwjkqw3nxq6frds647mmmprrd20";
|
2020-04-10 22:36:03 +01:00
|
|
|
};
|
|
|
|
|
2020-11-04 17:57:15 +00:00
|
|
|
cargoSha256 = "1vg4yf0k6yypqf9z46zz818mz7fdrgxj7zl6zjf7pnm2r8mq3qw5";
|
2020-04-10 22:36:03 +01:00
|
|
|
|
2020-08-14 23:22:50 +01:00
|
|
|
propagatedBuildInputs = [ python ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ pipInstallHook maturin pip ];
|
2020-04-10 22:36:03 +01:00
|
|
|
|
2020-11-04 17:57:15 +00:00
|
|
|
# Needed b/c need to check AFTER python wheel is installed (using Rust Build, not buildPythonPackage)
|
2020-08-14 23:22:50 +01:00
|
|
|
doCheck = false;
|
|
|
|
doInstallCheck = true;
|
|
|
|
|
2020-11-04 17:57:15 +00:00
|
|
|
installCheckInputs = [ pytestCheckHook numpy ];
|
|
|
|
|
2020-08-14 23:22:50 +01:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
2020-11-04 17:57:15 +00:00
|
|
|
maturin build --release --manylinux off --strip
|
2020-08-14 23:22:50 +01:00
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
install -Dm644 -t dist target/wheels/*.whl
|
|
|
|
pipInstallPhase
|
|
|
|
'';
|
2020-04-10 22:36:03 +01:00
|
|
|
|
|
|
|
preCheck = ''
|
2020-08-14 23:22:50 +01:00
|
|
|
export TESTDIR=$(mktemp -d)
|
2020-11-04 17:57:15 +00:00
|
|
|
cp -r tests/ $TESTDIR
|
2020-08-14 23:22:50 +01:00
|
|
|
pushd $TESTDIR
|
2020-04-10 22:36:03 +01: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 23:22:50 +01:00
|
|
|
changelog = "https://github.com/Qiskit/retworkx/releases/tag/${version}";
|
2020-04-10 22:36:03 +01:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ drewrisinger ];
|
|
|
|
};
|
|
|
|
}
|