Discussion:
[omniORB] omniidl compiler and module name different than file name
Bogdan Jeram
2007-09-28 19:42:20 UTC
Permalink
Dear all,

I think that omniidl compiler for python has some problem with
generating code for cases when IDL modules are not defined in files with
the same name.
For example omniidl compiler assumes that
module ABC
{
....
};

should be in ABC.idl

This is not always the case. For example we can have:
module ABC
{
....
};
in CBA.idl.
In this case compiler generates python modules ABC and ABC_idl.

Practical example is Property service which is (should be) defined in
CosProperty.idl in IDL module CosPropertyService.
I know that omniorb defines Property service in CosPropertyService.idl,
but this is not true for some other ORB implementation, like TAO.

Problem is when we want to use (include) CBA.idl from another idl file
for example My.idl:
#include "CBA.idl"

In this case python module My will try to load module CBA which is not
there and consequently fails.

Workaround for above mentioned situation of the Property service is to
add a file CosProperty.idl which just include CosPropertyService.idl

I think that, in case when file name and module name are different,
compiler should generate python module for IDL module(s) (as it does
now), in addition it should generate python module with the name of the
file which import module(s) generated for IDL module(s).

Regards
Bogdan
Duncan Grisby
2007-09-30 20:33:45 UTC
Permalink
Post by Bogdan Jeram
I think that omniidl compiler for python has some problem with
generating code for cases when IDL modules are not defined in files with
the same name.
For example omniidl compiler assumes that
module ABC
{
....
};
should be in ABC.idl
No it doesn't.

If your IDL looks like this, in file foo.idl

module Bar {
// ...
};

then omniidl will generate three things. It will generate foo_idl.py,
which is an internal implementation detail. Then it will generate
directories Bar/ and Bar__POA/ containing __init__.py files that import
foo_idl, which are the packages required by the Python mapping standard.

[...]
Post by Bogdan Jeram
I think that, in case when file name and module name are different,
compiler should generate python module for IDL module(s) (as it does
now), in addition it should generate python module with the name of the
file which import module(s) generated for IDL module(s).
That's exactly what it already does, and always has done.

Can you give a complete example of precisely what is causing you a
problem? Include the IDL files and a directory listing showing the
output of omniidl.

Cheers,

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --
Loading...