diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-01-10 07:13:44 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2021-01-12 14:07:16 +0000 |
commit | e2698550456abba83c6dcd5d5e5a9990a0b96f8a (patch) | |
tree | 79a56f0df3fa55e470d84b4dff6059fbf487ec18 /nixpkgs/pkgs/development/python-modules/retworkx | |
parent | 1cdc42df888dc98c347e03bd942ed9825a55bcb3 (diff) | |
parent | 84d74ae9c9cbed73274b8e4e00be14688ffc93fe (diff) | |
download | nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.gz nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.bz2 nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.lz nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.xz nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.zst nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.zip |
Merge commit '84d74ae9c9cbed73274b8e4e00be14688ffc93fe'
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/retworkx')
-rw-r--r-- | nixpkgs/pkgs/development/python-modules/retworkx/default.nix | 76 |
1 files changed, 43 insertions, 33 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/retworkx/default.nix b/nixpkgs/pkgs/development/python-modules/retworkx/default.nix index 531edab27467..49e4b1c2fc34 100644 --- a/nixpkgs/pkgs/development/python-modules/retworkx/default.nix +++ b/nixpkgs/pkgs/development/python-modules/retworkx/default.nix @@ -1,50 +1,60 @@ { lib -, buildPythonPackage -, pythonOlder -, pythonAtLeast -, isPy37 -, isPy38 +, rustPlatform +, python +, fetchpatch , fetchFromGitHub -, fetchPypi +, pipInstallHook +, maturin +, pip # Check inputs , pytestCheckHook +, numpy }: -let - rx-version = "0.3.3"; - wheel-args = if isPy37 then - { python = "cp37"; sha256 = "1gbz7sh9i4h41xs9c40lixfdigmvfykkgxgzwsrs8v0smx20dczy"; } - else if isPy38 then - { python = "cp38"; sha256 = "09xxgp4ac4q6mfkj6lsqqfrzz1cb02vxy7wlv0bq3z2hd0jcanxk"; } - else throw "python version & hash not included. Override attribute `wheel-args` with version & hash at https://pypi.org/project/retworkx"; +rustPlatform.buildRustPackage rec { + pname = "retworkx"; + version = "0.4.0"; - github-source = fetchFromGitHub { + src = fetchFromGitHub { owner = "Qiskit"; repo = "retworkx"; - rev = rx-version; - sha256 = "160w5vkzrl5rzcrdwhjq820i5lmc527m6hg0kxx0k6n2bz9qn26g"; + rev = version; + 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 + cargoSha256 = "0bma0l14jv5qhcsxck7vw3ak1w3c8v84cq4hii86i4iqk523zns5"; + cargoPatches = [ + ( fetchpatch { + name = "retworkx-cargo-lock.patch"; + url = "https://github.com/Qiskit/retworkx/commit/a02fd33d357a92dbe9530696a6d85aa59fe8a5b9.patch"; + sha256 = "0gvxr1nqp9ll4skfks4p4d964pshal25kb1nbfzhpyipnzddizr5"; + } ) + ]; - 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 - }; + propagatedBuildInputs = [ python ]; + + nativeBuildInputs = [ pipInstallHook maturin pip ]; - pythonImportsCheck = [ "retworkx" ]; + # 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 + ''; - checkInputs = [ pytestCheckHook ]; + installCheckInputs = [ pytestCheckHook numpy ]; preCheck = '' - pushd $(mktemp -d) - cp -r ${github-source}/$sourceRoot/tests . + export TESTDIR=$(mktemp -d) + cp -r $TMP/$sourceRoot/tests $TESTDIR + pushd $TESTDIR ''; postCheck = "popd"; @@ -52,8 +62,8 @@ buildPythonPackage rec { description = "A python graph library implemented in Rust."; homepage = "https://retworkx.readthedocs.io/en/latest/index.html"; downloadPage = "https://github.com/Qiskit/retworkx/releases"; + changelog = "https://github.com/Qiskit/retworkx/releases/tag/${version}"; license = licenses.asl20; maintainers = with maintainers; [ drewrisinger ]; - platforms = platforms.x86_64; }; } |