Salome HOME
PR: merge from branch BR_3_1_0deb tag mergeto_trunk_22dec05
[modules/kernel.git] / src / KERNEL_PY / kernel_shared_modules.py
index 5be2f15f469c0c9337fdf85d090523638279a2f9..ed86187896b94d5b4b857c8e3236f28a35ab1fe8 100755 (executable)
@@ -14,7 +14,7 @@ register_pattern(lambda(x):x.endswith("_idl"))
 register_pattern(lambda(x):x.endswith("_Swig"))
 
 register_name("CORBA")
-import CORBA
+from omniORB import CORBA
 
 register_name("omniORB")
 import omniORB
@@ -22,73 +22,9 @@ import omniORB
 register_name("CosNaming")
 import CosNaming
 
-# Modify omniORB to use right sys.modules dictionnary 
-# with multi-interpreter feature
-# openModule and newModule are functions of omniORB/__init__.py module
-# modified to register modules to share
-# Function to return a Python module for the required IDL module name
-def openModule(mname, fname=None):
-    # Salome modification start
-    import sys
-    # Salome modification end
+register_name("omnipatch")
+import omnipatch
 
-    if mname == "CORBA":
-        mod = sys.modules["omniORB.CORBA"]
-    elif sys.modules.has_key(mname):
-        mod = sys.modules[mname]
-    else:
-        mod = newModule(mname)
-
-    # Salome modification start
-    import_hook.set_shared_imported(mname,mod)
-    # Salome modification end
-
-
-    if not hasattr(mod, "__doc__") or mod.__doc__ is None:
-        mod.__doc__ = "omniORB IDL module " + mname + "\n\n" + \
-                      "Generated from:\n\n"
-
-    if fname is not None:
-        mod.__doc__ = mod.__doc__ + "  " + fname + "\n"
-
-    return mod
-
-# Function to create a new module, and any parent modules which do not
-# already exist
-def newModule(mname):
-    # Salome modification start
-    import sys
-    # Salome modification end
-
-    mlist   = string.split(mname, ".")
-    current = ""
-    mod     = None
-
-    for name in mlist:
-        current = current + name
-
-        if sys.modules.has_key(current):
-            mod = sys.modules[current]
-        else:
-            newmod = imp.new_module(current)
-            if mod: setattr(mod, name, newmod)
-            sys.modules[current] = mod = newmod
-
-        current = current + "."
-
-    return mod
-# Replace openModule and newModule by modified ones
-# to take into account the sys.modules that matches
-# the right one (multi-interpreter feature)
-omniORB.openModule=openModule
-omniORB.newModule=newModule
-
-# BE CAREFUL
-# Engines, SALOME, SALOMEDS must be imported in that order because :
-# Engines imports SALOME_Component_idl
-# SALOME imports SALOME_Session_idl and SALOME_Exception_idl which imports SALOME_Component_idl
-# and SALOMEDS imports SALOMEDS_idl and SALOMEDS_Attributes_idl which imports SALOME_Exception_idl
-# If SALOME is imported before Engines, that module would not be completely imported
 import Engines
 import SALOME
 import SALOMEDS