diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-01-07 02:18:36 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2019-01-07 02:18:47 +0000 |
commit | 36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch) | |
tree | b3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/development/python-modules/numpy/default.nix | |
parent | 4e31070265257dc67d120c27e0f75c2344fdfa9a (diff) | |
parent | abf060725d7614bd3b9f96764262dfbc2f9c2199 (diff) | |
download | nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2 nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip |
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/numpy/default.nix')
-rw-r--r-- | nixpkgs/pkgs/development/python-modules/numpy/default.nix | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/numpy/default.nix b/nixpkgs/pkgs/development/python-modules/numpy/default.nix new file mode 100644 index 000000000000..d66cbd77bbc5 --- /dev/null +++ b/nixpkgs/pkgs/development/python-modules/numpy/default.nix @@ -0,0 +1,84 @@ +{ stdenv, lib, fetchPypi, python, buildPythonPackage, isPyPy, gfortran, pytest, blas, writeTextFile }: + +let + blasImplementation = lib.nameFromURL blas.name "-"; + cfg = writeTextFile { + name = "site.cfg"; + text = (lib.generators.toINI {} { + "${blasImplementation}" = { + include_dirs = "${blas}/include"; + library_dirs = "${blas}/lib"; + } // lib.optionalAttrs (blasImplementation == "mkl") { + mkl_libs = "mkl_rt"; + lapack_libs = ""; + }; + }); + }; +in buildPythonPackage rec { + pname = "numpy"; + version = "1.15.4"; + + src = fetchPypi { + inherit pname version; + extension = "zip"; + sha256 = "3d734559db35aa3697dadcea492a423118c5c55d176da2f3be9c98d4803fc2a7"; + }; + + disabled = isPyPy; + nativeBuildInputs = [ gfortran pytest ]; + buildInputs = [ blas ]; + + patches = lib.optionals (python.hasDistutilsCxxPatch or false) [ + # We patch cpython/distutils to fix https://bugs.python.org/issue1222585 + # Patching of numpy.distutils is needed to prevent it from undoing the + # patch to distutils. + ./numpy-distutils-C++.patch + ]; + + postPatch = lib.optionalString stdenv.hostPlatform.isMusl '' + # Use fenv.h + sed -i \ + numpy/core/src/npymath/ieee754.c.src \ + numpy/core/include/numpy/ufuncobject.h \ + -e 's/__GLIBC__/__linux__/' + # Don't use various complex trig functions + substituteInPlace numpy/core/src/private/npy_config.h \ + --replace '#if defined(__GLIBC__)' "#if 1" \ + --replace '#if !__GLIBC_PREREQ(2, 18)' "#if 1" + ''; + + preConfigure = '' + sed -i 's/-faltivec//' numpy/distutils/system_info.py + export NPY_NUM_BUILD_JOBS=$NIX_BUILD_CORES + ''; + + preBuild = '' + ln -s ${cfg} site.cfg + ''; + + enableParallelBuilding = true; + + checkPhase = '' + runHook preCheck + pushd dist + ${python.interpreter} -c 'import numpy; numpy.test("fast", verbose=10)' + popd + runHook postCheck + ''; + + passthru = { + blas = blas; + inherit blasImplementation cfg; + }; + + # Disable two tests + # - test_f2py: f2py isn't yet on path. + # - test_large_file_support: takes a long time and can cause the machine to run out of disk space + NOSE_EXCLUDE="test_f2py,test_large_file_support"; + + meta = { + description = "Scientific tools for Python"; + homepage = http://numpy.scipy.org/; + maintainers = with lib.maintainers; [ fridh ]; + }; +} |