summary refs log tree commit diff
path: root/pkgs/development/python-modules
diff options
context:
space:
mode:
authorFrederik Rietdijk <freddyrietdijk@fridh.nl>2016-10-25 14:16:28 +0200
committerGitHub <noreply@github.com>2016-10-25 14:16:28 +0200
commitfea23020fef87f20fe81477d33eb9b8ca72e7f2e (patch)
tree8eaaaec60e3c46c1b191fbc4bb4bf614d4871030 /pkgs/development/python-modules
parent1c523bf1ff56fb1f241000b485032e8b6584ffa8 (diff)
parent468a5bc22458f7aeb3ee7b887f29a8e8799c6337 (diff)
downloadnixpkgs-fea23020fef87f20fe81477d33eb9b8ca72e7f2e.tar
nixpkgs-fea23020fef87f20fe81477d33eb9b8ca72e7f2e.tar.gz
nixpkgs-fea23020fef87f20fe81477d33eb9b8ca72e7f2e.tar.bz2
nixpkgs-fea23020fef87f20fe81477d33eb9b8ca72e7f2e.tar.lz
nixpkgs-fea23020fef87f20fe81477d33eb9b8ca72e7f2e.tar.xz
nixpkgs-fea23020fef87f20fe81477d33eb9b8ca72e7f2e.tar.zst
nixpkgs-fea23020fef87f20fe81477d33eb9b8ca72e7f2e.zip
Merge pull request #19585 from veprbl/distutils_fix
python: add C++ compiler support for distutils
Diffstat (limited to 'pkgs/development/python-modules')
-rw-r--r--pkgs/development/python-modules/cython_test.patch15
-rw-r--r--pkgs/development/python-modules/numpy-distutils-C++.patch23
-rw-r--r--pkgs/development/python-modules/numpy.nix8
3 files changed, 45 insertions, 1 deletions
diff --git a/pkgs/development/python-modules/cython_test.patch b/pkgs/development/python-modules/cython_test.patch
new file mode 100644
index 00000000000..5b1cece3aa5
--- /dev/null
+++ b/pkgs/development/python-modules/cython_test.patch
@@ -0,0 +1,15 @@
+diff --git a/tests/run/numpy_math.pyx b/tests/run/numpy_math.pyx
+index eafd23a..4a15522 100644
+--- a/tests/run/numpy_math.pyx
++++ b/tests/run/numpy_math.pyx
+@@ -37,8 +37,8 @@ def test_fp_classif():
+     assert not npmath.isnan(d_zero)
+     assert not npmath.isnan(f_zero)
+ 
+-    assert npmath.isinf(npmath.INFINITY) == 1
+-    assert npmath.isinf(-npmath.INFINITY) == -1
++    assert npmath.isinf(npmath.INFINITY) != 0
++    assert npmath.isinf(-npmath.INFINITY) != 0
+     assert npmath.isnan(npmath.NAN)
+ 
+     assert npmath.signbit(npmath.copysign(1., -1.))
diff --git a/pkgs/development/python-modules/numpy-distutils-C++.patch b/pkgs/development/python-modules/numpy-distutils-C++.patch
new file mode 100644
index 00000000000..4b2d5c640e6
--- /dev/null
+++ b/pkgs/development/python-modules/numpy-distutils-C++.patch
@@ -0,0 +1,23 @@
+diff --git a/numpy/distutils/unixccompiler.py b/numpy/distutils/unixccompiler.py
+index a92ccd3..9630e91 100644
+--- a/numpy/distutils/unixccompiler.py
++++ b/numpy/distutils/unixccompiler.py
+@@ -43,10 +43,15 @@ def UnixCCompiler__compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts
+         if opt not in llink_s:
+             self.linker_so = llink_s.split() + opt.split()
+ 
+-    display = '%s: %s' % (os.path.basename(self.compiler_so[0]), src)
+     try:
+-        self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
+-                   extra_postargs, display = display)
++        if self.detect_language(src) == 'c++':
++            display = '%s: %s' % (os.path.basename(self.compiler_so_cxx[0]), src)
++            self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
++                       extra_postargs, display = display)
++        else:
++            display = '%s: %s' % (os.path.basename(self.compiler_so[0]), src)
++            self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
++                       extra_postargs, display = display)
+     except DistutilsExecError:
+         msg = str(get_exception())
+         raise CompileError(msg)
diff --git a/pkgs/development/python-modules/numpy.nix b/pkgs/development/python-modules/numpy.nix
index 141c8b14fa6..d4534248159 100644
--- a/pkgs/development/python-modules/numpy.nix
+++ b/pkgs/development/python-modules/numpy.nix
@@ -1,4 +1,4 @@
-{lib, python, buildPythonPackage, isPyPy, gfortran, nose, blas}:
+{lib, python, buildPythonPackage, isPy27, isPyPy, gfortran, nose, blas}:
 
 args:
 
@@ -12,6 +12,12 @@ in buildPythonPackage (args // rec {
   buildInputs = args.buildInputs or [ gfortran nose ];
   propagatedBuildInputs = args.propagatedBuildInputs or [ passthru.blas ];
 
+  patches = lib.optionals isPy27 [
+    # See cpython 2.7 patches.
+    # numpy.distutils is used by cython during it's check phase
+    ./numpy-distutils-C++.patch
+  ];
+
   preConfigure = ''
     sed -i 's/-faltivec//' numpy/distutils/system_info.py
   '';