-def addToSpecial(self, name, value, pathSep=None):
- # add special dangerous cases: TCLLIBPATH PV_PLUGIN_PATH etc...
- # http://computer-programming-forum.com/57-tcl/1dfddc136afccb94.htm
- # TCLLIBPATH: Tcl treats the contents of that variable as a list. Be happy, for you can now use drive letters on windows.
- if value == '':
- return
-
- specialBlanksKeys=["TCLLIBPATH", "TKLIBPATH"]
- specialSemicolonKeys=["PV_PLUGIN_PATH"]
- res=os.pathsep
- if name in specialBlanksKeys: res=" "
- if name in specialSemicolonKeys: res=";"
-
- if pathSep==None:
- sep=res
- else:
- sep=pathSep
- value = os.path.expandvars(value) # expand environment variables
- self.getLogger().debug("Add to %s: %s", name, value)
- env = os.getenv(name, None)
- if env is None:
- os.environ[name] = value
- else:
- os.environ[name] = value + sep + env #explicitely or not special path separator ?whitespace, semicolon?
+# salomeContext only prepend variables, we use our own appendPath when required
+def appendPath(name, value, separator=os.pathsep):
+ if value == '':
+ return
+
+ value = os.path.expandvars(value) # expand environment variables
+ env = os.getenv(name, None)
+ if env is None:
+ os.environ[name] = value
+ else:
+ os.environ[name] = env + separator + value
+
+
+if __name__ == "__main__":
+ args = sys.argv[1:]
+ main(args)
+#
+"""
+
+launcher_tail_py3="""\
+ #[hook to integrate in launcher additionnal user modules]
+
+ # Load all files extra.env.d/*.py and call the module's init routine]
+
+ 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(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)
+
+ #[manage salome doc command]
+ if len(args) >1 and args[0]=='doc':
+ _showDoc(args[1:])
+ return
+
+ # Start SALOME, parsing command line arguments
+ out, err, status = context.runSalome(args)
+ sys.exit(status)
+
+ except SalomeContextException as e:
+ import logging
+ logging.getLogger("salome").error(e)
+ sys.exit(1)
+
+# salomeContext only prepend variables, we use our own appendPath when required
+def appendPath(name, value, separator=os.pathsep):
+ if value == '':
+ return
+
+ value = os.path.expandvars(value) # expand environment variables
+ env = os.getenv(name, None)
+ if env is None:
+ os.environ[name] = value
+ else:
+ os.environ[name] = env + separator + value
+