1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, ndtypes
5, libndtypes
6, libxnd
7, isPy27
8}:
9
10buildPythonPackage {
11 pname = "xnd";
12 disabled = isPy27;
13 inherit (libxnd) version src meta;
14
15 propagatedBuildInputs = [ ndtypes ];
16
17 postPatch = ''
18 substituteInPlace setup.py \
19 --replace 'include_dirs = ["libxnd", "ndtypes/python/ndtypes"] + INCLUDES' \
20 'include_dirs = ["${libndtypes}/include", "${ndtypes}/include", "${libxnd}/include"]' \
21 --replace 'library_dirs = ["libxnd", "ndtypes/libndtypes"] + LIBS' \
22 'library_dirs = ["${libndtypes}/lib", "${libxnd}/lib"]' \
23 --replace 'runtime_library_dirs = ["$ORIGIN"]' \
24 'runtime_library_dirs = ["${libndtypes}/lib", "${libxnd}/lib"]' \
25 '';
26
27 postInstall = ''
28 mkdir $out/include
29 cp python/xnd/*.h $out/include
30 '';
31}