diff options
Diffstat (limited to 'numpy/distutils/ccompiler.py')
-rw-r--r-- | numpy/distutils/ccompiler.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py index 4495c8fee..713b8c72f 100644 --- a/numpy/distutils/ccompiler.py +++ b/numpy/distutils/ccompiler.py @@ -23,7 +23,8 @@ from numpy.distutils.exec_command import ( ) from numpy.distutils.misc_util import cyg2win32, is_sequence, mingw32, \ get_num_build_jobs, \ - _commandline_dep_string + _commandline_dep_string, \ + sanitize_cxx_flags # globals for parallel build management import threading @@ -143,12 +144,18 @@ def CCompiler_spawn(self, cmd, display=None): except subprocess.CalledProcessError as exc: o = exc.output s = exc.returncode - except OSError: + except OSError as e: # OSError doesn't have the same hooks for the exception # output, but exec_command() historically would use an # empty string for EnvironmentError (base class for # OSError) - o = b'' + # o = b'' + # still that would make the end-user lost in translation! + o = f"\n\n{e}\n\n\n" + try: + o = o.encode(sys.stdout.encoding) + except AttributeError: + o = o.encode('utf8') # status previously used by exec_command() for parent # of OSError s = 127 @@ -674,7 +681,9 @@ def CCompiler_cxx_compiler(self): return self cxx = copy(self) - cxx.compiler_so = [cxx.compiler_cxx[0]] + cxx.compiler_so[1:] + cxx.compiler_cxx = cxx.compiler_cxx + cxx.compiler_so = [cxx.compiler_cxx[0]] + \ + sanitize_cxx_flags(cxx.compiler_so[1:]) if sys.platform.startswith('aix') and 'ld_so_aix' in cxx.linker_so[0]: # AIX needs the ld_so_aix script included with Python cxx.linker_so = [cxx.linker_so[0], cxx.compiler_cxx[0]] \ |