Re: Import mechanism to support multiple Python versions

2005-03-20 Thread Greg Ewing
Nicolas Fleury wrote: All my code in under a single package. Is it possible to override the import mechanism only for modules under that package and sub-packages so that?: Yes. A package module has a __path__ attribute to which you can add additional directories to be searched for submodules of

Re: Import mechanism to support multiple Python versions

2005-03-18 Thread Serge Orlov
Nicolas Fleury wrote: > Hi, > I'm trying to support two Python versions at the same time and I'm > trying to find effective mechanisms to support modules compiled in > C++ transparently. > > All my code in under a single package. Is it possible to override > the import mechanism only for mod

Re: Import mechanism to support multiple Python versions

2005-03-18 Thread Nicolas Fleury
Nicolas Fleury wrote: import cppmymodule would be equivalent to: if sys.version == "2.4": import cppmymodule24 as cppmymodule elif sys.version == "2.3": import cppmymodule23 as cppmymodule for all modules under the package and all modules with names beginning with cpp (or another way to id

Re: Import mechanism to support multiple Python versions

2005-03-18 Thread Thomas Heller
Nicolas Fleury <[EMAIL PROTECTED]> writes: > I have also third party packages. Is it possible to make a package > point to another folder? For example: > > psyco23/... > psyco24/... > psyco/__init__.py => points to psyco23 or psyco24 depending on Python > version used. You may manipulate the p

Import mechanism to support multiple Python versions

2005-03-18 Thread Nicolas Fleury
Hi, I'm trying to support two Python versions at the same time and I'm trying to find effective mechanisms to support modules compiled in C++ transparently. All my code in under a single package. Is it possible to override the import mechanism only for modules under that package and sub-packa