1{lib, fetchPypi, python, buildPythonPackage, gfortran, nose, pytest, numpy, pybind11}:
2
3let
4 pybind = pybind11.overridePythonAttrs(oldAttrs: {
5 cmakeFlags = oldAttrs.cmakeFlags ++ [
6 "-DPYBIND11_TEST=off"
7 ];
8 doCheck = false; # Circular test dependency
9 });
10in buildPythonPackage rec {
11 pname = "scipy";
12 version = "1.5.2";
13
14 src = fetchPypi {
15 inherit pname version;
16 sha256 = "066c513d90eb3fd7567a9e150828d39111ebd88d3e924cdfc9f8ce19ab6f90c9";
17 };
18
19 checkInputs = [ nose pytest ];
20 nativeBuildInputs = [ gfortran ];
21 buildInputs = [ numpy.blas pybind ];
22 propagatedBuildInputs = [ numpy ];
23
24 # Remove tests because of broken wrapper
25 prePatch = ''
26 rm scipy/linalg/tests/test_lapack.py
27 '';
28
29 doCheck = true;
30
31 preConfigure = ''
32 sed -i '0,/from numpy.distutils.core/s//import setuptools;from numpy.distutils.core/' setup.py
33 export NPY_NUM_BUILD_JOBS=$NIX_BUILD_CORES
34 '';
35
36 preBuild = ''
37 ln -s ${numpy.cfg} site.cfg
38 '';
39
40 enableParallelBuilding = true;
41
42 checkPhase = ''
43 runHook preCheck
44 pushd dist
45 ${python.interpreter} -c 'import scipy; scipy.test("fast", verbose=10)'
46 popd
47 runHook postCheck
48 '';
49
50 passthru = {
51 blas = numpy.blas;
52 };
53
54 setupPyBuildFlags = [ "--fcompiler='gnu95'" ];
55
56 SCIPY_USE_G77_ABI_WRAPPER = 1;
57
58 meta = {
59 description = "SciPy (pronounced 'Sigh Pie') is open-source software for mathematics, science, and engineering. ";
60 homepage = "https://www.scipy.org/";
61 maintainers = with lib.maintainers; [ fridh ];
62 };
63}