summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorSayed Adel <seiko@imavr.com>2021-11-12 05:14:13 +0200
committerSayed Adel <seiko@imavr.com>2021-11-14 00:47:44 +0200
commit6d698863f6d38e84ae78b6f1aeae1b3d3993ed6b (patch)
tree51dc6f269b6b826fedc4c23d6d68fe33ae5f35b0 /numpy
parent2513620bfbb30fa55bbbba1902f29284adab650c (diff)
downloadnumpy-6d698863f6d38e84ae78b6f1aeae1b3d3993ed6b.tar.gz
BUG, DIST: Print os error message when the executable not exist
this patch is really important since most of the users aren't able to determine the build error when the toolchain or the built environment missing executable files of compiler, linker, assembler, etc.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/distutils/ccompiler.py10
-rw-r--r--numpy/distutils/ccompiler_opt.py4
2 files changed, 10 insertions, 4 deletions
diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py
index 9c85d28b9..713b8c72f 100644
--- a/numpy/distutils/ccompiler.py
+++ b/numpy/distutils/ccompiler.py
@@ -144,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
diff --git a/numpy/distutils/ccompiler_opt.py b/numpy/distutils/ccompiler_opt.py
index d7df386fe..c11be8727 100644
--- a/numpy/distutils/ccompiler_opt.py
+++ b/numpy/distutils/ccompiler_opt.py
@@ -721,8 +721,8 @@ class _Distutils:
except subprocess.CalledProcessError as exc:
o = exc.output
s = exc.returncode
- except OSError:
- o = b''
+ except OSError as e:
+ o = e
s = 127
else:
return None