On Nov 4, 2008, at 9:58 AM, Stephane DROUARD wrote: > Robert Bradshaw wrote: > >> Ah hah, that's where the error is getting introduced. You can't >> just move > compiled > files around, as their absolute (rather than relative) > location > is needed and used > at compile time. > >> There was a recent thread on whether or not the full module path >> is needed > at >> compile time. It would be nice if one was able to just do stuff >> like this, > but it >> seems the issue is more subtle. (I'll be happy to be proven wrong.) > > Greg Ewing wrote: > >> The cimport statement uses the Pyrex/Cython compiler's idea of the >> module >> namespace at compile time. If you move things around after that, >> it will > get >> confused. > > This is indeed what I was trying to "get round" ;-) > > Today our source code database structure does not care at all of > the final > package structure. So the fact that PXD files need to be located > withing the > same directory structure as the PYD/SO files clearly is an issue > for us. > > This could be seen like any C code that needs a dynamic library: > - the source code includes a .h file that the compiler has to find > possibly > through a -I option, > - the linker has to find the static library (.a/.lib) possibly > through > -L/-l options, > - the application has to find the dynamic library (.so/.dll) possibly > through LD_LIBRARY_PATH/PATH environment variables. > > Among these 3 steps (compiler/linker/execution), none requires that > files > are located in the same directory (and they usually don't). > > So I'm "pushing" to get this behaviour, considering that PXD files > have to > be found at Cython'ization stage (through -I options), while SO/PYD > files at > execution stage (Python stuff). No need for a strong relationship > between > them. > > Meanwhile, I'm patching the generated C code to get round the few > issues I > have around that. I'm reporting these issues, hoping they will be > considered. > > Now if you tell me that it is an intented behaviour, and you don't > plan to > modify it (or support both?), I will stop ennoying you with my > requests. > This also means that I could reconsider the use of Cython for our > needs. > Which would be a pity, I like the philosophy. > > If there's still a chance that my request(s) may be supported one > day, it > might also be nice to support a syntax like: > cimport foo "pkg.foo" > That would load foo.pxd from the path list (-I) but would generate the > equivalent import of pkg.foo at runtime.
To clarify, I would like to see the ability to move compiled (.pyd/.so) files around and have it just work. I am just worried that it will be easy to break things (in unexpected ways) by doing this, and I don't want a feature that only sometimes works. However, I think I'll be in a much more "experimental" mood after this next release. If you can produce patches that does what you want, with tests that show it does, then I would certainly want to include it! - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
