Merge pull request #119126 from fabaff/pycomfoconnect
[NixPkgs.git] / pkgs / development / python-modules / scipy / default.nix
blob0bc8499a373b13152f9b4a99e7d43f42f5ebeb1a
1 {lib, fetchPypi, python, buildPythonPackage, gfortran, nose, pytest, numpy, pybind11}:
3 let
4   pybind = pybind11.overridePythonAttrs(oldAttrs: {
5     cmakeFlags = oldAttrs.cmakeFlags ++ [
6       "-DPYBIND11_TEST=off"
7     ];
8     doCheck = false; # Circular test dependency
9   });
10 in buildPythonPackage rec {
11   pname = "scipy";
12   version = "1.6.1";
14   src = fetchPypi {
15     inherit pname version;
16     sha256 = "048vd4c843xaq45yk3kn491gvqnvhp2i9rxhg671ddlh923fpz64";
17   };
19   checkInputs = [ nose pytest ];
20   nativeBuildInputs = [ gfortran ];
21   buildInputs = [ numpy.blas pybind ];
22   propagatedBuildInputs = [ numpy ];
24   # Remove tests because of broken wrapper
25   prePatch = ''
26     rm scipy/linalg/tests/test_lapack.py
27   '';
29   doCheck = true;
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   '';
36   preBuild = ''
37     ln -s ${numpy.cfg} site.cfg
38   '';
40   checkPhase = ''
41     runHook preCheck
42     pushd dist
43     ${python.interpreter} -c 'import scipy; scipy.test("fast", verbose=10)'
44     popd
45     runHook postCheck
46   '';
48   passthru = {
49     blas = numpy.blas;
50   };
52   setupPyBuildFlags = [ "--fcompiler='gnu95'" ];
54   SCIPY_USE_G77_ABI_WRAPPER = 1;
56   meta = with lib; {
57     description = "SciPy (pronounced 'Sigh Pie') is open-source software for mathematics, science, and engineering";
58     homepage = "https://www.scipy.org/";
59     license = licenses.bsd3;
60     maintainers = [ maintainers.fridh ];
61   };