linux_xanmod: 5.11.14 -> 5.11.15
[NixPkgs.git] / pkgs / development / python-modules / ndtypes / default.nix
blob75fc5373b4c5a496a05e6e3e2b4332defa277faa
1 { lib
2 , stdenv
3 , buildPythonPackage
4 , python
5 , numpy
6 , libndtypes
7 , isPy27
8 }:
10 buildPythonPackage {
11   pname = "ndtypes";
12   disabled = isPy27;
13   inherit (libndtypes) version src meta;
15   propagatedBuildInputs = [ numpy ];
17   postPatch = ''
18     substituteInPlace setup.py \
19       --replace 'include_dirs = ["libndtypes"]' \
20                 'include_dirs = ["${libndtypes}/include"]' \
21       --replace 'library_dirs = ["libndtypes"]' \
22                 'library_dirs = ["${libndtypes}/lib"]' \
23       --replace 'runtime_library_dirs = ["$ORIGIN"]' \
24                 'runtime_library_dirs = ["${libndtypes}/lib"]'
25   '';
27   postInstall = ''
28     mkdir $out/include
29     cp python/ndtypes/*.h $out/include
30   '' + lib.optionalString stdenv.isDarwin ''
31     install_name_tool -add_rpath ${libndtypes}/lib $out/${python.sitePackages}/ndtypes/_ndtypes.*.so
32   '';
34   checkPhase = ''
35     pushd python
36     mv ndtypes _ndtypes
37     python test_ndtypes.py
38     popd
39   '';