Salome HOME
add sat log on http.server 8765
[tools/sat.git] / src / fileEnviron.py
index e74290a7f024bc51a2c33f0410ccd109d3a79080..5afc9e76124cff524c1a78bc82f175d44c069ec8 100644 (file)
@@ -761,7 +761,7 @@ launcher_header2="""\
 import os
 import sys
 import subprocess
-
+import os.path
 
 # Add the pwdPath to able to run the launcher after unpacking a package
 # Used only in case of a salomeTools package
@@ -835,7 +835,7 @@ launcher_header3="""\
 import os
 import sys
 import subprocess
-
+import os.path
 
 # Add the pwdPath to able to run the launcher after unpacking a package
 # Used only in case of a salomeTools package
@@ -908,15 +908,21 @@ launcher_tail_py2="""\
     
     # Load all files extra.env.d/*.py and call the module's init routine]
 
-    if os.path.exists("extra.env.d"):
-        sys.path.insert(0, os.path.join(os.getcwd(), "extra.env.d"))
-        for filename in os.listdir("extra.env.d"):
+    extradir=out_dir_Path + r"/extra.env.d"
+
+    if os.path.exists(extradir):
+        import imp
+        sys.path.insert(0, os.path.join(os.getcwd(), extradir))
+        for filename in sorted(
+            filter(lambda x: os.path.isfile(os.path.join(extradir, x)),
+                   os.listdir(extradir))):
+
             if filename.endswith(".py"):
-                f = os.path.join("extra.env.d", filename)
+                f = os.path.join(extradir, filename)
                 module_name = os.path.splitext(os.path.basename(f))[0]
                 fp, path, desc = imp.find_module(module_name)
                 module = imp.load_module(module_name, fp, path, desc)
-                module.init(context, out_dir_Path) 
+                module.init(context, out_dir_Path)
 
     #[manage salome doc command]
     if len(args) >1 and args[0]=='doc':
@@ -956,15 +962,21 @@ launcher_tail_py3="""\
     
     # Load all files extra.env.d/*.py and call the module's init routine]
 
-    if os.path.exists("extra.env.d"):
-        sys.path.insert(0, os.path.join(os.getcwd(), "extra.env.d"))
-        for filename in os.listdir("extra.env.d"):
+    extradir=out_dir_Path + r"/extra.env.d"
+
+    if os.path.exists(extradir):
+        import imp
+        sys.path.insert(0, os.path.join(os.getcwd(), extradir))
+        for filename in sorted(
+            filter(lambda x: os.path.isfile(os.path.join(extradir, x)),
+                   os.listdir(extradir))):
+
             if filename.endswith(".py"):
-                f = os.path.join("extra.env.d", filename)
+                f = os.path.join(extradir, filename)
                 module_name = os.path.splitext(os.path.basename(f))[0]
                 fp, path, desc = imp.find_module(module_name)
                 module = imp.load_module(module_name, fp, path, desc)
-                module.init(context, out_dir_Path) 
+                module.init(context, out_dir_Path)
 
     #[manage salome doc command]
     if len(args) >1 and args[0]=='doc':