if test "x$omniORB_ok" = "xyes"
then
- OMNIORB_IDLCXXFLAGS="-nf -I$OMNIORB_ROOT/idl"
- OMNIORB_IDLPYFLAGS="-bpython -I$OMNIORB_ROOT/idl"
+ OMNIORB_IDLCXXFLAGS="-nf -I${OMNIORB_ROOT}/idl"
+ OMNIORB_IDLPYFLAGS_1='-bpythonbe -p ${top_srcdir}/salome_adm/unix'
+ OMNIORB_IDLPYFLAGS_2=" -I${OMNIORB_ROOT}/idl"
+ OMNIORB_IDLPYFLAGS=${OMNIORB_IDLPYFLAGS_1}${OMNIORB_IDLPYFLAGS_2}
+
AC_SUBST(OMNIORB_IDLCXXFLAGS)
AC_SUBST(OMNIORB_IDLPYFLAGS)
--- /dev/null
+
+pymodule_template = """\
+# DO NOT EDIT THIS FILE!
+#
+# Python module @module@ generated by omniidl
+
+import omnipatch
+omnipatch.updateModule("@module@")
+
+# ** 1. Stub files contributing to this module
+
+# ** 2. Sub-modules
+
+# ** 3. End"""
+
+import omniidl_be.python
+omniidl_be.python.pymodule_template=pymodule_template
+
+def run(tree, args):
+ omniidl_be.python.run(tree, args)
+
import os
import sys
import string
+import omnipatch # PAL10310
from omniORB import CORBA, PortableServer
-# import SALOMEDS before other SALOME modules
-# (if not, incomplete import done by SALOME module: no load of SALOMEDS_attributes)
import SALOMEDS
import Engines, Engines__POA
-reload(Engines)
-reload(Engines__POA)
from SALOME_NamingServicePy import *
from SALOME_ComponentPy import *
@COMMENCE@
-EXPORT_PYSCRIPTS = Help.py PyInterp.py salome.py salome_shared_modules.py batchmode_salome.py import_hook.py salome_test.py salome_kernel.py salome_study.py salome_iapp.py salome_ComponentGUI.py
+EXPORT_PYSCRIPTS = Help.py PyInterp.py salome.py salome_shared_modules.py batchmode_salome.py import_hook.py salome_test.py salome_kernel.py salome_study.py salome_iapp.py salome_ComponentGUI.py omnipatch.py
EXPORT_SHAREDPYSCRIPTS=kernel_shared_modules.py
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
--- /dev/null
+"""
+ This patch of omniORB is made to make it work with multiple interpreters
+ and to correct the problem of incomplete import of CORBA packages
+ in some situations common in SALOME
+
+ This patch add or modify functions in omniORB module.
+
+ In multiple interpreters context, omniORB module is meant to be shared among
+ all interpreters
+"""
+import sys,string,imp
+import omniORB
+# Map of partially-opened modules
+_partialModules = {}
+# Map of modules to share
+shared_imported={}
+
+# Function to return a Python module for the required IDL module name
+def openModule(mname, fname=None):
+ # Salome modification start
+ # Be sure to use the right module dictionnary
+ import sys
+ # Salome modification end
+
+ if mname == "CORBA":
+ mod = sys.modules["omniORB.CORBA"]
+
+ elif sys.modules.has_key(mname):
+ mod = sys.modules[mname]
+
+ if _partialModules.has_key(mname):
+ pmod = _partialModules[mname]
+ mod.__dict__.update(pmod.__dict__)
+ del _partialModules[mname]
+
+ elif _partialModules.has_key(mname):
+ mod = _partialModules[mname]
+
+ else:
+ mod = newModule(mname)
+
+ # Salome modification start
+ 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
+ # Be sure to use the right module dictionnary
+ 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]
+
+ elif _partialModules.has_key(current):
+ mod = _partialModules[current]
+
+ else:
+ newmod = imp.new_module(current)
+ if mod: setattr(mod, name, newmod)
+ _partialModules[current] = mod = newmod
+
+ current = current + "."
+
+ return mod
+
+# Function to update a module with the partial module store in the
+# partial module map
+def updateModule(mname):
+ if _partialModules.has_key(mname):
+ pmod = _partialModules[mname]
+ mod = sys.modules[mname]
+ mod.__dict__.update(pmod.__dict__)
+ del _partialModules[mname]
+
+omniORB.updateModule=updateModule
+omniORB.newModule=newModule
+omniORB.openModule=openModule
+
# Module : SALOME
# $Header$
+import omnipatch
from salome_kernel import *
from salome_study import *
from salome_iapp import *
import import_hook
# shared_imported, patterns, register_name, register_pattern
# will be shared by all Python sub interpretors
-from import_hook import shared_imported
+from omnipatch import shared_imported
+import_hook.shared_imported=shared_imported
from import_hook import patterns
from import_hook import register_name
from import_hook import register_pattern