2021-08-22 07:53:02 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchPypi
|
|
|
|
, 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-12-17 10:02:37 +00:00
|
|
|
version = "1.9.3";
|
2022-09-30 11:47:45 +00:00
|
|
|
format = "pyproject";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2022-12-17 10:02:37 +00:00
|
|
|
sha256 = "sha256-+8XAXIXBoCvnex/1kQh8g7xEV5xtK9n7eYu2TqXhoCc=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
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 ];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ nose pytest pytest-xdist ];
|
2021-09-18 10:52:07 +00:00
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|