diff options
Diffstat (limited to 'pkgs/development/python-modules/scipy/default.nix')
-rw-r--r-- | pkgs/development/python-modules/scipy/default.nix | 120 |
1 files changed, 65 insertions, 55 deletions
diff --git a/pkgs/development/python-modules/scipy/default.nix b/pkgs/development/python-modules/scipy/default.nix index 64e261c374039..19bba41bfa501 100644 --- a/pkgs/development/python-modules/scipy/default.nix +++ b/pkgs/development/python-modules/scipy/default.nix @@ -1,30 +1,34 @@ -{ lib -, stdenv -, fetchFromGitHub -, fetchpatch -, fetchurl -, writeText -, python -, pythonOlder -, buildPythonPackage -, cython -, gfortran -, meson-python -, nukeReferences -, pkg-config -, pythran -, wheel -, setuptools -, hypothesis -, pytest7CheckHook -, pytest-xdist -, numpy -, pybind11 -, pooch -, libxcrypt -, xsimd -, blas -, lapack +{ + lib, + stdenv, + fetchFromGitHub, + fetchpatch, + fetchurl, + writeText, + python, + pythonOlder, + buildPythonPackage, + cython, + gfortran, + meson-python, + nukeReferences, + pkg-config, + pythran, + wheel, + setuptools, + hypothesis, + pytest7CheckHook, + pytest-xdist, + numpy, + pybind11, + pooch, + libxcrypt, + xsimd, + blas, + lapack, + + # Reverse dependency + sage, }: let @@ -42,7 +46,8 @@ let face = "11i8x29h80y7hhyqhil1fg8mxag5f827g33lhnsf44qk116hp2wx"; }; datasets = lib.mapAttrs ( - d: hash: fetchurl { + d: hash: + fetchurl { url = "https://raw.githubusercontent.com/scipy/dataset-${d}/main/${d}.dat"; sha256 = hash; } @@ -55,7 +60,8 @@ let host-python-path = '${python.interpreter}' host-python-version = '${python.pythonVersion}' ''; -in buildPythonPackage { +in +buildPythonPackage { inherit pname version; format = "pyproject"; @@ -72,9 +78,7 @@ in buildPythonPackage { (fetchpatch { url = "https://github.com/scipy/scipy/commit/dd50ac9d98dbb70625333a23e3a90e493228e3be.patch"; hash = "sha256-Vf6/hhwu6X5s8KWhq8bUZKtSkdVu/GtEpGtj8Olxe7s="; - excludes = [ - "doc/source/dev/contributor/meson_advanced.rst" - ]; + excludes = [ "doc/source/dev/contributor/meson_advanced.rst" ]; }) # Fix for https://github.com/scipy/scipy/issues/20300 until 1.13.1 is # released. Patch is based upon: @@ -110,9 +114,7 @@ in buildPythonPackage { pybind11 pooch xsimd - ] ++ lib.optionals (pythonOlder "3.9") [ - libxcrypt - ]; + ] ++ lib.optionals (pythonOlder "3.9") [ libxcrypt ]; propagatedBuildInputs = [ numpy ]; @@ -138,18 +140,23 @@ in buildPythonPackage { doCheck = !(stdenv.isx86_64 && stdenv.isDarwin); - preConfigure = '' - # Helps parallelization a bit - export NPY_NUM_BUILD_JOBS=$NIX_BUILD_CORES - # We download manually the datasets and this variable tells the pooch - # library where these files are cached. See also: - # https://github.com/scipy/scipy/pull/18518#issuecomment-1562350648 And at: - # https://github.com/scipy/scipy/pull/17965#issuecomment-1560759962 - export XDG_CACHE_HOME=$PWD; export HOME=$(mktemp -d); mkdir scipy-data - '' + (lib.concatStringsSep "\n" (lib.mapAttrsToList (d: dpath: - # Actually copy the datasets - "cp ${dpath} scipy-data/${d}.dat" - ) datasets)); + preConfigure = + '' + # Helps parallelization a bit + export NPY_NUM_BUILD_JOBS=$NIX_BUILD_CORES + # We download manually the datasets and this variable tells the pooch + # library where these files are cached. See also: + # https://github.com/scipy/scipy/pull/18518#issuecomment-1562350648 And at: + # https://github.com/scipy/scipy/pull/17965#issuecomment-1560759962 + export XDG_CACHE_HOME=$PWD; export HOME=$(mktemp -d); mkdir scipy-data + '' + + (lib.concatStringsSep "\n" ( + lib.mapAttrsToList ( + d: dpath: + # Actually copy the datasets + "cp ${dpath} scipy-data/${d}.dat" + ) datasets + )); mesonFlags = [ "-Dblas=${blas.pname}" @@ -185,14 +192,17 @@ in buildPythonPackage { passthru = { inherit blas; - updateScript = [ - ./update.sh - # Pass it this file name as argument - (builtins.unsafeGetAttrPos "pname" python.pkgs.scipy).file - ] - # Pass it the names of the datasets to update their hashes - ++ (builtins.attrNames datasetsHashes) - ; + updateScript = + [ + ./update.sh + # Pass it this file name as argument + (builtins.unsafeGetAttrPos "pname" python.pkgs.scipy).file + ] + # Pass it the names of the datasets to update their hashes + ++ (builtins.attrNames datasetsHashes); + tests = { + inherit sage; + }; }; SCIPY_USE_G77_ABI_WRAPPER = 1; |