From b61f453941e398fd28ea74b43c4dc628d08c255d Mon Sep 17 00:00:00 2001 From: ptv Date: Fri, 5 May 2006 06:55:56 +0000 Subject: [PATCH] use omnipatch for tests on WIN32 --- src/Container/SALOME_ContainerPy.py | 4 +--- src/KERNEL_PY/import_hook.py | 1 + src/KERNEL_PY/kernel_shared_modules.py | 6 ++---- src/KERNEL_PY/salome.py | 4 +--- src/KERNEL_PY/salome_shared_modules.py | 17 ++++++++++------- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/Container/SALOME_ContainerPy.py b/src/Container/SALOME_ContainerPy.py index 61e2626b4..246b98d8c 100755 --- a/src/Container/SALOME_ContainerPy.py +++ b/src/Container/SALOME_ContainerPy.py @@ -32,9 +32,7 @@ import os import sys import string -# On Win32, don't use omnipatch with omniOrb 4.0.7 so far -if not sys.platform == "win32": - import omnipatch # PAL10310 +import omnipatch # PAL10310 from omniORB import CORBA, PortableServer import SALOMEDS diff --git a/src/KERNEL_PY/import_hook.py b/src/KERNEL_PY/import_hook.py index 79725c627..36bbdb7b4 100755 --- a/src/KERNEL_PY/import_hook.py +++ b/src/KERNEL_PY/import_hook.py @@ -76,6 +76,7 @@ def set_shared_imported_with_copy(name,module): def import_hook(name, globals=None, locals=None, fromlist=None): #print "import_hook",name,fromlist module=get_shared_imported(name) + if module: sys.modules[name]=module return module diff --git a/src/KERNEL_PY/kernel_shared_modules.py b/src/KERNEL_PY/kernel_shared_modules.py index bf391f811..ed8618789 100755 --- a/src/KERNEL_PY/kernel_shared_modules.py +++ b/src/KERNEL_PY/kernel_shared_modules.py @@ -22,10 +22,8 @@ import omniORB register_name("CosNaming") import CosNaming -# On Win32, don't use omnipatch with omniOrb 4.0.7 so far -if not sys.platform == "win32": - register_name("omnipatch") - import omnipatch +register_name("omnipatch") +import omnipatch import Engines import SALOME diff --git a/src/KERNEL_PY/salome.py b/src/KERNEL_PY/salome.py index 58299dbc5..9ed2dadc5 100755 --- a/src/KERNEL_PY/salome.py +++ b/src/KERNEL_PY/salome.py @@ -25,9 +25,7 @@ # $Header$ import sys -# On Win32, don't use omnipatch with omniOrb 4.0.7 so far -if not sys.platform == "win32": - import omnipatch +import omnipatch from salome_kernel import * from salome_study import * diff --git a/src/KERNEL_PY/salome_shared_modules.py b/src/KERNEL_PY/salome_shared_modules.py index b9fe3a95b..ddb656dcd 100755 --- a/src/KERNEL_PY/salome_shared_modules.py +++ b/src/KERNEL_PY/salome_shared_modules.py @@ -57,12 +57,7 @@ import import_hook # shared_imported, patterns, register_name, register_pattern # will be shared by all Python sub interpretors -# On Win32, don't use omnipatch with omniOrb 4.0.7 so far -if not sys.platform == "win32": - from omnipatch import shared_imported - import_hook.shared_imported=shared_imported -else: - shared_imported=import_hook.shared_imported +shared_imported=import_hook.shared_imported from import_hook import patterns from import_hook import register_name @@ -77,15 +72,23 @@ list_modules=[] # Import all *_shared_modules in the path and store them in list_modules path=salome_path.split(":") + +print path for rep in path: # Import all *_shared_modules in rep - for f in glob.glob(os.path.join(rep,"lib","python"+sys.version[:3],"site-packages","salome","shared_modules","*_shared_modules.py")): + glob_path = os.path.join(rep,"lib","python"+sys.version[:3],"site-packages","salome","shared_modules","*_shared_modules.py") + if sys.platform == "win32": + glob_path = os.path.join(rep,"win32","python","shared_modules","*_shared_modules.py") + for f in glob.glob(glob_path): try: name=os.path.splitext(os.path.basename(f))[0] register_name(name) + #print name + " REGISTERED" m=__import__(name) + #print name + " IMPORTED" list_modules.append(m) except: + print "Exception during register and import shared module" pass # -- 2.39.2