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.

Title: distutils.msvccompiler - flags are hidden inside initialize()
Type: enhancement Stage: resolved
Components: Distutils, Windows Versions: Python 3.5
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: Matt.Goodman, eric.araujo, mhammond, steve.dower, tim.golden
Priority: normal Keywords:

Created on 2014-02-26 22:37 by Matt.Goodman, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg212318 - (view) Author: Matt Goodman (Matt.Goodman) Date: 2014-02-26 22:37
The flags that you need to compile against libpythonXX.lib are hidden inside of the distutils.msvccompiler class.  This is ok if you want to use distutils to compile extensions against the binary, but other build systems need to run initialize() to get access to the compiler_options attribute.  This call requires a bunch of things to be correct (think MSVC on the path, expected names, etc), and fails in a great quantity of vanilla Windows/Python configurations.   

One example includes the scraping function waf:

I am also sure SCons does this somewhere (or at least ought to).  

I think these values hard coded into the function ought to be exposed elsewhere to streamline other build systems finding them and linking against the core library.  I was thinking something like adding a function that looked something like get_flags(arch, debugTF), which then the initialize() function draws on.  

I am willing to write a patch, but I wanted to make sure there some consensus about the best way to do this before trooping off.  Thanks
msg212868 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2014-03-07 09:44
It may be a good idea to make this information directly available in the sysconfig module, for example.  Before working on a patch right away, I’d recommend getting in touch with build tools developers and ask them what other hidden information they are extracting from distutils internals, so that a clean, comprehensive proposal can be made for Python 3.5 (as a new feature, this cannot go into existing stable versions).
msg386424 - (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
Date User Action Args
2022-04-11 14:57:59adminsetgithub: 64987
2021-02-03 18:30:34steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386424

resolution: out of date
stage: resolved
2014-03-07 09:44:53eric.araujosetversions: + Python 3.5, - Python 3.1, Python 2.7, Python 3.2, Python 3.3
nosy: + mhammond, tim.golden, eric.araujo

messages: + msg212868

type: enhancement
2014-02-26 22:37:09Matt.Goodmancreate