Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-18.03 77 lines 2.0 kB view raw
1{lib, fetchPypi, python, buildPythonPackage, isPy27, isPyPy, gfortran, nose, blas, hostPlatform }: 2 3buildPythonPackage rec { 4 pname = "numpy"; 5 version = "1.14.2"; 6 name = "${pname}-${version}"; 7 8 src = fetchPypi { 9 inherit pname version; 10 extension = "zip"; 11 sha256 = "facc6f925c3099ac01a1f03758100772560a0b020fb9d70f210404be08006bcb"; 12 }; 13 14 disabled = isPyPy; 15 buildInputs = [ gfortran nose blas ]; 16 17 patches = lib.optionals (python.hasDistutilsCxxPatch or false) [ 18 # See cpython 2.7 patches. 19 # numpy.distutils is used by cython during it's check phase 20 ./numpy-distutils-C++.patch 21 ]; 22 23 postPatch = lib.optionalString hostPlatform.isMusl '' 24 # Use fenv.h 25 sed -i \ 26 numpy/core/src/npymath/ieee754.c.src \ 27 numpy/core/include/numpy/ufuncobject.h \ 28 -e 's/__GLIBC__/__linux__/' 29 # Don't use various complex trig functions 30 substituteInPlace numpy/core/src/private/npy_config.h \ 31 --replace '#if defined(__GLIBC__)' "#if 1" \ 32 --replace '#if !__GLIBC_PREREQ(2, 18)' "#if 1" 33 ''; 34 35 preConfigure = '' 36 sed -i 's/-faltivec//' numpy/distutils/system_info.py 37 export NPY_NUM_BUILD_JOBS=$NIX_BUILD_CORES 38 ''; 39 40 preBuild = '' 41 echo "Creating site.cfg file..." 42 cat << EOF > site.cfg 43 [openblas] 44 include_dirs = ${blas}/include 45 library_dirs = ${blas}/lib 46 EOF 47 ''; 48 49 enableParallelBuilding = true; 50 51 checkPhase = '' 52 runHook preCheck 53 pushd dist 54 ${python.interpreter} -c 'import numpy; numpy.test("fast", verbose=10)' 55 popd 56 runHook postCheck 57 ''; 58 59 postInstall = '' 60 ln -s $out/bin/f2py* $out/bin/f2py 61 ''; 62 63 passthru = { 64 blas = blas; 65 }; 66 67 # Disable two tests 68 # - test_f2py: f2py isn't yet on path. 69 # - test_large_file_support: takes a long time and can cause the machine to run out of disk space 70 NOSE_EXCLUDE="test_f2py,test_large_file_support"; 71 72 meta = { 73 description = "Scientific tools for Python"; 74 homepage = http://numpy.scipy.org/; 75 maintainers = with lib.maintainers; [ fridh ]; 76 }; 77}