1{lib, fetchurl, python, buildPythonPackage, isPy27, isPyPy, gfortran, nose, blas}:
2
3buildPythonPackage rec {
4 pname = "numpy";
5 version = "1.13.1";
6 name = "${pname}-${version}";
7
8 src = fetchurl {
9 url = "mirror://pypi/n/numpy/numpy-${version}.zip";
10 sha256 = "c9b0283776085cb2804efff73e9955ca279ba4edafd58d3ead70b61d209c4fbb";
11 };
12
13 disabled = isPyPy;
14 buildInputs = [ gfortran nose blas ];
15
16 patches = lib.optionals (python.hasDistutilsCxxPatch or false) [
17 # See cpython 2.7 patches.
18 # numpy.distutils is used by cython during it's check phase
19 ./numpy-distutils-C++.patch
20 ];
21
22 preConfigure = ''
23 sed -i 's/-faltivec//' numpy/distutils/system_info.py
24 export NPY_NUM_BUILD_JOBS=$NIX_BUILD_CORES
25 '';
26
27 preBuild = ''
28 echo "Creating site.cfg file..."
29 cat << EOF > site.cfg
30 [openblas]
31 include_dirs = ${blas}/include
32 library_dirs = ${blas}/lib
33 EOF
34 '';
35
36 enableParallelBuilding = true;
37
38 checkPhase = ''
39 runHook preCheck
40 pushd dist
41 ${python.interpreter} -c 'import numpy; numpy.test("fast", verbose=10)'
42 popd
43 runHook postCheck
44 '';
45
46 postInstall = ''
47 ln -s $out/bin/f2py* $out/bin/f2py
48 '';
49
50 passthru = {
51 blas = blas;
52 };
53
54 # Disable two tests
55 # - test_f2py: f2py isn't yet on path.
56 # - test_large_file_support: takes a long time and can cause the machine to run out of disk space
57 NOSE_EXCLUDE="test_f2py,test_large_file_support";
58
59 meta = {
60 description = "Scientific tools for Python";
61 homepage = http://numpy.scipy.org/;
62 maintainers = with lib.maintainers; [ fridh ];
63 };
64}