2020-09-25 04:45:31 +00:00
|
|
|
{ stdenv
|
|
|
|
, buildPythonPackage
|
|
|
|
, python
|
2020-04-24 23:36:52 +00:00
|
|
|
, ndtypes
|
|
|
|
, libndtypes
|
|
|
|
, libxnd
|
|
|
|
, isPy27
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage {
|
|
|
|
pname = "xnd";
|
|
|
|
disabled = isPy27;
|
|
|
|
inherit (libxnd) version src meta;
|
|
|
|
|
|
|
|
propagatedBuildInputs = [ ndtypes ];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace 'include_dirs = ["libxnd", "ndtypes/python/ndtypes"] + INCLUDES' \
|
|
|
|
'include_dirs = ["${libndtypes}/include", "${ndtypes}/include", "${libxnd}/include"]' \
|
|
|
|
--replace 'library_dirs = ["libxnd", "ndtypes/libndtypes"] + LIBS' \
|
|
|
|
'library_dirs = ["${libndtypes}/lib", "${libxnd}/lib"]' \
|
|
|
|
--replace 'runtime_library_dirs = ["$ORIGIN"]' \
|
|
|
|
'runtime_library_dirs = ["${libndtypes}/lib", "${libxnd}/lib"]' \
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir $out/include
|
|
|
|
cp python/xnd/*.h $out/include
|
2020-09-25 04:45:31 +00:00
|
|
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
install_name_tool -add_rpath ${libxnd}/lib $out/${python.sitePackages}/xnd/_xnd.*.so
|
|
|
|
'';
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
pushd python
|
|
|
|
mv xnd _xnd
|
|
|
|
python test_xnd.py
|
|
|
|
popd
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
}
|