[Pyrex] New Distutils implementation for Pyrex.

Stefan Behnel stefan_ml at behnel.de
Sun Aug 5 17:13:03 CEST 2007



Stefan Behnel wrote:
> Billy G. Allie wrote:
>>  Robert Bradshaw wrote:
>>> On Aug 1, 2007, at 5:55 PM, Billy G. Allie wrote:
>>>> pyrex-cplus: tells Pyrex to use the C++ compiler to compile the  
>>>> generated file.
>>>>     
>>> Is this not handled by the "language" parameter in the  
>>> distutils.core.Extension used in setup.py
>>>   
>> If Pyrex is not told to use the C++ compiler, it will generate a '.c'
>> file instead of a '.cpp' file.

Then it should know about the "language" option rather than requiring its own one.


>>>> pyrex-create-listing: tells Pyrex to place error messages in a  
>>>> listing (.lis) file.
>>>>     
>>> I'm not sure this should be an extra option--it can be accomplished  
>>> easier by piping to a file (or something else for that manner).
>>>   
>> Basically, the pyrex- options were added to allow the existing options
>> for the Pyrex compiler to be  given in the setup.py file.  The pyrex
>> compiler accepts an option to generate a listing file, so this option
>> exists.
>>> Currently in Cython one can do cross-directory imports (like in  
>>> python--essential for a project with 100's of extension modules), and  
>>> this doesn't look like it respects that.
>>>   
>> The pyrex-include-dirs option only specifies additional directory to
>> search for include files (i.e. the -I option to pyrexc).
> 
> Hmmm, this sounds a lot like we don't really needed these options if
> Cython/Pyrex evaluated the options already present in the Extensions objects.
> I don't see much of an advantage in duplicating them.

So, what I'd propose here is to just let Cython obey the include_dirs option
of distutils and have it search its .pxd files there if they are not found in
the same directory as the source file. I don't mind if Cython or my C compiler
search a few directories more than necessary, as long as they find what I
need. And having a single place where include directories are defined makes it
easier to use and keeps us from defining new options.

This would also mean we could more easily provide the public files for the
C-API as part of the install. They should get copied into the system include
directory, next to Python.h, and could then be found by other Cython compiler
runs.

What do you think?

Stefan



More information about the Pyrex mailing list