Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchpatch, 5 buildPythonPackage, 6 python, 7 ndtypes, 8 libndtypes, 9 libxnd, 10 isPy27, 11}: 12 13buildPythonPackage { 14 pname = "xnd"; 15 format = "setuptools"; 16 disabled = isPy27; 17 inherit (libxnd) version src meta; 18 19 propagatedBuildInputs = [ ndtypes ]; 20 21 buildInputs = [ libndtypes ]; 22 23 patches = [ 24 # python311 fixes which are on main. remove on update 25 (fetchpatch { 26 name = "python311.patch"; 27 url = "https://github.com/xnd-project/xnd/commit/e1a06d9f6175f4f4e1da369b7e907ad6b2952c00.patch"; 28 hash = "sha256-xzrap+FL5be13bVdsJ3zeV7t57ZC4iyhuZhuLsOzHyE="; 29 }) 30 ]; 31 32 postPatch = '' 33 substituteInPlace setup.py \ 34 --replace 'include_dirs = ["libxnd", "ndtypes/python/ndtypes"] + INCLUDES' \ 35 'include_dirs = ["${libndtypes}/include", "${ndtypes}/include", "${libxnd}/include"]' \ 36 --replace 'library_dirs = ["libxnd", "ndtypes/libndtypes"] + LIBS' \ 37 'library_dirs = ["${libndtypes}/lib", "${libxnd}/lib"]' \ 38 --replace 'runtime_library_dirs = ["$ORIGIN"]' \ 39 'runtime_library_dirs = ["${libndtypes}/lib", "${libxnd}/lib"]' \ 40 ''; 41 42 postInstall = 43 '' 44 mkdir $out/include 45 cp python/xnd/*.h $out/include 46 '' 47 + lib.optionalString stdenv.isDarwin '' 48 install_name_tool -add_rpath ${libxnd}/lib $out/${python.sitePackages}/xnd/_xnd.*.so 49 ''; 50 51 checkPhase = '' 52 pushd python 53 mv xnd _xnd 54 python test_xnd.py 55 popd 56 ''; 57}