Lets say I have this Python code in a setup.py
script to build a C extension:
from distutils.core import setup, Extension
module1 = Extension('demo', sources = ['demo.c'])
setup (name = 'PackageName',
version = '1.0',
description = 'This is a demo package',
ext_modules = [module1])
Easy enough. Now I call the setup.py
script with this line:
C:/> python setup.py build_ext --compiler=mingw32
Ok, but whats the question?
When distutils calls mingw32 and passes all the necessary and operating system independant flags and options to it, how does it figure those flags out?
Where does distutils keep the commands related to each platform, and how can I access them?
It's not as simple as a set of options but you can see how it works. In your python source directory look for this
In that file each compiler has an entry like this
You can find the code you're looking for in
If you edit your setup.py script and add this
You can see quite a few of the options available...
To access individual options you can use them as follows...
There's no simple set of flags. A lot of the flags are configured at runtime and the code above shows you were to look to see how they're generated etc.