2021-08-22 07:53:02 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchPypi
|
2022-11-21 17:40:18 +00:00
|
|
|
, fetchpatch
|
2021-08-22 07:53:02 +00:00
|
|
|
, python
|
2022-11-04 12:27:35 +00:00
|
|
|
, pythonOlder
|
2021-08-22 07:53:02 +00:00
|
|
|
, buildPythonPackage
|
2021-09-18 10:52:07 +00:00
|
|
|
, cython
|
2021-08-22 07:53:02 +00:00
|
|
|
, gfortran
|
2022-09-30 11:47:45 +00:00
|
|
|
, meson-python
|
|
|
|
, pkg-config
|
2021-09-18 10:52:07 +00:00
|
|
|
, pythran
|
2022-09-30 11:47:45 +00:00
|
|
|
, wheel
|
2021-08-22 07:53:02 +00:00
|
|
|
, nose
|
|
|
|
, pytest
|
|
|
|
, pytest-xdist
|
|
|
|
, numpy
|
|
|
|
, pybind11
|
2022-11-04 12:27:35 +00:00
|
|
|
, libxcrypt
|
2021-08-22 07:53:02 +00:00
|
|
|
}:
|
2021-06-28 23:13:55 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "scipy";
|
2022-09-30 11:47:45 +00:00
|
|
|
version = "1.9.1";
|
|
|
|
format = "pyproject";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2022-09-30 11:47:45 +00:00
|
|
|
sha256 = "sha256-JtKMRokA5tX9s30oEqtG2wzNIsY7qglQV4cfqjpJi8k=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/scipy/scipy/commit/318d8c6d16fdf000be8637e9917989729f2c8ce7.diff";
|
|
|
|
sha256 = "sha256-Zfb9GYP0r9MDJ91hSzMN1r4eNilajPThNIvZmDzFEXo=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
nativeBuildInputs = [ cython gfortran meson-python pythran pkg-config wheel ];
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2022-11-04 12:27:35 +00:00
|
|
|
buildInputs = [
|
|
|
|
numpy.blas
|
|
|
|
pybind11
|
|
|
|
] ++ lib.optionals (pythonOlder "3.9") [
|
|
|
|
libxcrypt
|
|
|
|
];
|
2021-09-18 10:52:07 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [ numpy ];
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
checkInputs = [ nose pytest pytest-xdist ];
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
doCheck = !(stdenv.isx86_64 && stdenv.isDarwin);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
sed -i '0,/from numpy.distutils.core/s//import setuptools;from numpy.distutils.core/' setup.py
|
|
|
|
export NPY_NUM_BUILD_JOBS=$NIX_BUILD_CORES
|
|
|
|
'';
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
# disable stackprotector on aarch64-darwin for now
|
|
|
|
#
|
|
|
|
# build error:
|
|
|
|
#
|
|
|
|
# /private/tmp/nix-build-python3.9-scipy-1.6.3.drv-0/ccDEsw5U.s:109:15: error: index must be an integer in range [-256, 255].
|
|
|
|
#
|
|
|
|
# ldr x0, [x0, ___stack_chk_guard];momd
|
|
|
|
#
|
|
|
|
hardeningDisable = lib.optionals (stdenv.isAarch64 && stdenv.isDarwin) [ "stackprotector" ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
2022-09-30 11:47:45 +00:00
|
|
|
pushd "$out"
|
2022-10-30 15:09:59 +00:00
|
|
|
export OMP_NUM_THREADS=$(( $NIX_BUILD_CORES / 4 ))
|
2021-06-28 23:13:55 +00:00
|
|
|
${python.interpreter} -c "import scipy; scipy.test('fast', verbose=10, parallel=$NIX_BUILD_CORES)"
|
2020-04-24 23:36:52 +00:00
|
|
|
popd
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
blas = numpy.blas;
|
|
|
|
};
|
|
|
|
|
|
|
|
setupPyBuildFlags = [ "--fcompiler='gnu95'" ];
|
|
|
|
|
|
|
|
SCIPY_USE_G77_ABI_WRAPPER = 1;
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "SciPy (pronounced 'Sigh Pie') is open-source software for mathematics, science, and engineering";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://www.scipy.org/";
|
2021-03-09 03:18:52 +00:00
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = [ maintainers.fridh ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|