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