diff options
Diffstat (limited to 'pkgs/development/python-modules/xnd/default.nix')
| -rw-r--r-- | pkgs/development/python-modules/xnd/default.nix | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/pkgs/development/python-modules/xnd/default.nix b/pkgs/development/python-modules/xnd/default.nix index 8317f30e462b..e3145bacc539 100644 --- a/pkgs/development/python-modules/xnd/default.nix +++ b/pkgs/development/python-modules/xnd/default.nix @@ -2,32 +2,42 @@ lib, stdenv, buildPythonPackage, - python, + libxnd, + setuptools, ndtypes, libndtypes, - libxnd, - isPy27, + pythonAtLeast, + python, }: buildPythonPackage { pname = "xnd"; - format = "setuptools"; - disabled = isPy27; inherit (libxnd) version src meta; + pyproject = true; + + build-system = [ setuptools ]; - propagatedBuildInputs = [ ndtypes ]; + dependencies = [ ndtypes ]; buildInputs = [ libndtypes ]; - 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"]' \ - ''; + postPatch = + '' + substituteInPlace setup.py \ + --replace-fail \ + 'include_dirs = ["libxnd", "ndtypes/python/ndtypes"] + INCLUDES' \ + 'include_dirs = ["${libndtypes}/include", "${ndtypes}/include", "${libxnd}/include"]' \ + --replace-fail \ + 'library_dirs = ["libxnd", "ndtypes/libndtypes"] + LIBS' \ + 'library_dirs = ["${libndtypes}/lib", "${libxnd}/lib"]' \ + --replace-fail \ + 'runtime_library_dirs = ["$ORIGIN"]' \ + 'runtime_library_dirs = ["${libndtypes}/lib", "${libxnd}/lib"]' + '' + + lib.optionalString (pythonAtLeast "3.12") '' + substituteInPlace python/xnd/util.h \ + --replace-fail '->ob_digit[i]' '->long_value.ob_digit[i]' + ''; postInstall = '' @@ -39,9 +49,13 @@ buildPythonPackage { ''; checkPhase = '' + runHook preCheck + pushd python mv xnd _xnd python test_xnd.py popd + + runHook postCheck ''; } |
