Ondrej Certik wrote:
> On Thu, Jun 11, 2009 at 1:59 AM, Stefan Behnel wrote:
>> Ondrej Certik wrote:
>>> we use cmake to build the project (C++ and cython) and cmake
>>> allows to build the project out of the tree, e.g. it leaves the .cpp
>>> and .py files in the source dir and creates a build dir, where it
>>> stores all the .o and .so files.
>> Uhm, so the real problem is that cmake fails to take the source directory
>> structure into account when copying build artefacts over to the build
>> directory?
> 
> I think cmake is doing it right, it only builds binary things in the
> binary directory and leaves all the sources (be it python or C++) in
> the source directory.

Ok, I get it, so all that's missing here to make this work is put either
the __init__.py files next to the binaries or the binaries next to the
__init__.py files.


> Consider this cython statement:
> 
> from hermes2d._hermes2d cimport scalar, RealFunction, RefMap, WeakForm, \
>         int_grad_u_grad_v, int_v, malloc
> 
> This is essentially converted to a statement
> 
> py_module = PyImport_Import("hermes2d._hermes2d");      // Yes, I know
> it's actually PyString in there and this is handled automatically by
> __Pyx_ImportModule
> 
> Which is correct. Consider however this statement:
> 
> from _hermes2d cimport scalar, RealFunction, RefMap, WeakForm, \
>         int_grad_u_grad_v, int_v, malloc
> 
> which is converted to:
> 
> py_module = PyImport_Import("hermes2d._hermes2d");
> 
> which I think is not right, because Cython changed my import path (and
> what is worse, it depends on the positions of the __init__.py files in
> my directory). All I am asking is if there is a really good reason,
> why Cython mangles the import paths

Yes (although it doesn't "mangle" them). Cython needs to know the fully
qualified module names to correctly handle class cimports. Otherwise, the
type would be known with one name in the module that implements it and with
a different name in the module that cimports it. Greg would know this better.

BTW, this has been discussed before (on the Pyrex list, I guess).

Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to