[Pyrex] New Distutils implementation for Pyrex.

Phillip J. Eby pje at telecommunity.com
Mon Aug 6 17:52:38 CEST 2007


At 01:50 AM 8/6/2007 -0400, Billy G. Allie wrote:
>Phillip J. Eby wrote:
>>At 09:44 PM 8/5/2007 -0400, Billy G. Allie wrote:
>>>If you want to give new options to extension you need to subclass
>>>entension.py.
>>
>>And then just use those classes in your setup.py. You don't need to 
>>patch setuptools for that.
>>
>>
>>>If you want to have those new options available as command
>>>line options (to setup.py), you need to wrap core.py (it can't be
>>>sub-classed).
>>
>>Why do you need options to setup.py instead of just options to the 
>>build_ext command?
>You don't. They are build_ext options, but the command line is 
>parsed by setup.py and unrecognized options will cause errors before 
>build_ext is executed. The setup configuration file is also parsed 
>by setup.py with unrecognized options causing errors.

Not if you use setup(..., 
cmdclass=dict(build_ext=my_build_ext_subclass), ...) it won't, 
because it will ask your subclass for its supported options to do 
both the command line parsing and the config file parsing.


>>>My new Distutils for Pyrex does both. In order for
>>>setuptools to compile pyrex extension (.pyx), it needs to use
>>>Pyrex.Distutils.core instead of distutils.core. If you don't, just
>>>loading build_ext will fail because of undefined extension variables.
>>
>>Per the above, none of this should be necessary.
>Unfortunately, if you want to be able to specify extension options 
>that can also be command line and configuration file options, you do.
>
>If I am mistaken about this, please let me know and give me an 
>example of extension options that will also be command line and 
>configuration file options.

Unless I misunderstand what you mean by "extension options", then you 
are indeed mistaken.  Your build_ext subclass simply defines what 
additional options it wants.  For example, see setuptools' "install" 
subclass, which adds an option called 
--single-version-externally-managed.  It is parsed by the distutils 
on both the command line and in configuration files.

(Of course, such options would be specified as "setup.py build_ext 
--my-new-options-here", not "setup.py --my-new-options".)




More information about the Pyrex mailing list