]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-38472: setup.py uses LC_ALL=C to check the C compiler (GH-30929)
authorVictor Stinner <vstinner@python.org>
Wed, 26 Jan 2022 23:22:04 +0000 (00:22 +0100)
committerGitHub <noreply@github.com>
Wed, 26 Jan 2022 23:22:04 +0000 (00:22 +0100)
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.

Misc/NEWS.d/next/Build/2022-01-26-22-59-12.bpo-38472.RxfLho.rst [new file with mode: 0644]
setup.py

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 (file)
index 0000000..4e0ee70
--- /dev/null
@@ -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.
index e30674f31cdb853265f763dbc0df63314a675c05..e47b2ab90958b9053e449b3766fe52ff6435442a 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -848,7 +848,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