nixpkgs/pkgs/development/python-modules/ndtypes/default.nix
Robert Scott 044533c99b libndtypes, pythonPackages.ndtypes: unstable-2018-11-27 -> unstable-2019-08-01
this is the most recent commit to upstream's master at time of writing

includes fixes of python package for darwin
2020-09-20 08:58:56 -07:00

40 lines
953 B
Nix

{ stdenv
, buildPythonPackage
, python
, numpy
, libndtypes
, isPy27
}:
buildPythonPackage {
pname = "ndtypes";
disabled = isPy27;
inherit (libndtypes) version src meta;
propagatedBuildInputs = [ numpy ];
postPatch = ''
substituteInPlace setup.py \
--replace 'include_dirs = ["libndtypes"]' \
'include_dirs = ["${libndtypes}/include"]' \
--replace 'library_dirs = ["libndtypes"]' \
'library_dirs = ["${libndtypes}/lib"]' \
--replace 'runtime_library_dirs = ["$ORIGIN"]' \
'runtime_library_dirs = ["${libndtypes}/lib"]'
'';
postInstall = ''
mkdir $out/include
cp python/ndtypes/*.h $out/include
'' + stdenv.lib.optionalString stdenv.isDarwin ''
install_name_tool -add_rpath ${libndtypes}/lib $out/${python.sitePackages}/ndtypes/_ndtypes.*.so
'';
checkPhase = ''
pushd python
mv ndtypes _ndtypes
python test_ndtypes.py
popd
'';
}