[omniORB] IDL stub topology in python
Luke Deller
ldeller@xplantechnology.com
Sat Feb 1 04:33:02 2003
Hi Thomas,
I'm just a user of omniORB, so I'm open to correction by others, but I
think I can help with your first two questions.
Thomas Lockhart wrote:
> I've been looking at packaging for python IDL and have a few questions
> regarding the current behavior of omniidl. I'm hoping for some
> suggestions on how to install these into production areas.
>
> Here is an example; questions follow:
>
> module x { module y { interface a {}; }; };
>
> generates five files in four directories:
>
> a_idl.py
> x/
> __init__.py - imports a_idl.py
> y/
> __init__.py - imports a_idl.py
> x__POA/
> __init__.py - imports a_idl.py
> y/
> __init__.py - imports a_idl.py
>
> Now, if I define in a separate file another interface in the same
> module namespace:
>
> module x { module y { interface b {}; }; };
>
> I get these same files and one additional file b_idl.py at the top
> level. The other files are modified to import both a_idl.py and
> b_idl.py (pretty slick side-effect behavior from omniidl).
Yes this side-effect behaviour is a pain which precludes the use of
omniidl with parallel make :-(
> 1) Why is a_idl.py (and b_idl.py) imported from all levels of the tree?
The file "a_idl.py" has that name because it was generated from "a.idl",
not because it contains a definition of "interface a".
"a_idl.py" contains the appropriate python translation of everything in
"a.idl". The other directories and python files that you mention only
exist so that the python "import" statement works properly. To
understand this, consider the case where I want to write a servant for
interface x::y::b. In Python I need to write something like:
import x__POA.y
class myservant(x__POA.y.b):
...
This means that there needs to be file in the PYTHONPATH called
"x__POA/y/__init__.py" or else the import will fail. Do you see now the
reason for the generated subdirectories?
> 2) Why are a_idl.py and b_idl.py not isolated down into the
> appropriate subdirectories to avoid file name conflicts with other
> modules? Would it not be possible to import x.y.a_idl (and x.y.b_idl)
> and reduce the possibility of conflicts with, say,
>
> module m { module n { interface a {}; }; };
This example would not produce a conflicting *_idl.py filename unless
you have two *.idl files with the same filename.
> 3) Generating stubs at the top level make it harder to build python
> packages (at least at my level of understanding). To get these _idl.py
> files included the top level directory has to contain a __init__.py
> and be mentioned explicitly as a module, since modules and individual
> .py files don't seem to coexist happily in a setup.py file. Or I have
> to include every file explicitly, which seems like a lot of work.
>
> 4) Why is the __POA tree built? Presumably it could allow separation
> of client code from server code.
>
> Thanks in advance for feedback...
>
> - Tom
>
> _______________________________________________
> omniORB-list mailing list
> omniORB-list@omniorb-support.com
> http://www.omniorb-support.com/mailman/listinfo/omniorb-list
>
>