[Distutils] compiler selection with bdist_egg of setuptools

Phillip J. Eby pje at telecommunity.com
Wed Oct 11 05:18:37 CEST 2006

At 11:03 AM 10/10/2006 -0700, Venkat Bommakanti wrote:
>I can see the verbose logs intially pick up all these settings:
>      ...
>      option dict for 'bdist_egg' command:
>      {'dist_dir': ('setup.cfg',
>        '<my_dist_dir>'),
>        'keep_temp': ('setup.cfg', '1'),
>        'plat_name': ('setup.cfg', 'ppc'),
>         'verbose': ('setup.cfg', '1')}
>but only "verbose=1" appears to be used. The comps are all invoked as
>part of TG's:
>       easy_install -f . --prefix=my_usr -s my_usr/bin TurboGears
>but their respective setup commands get invoked as:
>       setup.py -q bdist_egg --dist-dir /tmp/....

Right, you need to look at the part of the output that comes *after* this, 
as that will be the processing for the child setup script, and that's the 
option processing that counts.

>So, my attempts to specify/use from setup.cfg are getting overriden by
>the above "setup.py -q --dist..." call. This is the snippet that seems to
>indicate that:
>       ...
>       option dict for 'bdist_egg' command:
>       {'dist_dir': ('command line',
>       ...

You need to look for the log information that shows the reading of the 
configuration files; it would be above this point.  You would see lines like:

     reading /some/dir/.pydistutils.cfg
     reading /some/path/to/setup.cfg

etc.  Check and see if the config you think you're using is even being read.

>I did set $DISTUTILS_DEBUG to "yes". Its unclear how/where the fact that
>its a "i686" platform is picked up frm... Taking the RuleDispatch comp as an
>example, the first inkling it is going to use "i686" is this log entry:
>      ...
>      installing library code to build/bdist.linux-i686/egg
>      ...
>Its unclear how this was decided upon... Is it the platform on whicc the 
>itslef was build or is it the platform of the gcc (in the path) ?

It defaults to the platform the distutils intends to build for.  To 
cross-compile, you would have to explicitly override the platform.  Which 
you're doing, but evidently the config file you think you are using is not 
being read.

>Also, what is unclear is how its being determined that the compiler is "gcc"
>and how its options are being set. Taking RuleDispatch again as an example,
>I see this:
>      ...
>I looked in python, setuptools & RulesDisptach sources, but couldn't find the
>answers to these questions.

I think you want to look in distutils.unixccompiler.  This isn't a 
setuptools thing.

>If I knew where gcc/and-its-options were being
>ascertained, config'd, and used, then I could theoretically intervene and have
>it point to my gcc and use my settings for it...
>Again, Philip, thanks a bunch for all the time you've spent helping me on 

No problem, just remember that neither distutils nor setuptools officially 
provide any support whatsoever for cross-compilation.  If you actually 
succeed in getting something to work, I suggest writing up a HowTo or at 
least a description of what you ended up doing, so that others can benefit 
from your trials.

More information about the Distutils-SIG mailing list