On Sep 16, 2009, at 22:50 , Magnus Lie Hetland wrote:
> If I run
>
> $ cython foo.py
>
> the file foo.pxd in the same directory is evidently used. However, if
> I build an extension with either just foo.py or both foo.py and
> foo.pxd as sources, using Distutils, I get results that seem to
> indicate that the pxd isn't used.
After some fiddling, I've come to the conclusion that this was, most
likely, a PEBKAC :->
I started playing around with Cython's build_ext.py, I've find that
the difference is between the following two versions of the compile
command...
This worked
result = cython_compile(source, options=options)
This, for some reason, didn't:
result = cython_compile(source, options=options
full_module_name=module_name)
Now, I'd put the code in a package -- except I'd left out the
__init__.py for now (which I'd gotten some warnings about, but I
wasn't planning on doing any importing yet, so I thought it wouldn't
matter; I was using a glob in my setup.py and didn't want to compile
the init file). But as the module name was of the form foo.foo, I
suspected this might be the problem ... and indeed it was.
So, I guess, if I'd done it "by the book", and included the
__init__.py file, it would have worked from the start. However I'd say
the compile failed in a rather non-obvious way... (I.e., it actually
did compile -- it just ignored the .pxd file...)
Maybe I'm still missing something, but at least it seems to be working
now :)
(I'd still be interested in hints on how people organize the code for
projects using pure Python mode, though -- so that some .py files get
compiled while others get installed, and so forth.)
--
Magnus Lie Hetland
http://hetland.org
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev