python: add C++ compiler support for distutils

This should help with builds against clang
This commit is contained in:
Dmitry Kalinkin
2016-10-15 17:51:09 -04:00
parent 80433e7030
commit 095095c479
4 changed files with 299 additions and 1 deletions

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