Merge pull request #19585 from veprbl/distutils_fix

python: add C++ compiler support for distutils
This commit is contained in:
Frederik Rietdijk
2016-10-25 14:16:28 +02:00
committed by GitHub
7 changed files with 324 additions and 11 deletions

View File

@@ -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.))

View File

@@ -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)

View File

@@ -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
'';