[Pyrex] New Distutils implementation for Pyrex.

Billy G. Allie bill.allie at defiant.mug.org
Mon Aug 6 03:44:20 CEST 2007


Phillip J. Eby wrote:
> At 11:41 PM 8/3/2007 -0400, Billy G. Allie wrote:
>> The files that would have to change are:
>> command/upload.py
>> command/easy_install.py
>> dist.py
>> extension.py
>> __init__.py
>> package_index.py
>> tests/__init__.py
>
> No need to change all this; setuptools already works correctly with 
> Pyrex.Distutils. If you want it to work with a different extension 
> type all you need is a different build_ext command, and for that you 
> don't need to patch anything. Just have your setup script specify your 
> build_ext class using setup(... 
> cmdclass=dict(build_ext=my_buildext_class), ...).
>
> That's really all you need; no patching is required.
>
> Indeed, the only reason that setuptools does anything with Pyrex at 
> all is to support *not* compiling .pyx files when Pyrex is *not* 
> installed. If there are .pyx sources for an Extension and 
> Pyrex.Distutils can't be imported, setuptools changes the source file 
> extensions to '.c' so that a distributed pre-built .c file can be 
> compiled without needing Pyrex.
>
If you want to give new options to extension you need to subclass 
entension.py. 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). 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.



More information about the Pyrex mailing list