Salome HOME
CMake: fixed minor bug: when a _ROOT_DIR variable was set by the user after
[modules/kernel.git] / bin / salomeContextUtils.py.in
index 41e2c1138bb4ec87d8de2d236d8953f8372de035..3f517dcf73b3c154d03c8d0dc99170cce3e16ac0 100644 (file)
@@ -35,8 +35,15 @@ class SalomeContextException(Exception):
 def __listDirectory(path):
   allFiles = []
   for root, dirs, files in os.walk(path):
-    configFileNames = glob.glob(os.path.join(root,'*.cfg')) + glob.glob(os.path.join(root,'*.sh'))
-    allFiles += configFileNames
+    cfgFiles = glob.glob(os.path.join(root,'*.cfg'))
+    allFiles += cfgFiles
+
+    shFiles = glob.glob(os.path.join(root,'*.sh'))
+    for f in shFiles:
+      no_ext = os.path.splitext(f)[0]
+      if not os.path.isfile(no_ext+".cfg"):
+        allFiles.append(f)
+
   return allFiles
 #
 
@@ -122,7 +129,9 @@ def getScriptsAndArgs(args=[], searchPathList=None):
       if not os.path.isfile(elt) and not os.path.isfile(elt+".py"):
         eltInSearchPath = __getScriptPath(elt, searchPathList)
         if eltInSearchPath is None or (not os.path.isfile(eltInSearchPath) and not os.path.isfile(eltInSearchPath+".py")):
-          raise SalomeContextException("Script not found: %s"%elt)
+          if elt[-3:] == ".py":
+            raise SalomeContextException("Script not found: %s"%elt)
+          continue
         elt = eltInSearchPath
 
       if elt[-4:] != ".hdf":
@@ -187,8 +196,8 @@ def formatScriptsAndArgs(scriptArgs=[]):
 # an exception is raised if check fails. It allows users for choosing a specific folder.
 # Else the function sets OMNIORB_USER_PATH this way:
 # - If APPLI environment variable is set, OMNIORB_USER_PATH is set to ${APPLI}/USERS.
-#   The function does not check USERS folder existence or wrute access. This folder
-#   must exist ; this is the case if SALOME virtual application has been create using
+#   The function does not check USERS folder existence or write access. This folder
+#   must exist ; this is the case if SALOME virtual application has been created using
 #   appli_gen.py script.
 # - Else OMNIORB_USER_PATH is set to user home directory.
 def setOmniOrbUserPath():