[omniORB] multiple directories for generated IDL
Brian C. Olson
bolson at rtlogic.com
Wed Sep 17 16:05:33 BST 2003
I have a reason to generate parts of IDL modules into different directories.
Basically, we have some standard IDL that I have pre-generated and installed
into site-packages using a command like:
cd /commonidl
omniidl -I . -bpython -Wbpackage=coolproduct *
ln -s /commonidl/coolproduct site-packages
This allows me to do imports like:
import coolproduct.modulex.moduley as moduley
However, if I want to extend the modulex IDL in a local directory:
/someproject/IDL/extended.IDL
by doing:
cd /someproject/IDL
omniidl -I . -I/commonidl -bpython -Wbpackage=coolproduct *
I get another directory named coolproduct with another__init__.py.
The problem is that although omniidl can find the IDL files and generate the
directory, python thinks there is only one place to find the import for
coolproduct.modulex. Once it finds either my local copy or the site-packages
copy it won't look for the other one. Since they both contain parts of
modulex, they both need to be found.
I can solve this by making my python path find the local one first and
modifying the module paths by changing the omniidl generated versions of
__init__.py in the local directory to include the incantation:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
This seems evil since it is right below a line that says "# DO NOT EDIT THIS
FILE!"
Is there another way to make this work, and if not, would this be useful to
have an option to generate the extend_path incantations in the generated
__init__.py files?
Thanks!
-Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20030917/87d548ea/attachment.htm
More information about the omniORB-list
mailing list