This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Be more careful about selecting the compiler in distutils
Type: Stage: resolved
Components: Distutils Versions: Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: Arfrever, djc, dnozay, eric.araujo, jcea, steve.dower
Priority: normal Keywords:

Created on 2012-02-16 09:37 by djc, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (6)
msg153471 - (view) Author: Dirkjan Ochtman (djc) * (Python committer) Date: 2012-02-16 09:37
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@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.
msg153569 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-02-17 16:52
Could you explain more about what the bug is?
msg153585 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2012-02-17 17:47
The bug is specific to PyPy. PyPy has no Makefile, so sysconfig.get_config_var("CC") returns None in PyPy. The first paragraph in message #153471 is about a different patch, not this patch.
msg153625 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-02-18 02:03
> PyPy has no Makefile, so sysconfig.get_config_var("CC") returns None in PyPy.
Do you think the stdlib sysconfig could be changed to make this call return something meaningful, or should the code use another method to find the compiler to use?

(Getting config vars for 'SO' is one of the (surprisingly few) issues I’ve found when trying to run distutils2 tests with PyPy, I’d love to fix it.)
msg191358 - (view) Author: (dnozay) Date: 2013-06-17 18:48
affects PyPy, here are the downstream issues:
- https://bugs.pypy.org/issue662
- https://bugs.pypy.org/issue674
- https://bugs.pypy.org/issue1057
msg386434 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-03 18:30
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.

If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools
History
Date User Action Args
2022-04-11 14:57:26adminsetgithub: 58238
2021-02-03 18:30:39steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386434

resolution: out of date
stage: resolved
2013-06-17 18:48:05dnozaysetnosy: + dnozay
messages: + msg191358
2012-02-19 04:30:50jceasetnosy: + jcea
2012-02-18 02:03:06eric.araujosetmessages: + msg153625
2012-02-17 17:47:05Arfreversetmessages: + msg153585
2012-02-17 16:52:06eric.araujosetnosy: + Arfrever, eric.araujo
messages: + msg153569

assignee: eric.araujo
components: + Distutils
2012-02-16 09:37:19djcsetversions: + Python 2.7
2012-02-16 09:37:14djccreate