Yes, I agree. On Jun 18, 2008, at 7:41 PM, Brian Granger wrote:
> I now have the following approach working with my project: > > I call cython from the top-level dir (the one containing setup.py): > > cython -I. distarray/core/maps_fast.pyx > > And this works fine. I can run with this approach and some ways it is > nicer for situations like this. But I still think cython should first > look in the directory containing the pyx file first. > > Cheers, > > Brian > > On Wed, Jun 18, 2008 at 7:38 PM, Greg Ewing > <[EMAIL PROTECTED]> wrote: >> Brian Granger wrote: >> >>> IF: there is a __init__.py file in the same directory as my pxd >>> and pyx file >>> >>> THEN: the pxd file is not processed and my extension type won't have >>> any attributes defined in the C code >> >> I think this is a result of a recent change to Pyrex that >> has been merged into Cython. >> >> If a directory contains an __init__.py or __init__.pyx file, >> it's now assumed to be a package directory. So, for example, >> if you have a directory structure >> >> foo/ >> __init__.py >> shrubbing.pxd >> shrubbing.pyx >> >> then the shrubbing module is assumed to belong to a package >> called 'foo', and its fully qualified module name is >> 'foo.shrubbing'. >> >> So when Pyrex wants to find out whether there is a .pxd >> file for shrubbing, it looks for one corresponding to a >> module called 'foo.shrubbing'. It does this by searching >> the include path for a top-level package directory called >> 'foo' containing a file called 'shrubbing.pxd'. >> >> However, if foo is the current directory you're running >> the compiler from, and you haven't added foo to the >> include path using a -I option, then it won't be on >> the include path, and the .pxd won't be found. >> >> What to do about this depends on whether you really >> intend the module to reside in a package. >> >> If you intend shrubbing to be a top-level module, you >> will have to move it somewhere else where there is >> no __init__.* file. >> >> If you do intend it to reside in a package, then there >> are two alternatives: >> >> 1) cd to the directory containing foo and compile >> from there: >> >> cd ..; cython foo/shrubbing.pyx >> >> 2) arrange for the directory containing foo to be >> passed as a -I option, e.g. >> >> cython -I .. shrubbing.pyx >> >> Arguably this behaviour is not very desirable, and I'll >> see if I can do something about it. >> >> -- >> Greg >> _______________________________________________ >> Cython-dev mailing list >> [email protected] >> http://codespeak.net/mailman/listinfo/cython-dev >> > _______________________________________________ > Cython-dev mailing list > [email protected] > http://codespeak.net/mailman/listinfo/cython-dev _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
