[New-bugs-announce] [issue14030] Be more careful about selecting the compiler in distutils

Dirkjan Ochtman report at bugs.python.org
Thu Feb 16 10:37:15 CET 2012

New submission from Dirkjan Ochtman <dirkjan at ochtman.nl>:

distutils incorrectly handles CFLAGS as 1 argument instead of
space-separated list of arguments. distutils should respect environment
variables, which set compiler, linker etc.

--- Lib/distutils/unixccompiler.py
+++ Lib/distutils/unixccompiler.py
@@ -297,7 +297,7 @@
        # this time, there's no way to determine this information from
        # the configuration data stored in the Python installation, so
        # we use this hack.
-        compiler = os.path.basename(sysconfig.get_config_var("CC"))
+        compiler = os.path.basename(self.compiler[0])
        if sys.platform[:6] == "darwin":
            # MacOSX's linker doesn't understand the -R flag at all
            return "-L" + dir

Patch was created by Arfrever Frehtes Taifersar Arahesis (arfrever.fta at gmail.com). It was originally written for PyPy, but it seems like it should actually apply to the stdlib. This patch is for 2.7, I'm hoping it could be taken as a bug fix.

messages: 153471
nosy: djc
priority: normal
severity: normal
status: open
title: Be more careful about selecting the compiler in distutils

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list