Stefan Behnel | 29 Apr 06:15 2012

Re: Building distutils to find PXD files for Pure Python file

Ian Bell, 29.04.2012 02:06:
> On Sun, Apr 29, 2012 at 12:20 AM, mark florisson wrote:
>> On 27 April 2012 14:03, Ian Bell wrote:
>>>> In any case, the new and preferred way is described here:
>>>> And, yes, it would be good to visibly present this in the documentation.
>>>> The build documentation is mostly ok but lacks this feature:
>>> The build docs are in good shape - lots of useful information, but from
>>> browsing the mailing lists, seems like quite a few people are having
>> varied
>>> issues with PXD files and distutils.   Would be great to have a
>> (nominally)
>>> working example in the documentation online and/or a downloadable
>> version.
>>> Also, an example of getting Cython distutils parameters would be great.
>>> Just for fun, tried a new file, like the link you recommended
>> using
>>> cythonize. Works a charm.  Weird.  I think I am in business for now.
>> Thanks
>>> for your help and patience.
>>> So it seems that cythonize does something slightly different than the
>>> Cython
>>> build_ext command.  I suppose this shouldn't be the expected behavior?
>>> #####  #######
>>> from distutils.core import setup
>>> from Cython.Build import cythonize
>>> setup(
>>>   name = 'MyProject',
>>>   ext_modules = cythonize([""]),
>>> )
> But if I change the module name to integrate_py in below), it
> does work and finds the PXD file properly.  The file I list below for
> DOES work, either using
> from distutils.core import Extension
> or
> from Cython.Distutils.extension import Extension.  I would argue this is a
> bug

Agreed. It should consider the name of the source file, not the name of the
target extension module (even if using different names for both is
confusing to humans).