From 63e2b2351b4fc0353e793495eb7343169960dbbd Mon Sep 17 00:00:00 2001 From: caremoli Date: Fri, 13 Jun 2003 13:59:45 +0000 Subject: [PATCH] CCAR-EDF: kernel_shared_modules has been modified to register all CORBA modules in SALOMEPATH and not only those in KERNEL_ROOT_DIR --- src/SALOME_SWIG/kernel_shared_modules.py | 30 ++++++++++-------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/SALOME_SWIG/kernel_shared_modules.py b/src/SALOME_SWIG/kernel_shared_modules.py index dc4811aa3..1ba9d8bf3 100644 --- a/src/SALOME_SWIG/kernel_shared_modules.py +++ b/src/SALOME_SWIG/kernel_shared_modules.py @@ -35,32 +35,28 @@ from SALOME_utilities import MESSAGE # A Python CORBA module has 2 associated Python packages # These packages are named : and __POA # -# That module is normally installed in shared_modules -# So we should find CORBA shared modules in .. -repertoire=os.path.join(os.path.dirname(__file__),'..') -path=[repertoire,] +# Get the SALOMEPATH if set or else use KERNEL_ROOT_DIR that should be set. +salome_path=os.environ.get("SALOMEPATH",os.getenv("KERNEL_ROOT_DIR")) + +# Register all CORBA modules in the path and python modules in shared_modules +path=salome_path.split(":") # for rep in path: - # Add rep directory in the Python path to be able to import modules - listdir=glob.glob(os.path.join(rep,"*__POA")) - for elem in listdir: + rep_salome=os.path.join(rep,"lib","python"+sys.version[:3],"site-packages","salome") + # Find all the *__POA packages in the path + for elem in glob.glob(os.path.join(rep_salome,"*__POA")): if os.path.isdir(elem): # Found a directory (Python package) named *__POA module__POA=os.path.basename(elem) module=module__POA[:-5] - MESSAGE( "Import CORBA module: " + module + ".\n Directory: " + os.path.abspath(elem)[:-5] ) + MESSAGE( "Register CORBA module: " + module + ". Directory: " + os.path.abspath(elem)[:-5] ) register_name(module) # Now we import modules found in shared_modules directory - r=os.path.join(rep,"shared_modules") - if os.path.isdir(r): - listfich=glob.glob(os.path.join(r,"*.py")) - MESSAGE( str(listfich) ) - for m in listfich: - module=os.path.basename(m)[:-3] - MESSAGE( "Import module: " + module + ".\n Location: " + os.path.abspath(m) ) - register_name(module) - + for elem in glob.glob(os.path.join(rep_salome,"shared_modules","*.py")): + module=os.path.basename(elem)[:-3] + MESSAGE( "Register Python module: " + module + ". Location: " + os.path.abspath(elem) ) + register_name(module) def init_shared_modules(): """ -- 2.39.2