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