summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-01-26 23:50:30 (GMT)
committerGitHub <noreply@github.com>2022-01-26 23:50:30 (GMT)
commitff11effab7ae10b57719c066ee49b52d3991ead3 (patch)
treeecef0b64865546036b81da7ff30654951bb4e8dc
parent49971b2d1890c15eeec2d83ea3e8d178f266c4f9 (diff)
downloadcpython-ff11effab7ae10b57719c066ee49b52d3991ead3.zip
cpython-ff11effab7ae10b57719c066ee49b52d3991ead3.tar.gz
cpython-ff11effab7ae10b57719c066ee49b52d3991ead3.tar.bz2
bpo-38472: setup.py uses LC_ALL=C to check the C compiler (GH-30929)
Fix GCC detection in setup.py when cross-compiling. The C compiler is now run with LC_ALL=C. Previously, the detection failed with a German locale. (cherry picked from commit a9503ac39474a9cb1b1935ddf159c0d9672b04b6) Co-authored-by: Victor Stinner <vstinner@python.org>
-rw-r--r--Misc/NEWS.d/next/Build/2022-01-26-22-59-12.bpo-38472.RxfLho.rst2
-rw-r--r--setup.py4
2 files changed, 5 insertions, 1 deletions
diff --git a/Misc/NEWS.d/next/Build/2022-01-26-22-59-12.bpo-38472.RxfLho.rst b/Misc/NEWS.d/next/Build/2022-01-26-22-59-12.bpo-38472.RxfLho.rst
new file mode 100644
index 0000000..4e0ee70
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2022-01-26-22-59-12.bpo-38472.RxfLho.rst
@@ -0,0 +1,2 @@
+Fix GCC detection in setup.py when cross-compiling. The C compiler is now
+run with LC_ALL=C. Previously, the detection failed with a German locale.
diff --git a/setup.py b/setup.py
index c6023e1..0bec170 100644
--- a/setup.py
+++ b/setup.py
@@ -682,7 +682,9 @@ class PyBuildExt(build_ext):
tmpfile = os.path.join(self.build_temp, 'ccpaths')
if not os.path.exists(self.build_temp):
os.makedirs(self.build_temp)
- ret = run_command('%s -E -v - </dev/null 2>%s 1>/dev/null' % (CC, tmpfile))
+ # bpo-38472: With a German locale, GCC returns "gcc-Version 9.1.0
+ # (GCC)", whereas it returns "gcc version 9.1.0" with the C locale.
+ ret = run_command('LC_ALL=C %s -E -v - </dev/null 2>%s 1>/dev/null' % (CC, tmpfile))
is_gcc = False
is_clang = False
in_incdirs = False