def value_filter(self, value):
res=value
- # on windows platform, replace / by \
- if src.architecture.is_windows():
- res = value.replace("/","\\")
return res
self._do_init(output, environ)
self.python_version=self.environ.get("sat_python_version")
self.bin_kernel_root_dir=self.environ.get("sat_bin_kernel_install_dir")
- self.app_root_dir=self.environ.get("sat_app_root_dir")
# four whitespaces for first indentation in a python script
self.indent=" "
launcher_header=launcher_header2
else:
launcher_header=launcher_header3
+ # in case of Windows OS, Python scripts are not executable. PyExe ?
+ if src.architecture.is_windows():
+ launcher_header = launcher_header.replace("#! /usr/bin/env python3",'')
self.output.write(launcher_header\
.replace("BIN_KERNEL_INSTALL_DIR", self.bin_kernel_root_dir))
def add_comment(self, comment):
- # Special comment in case of the distène licence
+ # Special comment in case of the DISTENE licence
if comment=="DISTENE license":
self.output.write(self.indent+
"#"+
bash_header="""\
#!/bin/bash
+if [ "$BASH" = "" ]
+then
+ # check that the user is not using another shell
+ echo
+ echo "Warning! SALOME environment not initialized"
+ echo "You must run this script in a bash shell."
+ echo "As you are using another shell. Please first run: bash"
+ echo
+fi
##########################################################################
#
# This line is used only in case of a sat package
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
# Preliminary work to initialize path to SALOME Python modules
def __initialize():
- sys.path[:0] = [ 'BIN_KERNEL_INSTALL_DIR' ] # to get salomeContext
+ sys.path[:0] = [ r'BIN_KERNEL_INSTALL_DIR' ] # to get salomeContext
# define folder to store omniorb config (initially in virtual application folder)
try:
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
# Preliminary work to initialize path to SALOME Python modules
def __initialize():
- sys.path[:0] = [ 'BIN_KERNEL_INSTALL_DIR' ]
+ sys.path[:0] = [ r'BIN_KERNEL_INSTALL_DIR' ]
# define folder to store omniorb config (initially in virtual application folder)
try:
"""
launcher_tail_py2="""\
+ #[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
"""
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