# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
shutdown_servers_nam = "shutdown_servers"
foreground_nam = "foreground"
wake_up_session_nam = "wake_up_session"
+launcher_only_nam = "launcher_only"
+launcher_nam = "launcher"
# values in XML configuration file giving specific module parameters (<module_name> section)
# which are stored in opts with key <module_name>_<parameter> (eg SMESH_plugins)
# values of boolean type (must be '0' or '1').
# xml_parser.boolValue() is used for correct setting
-boolKeys = ( gui_nam, splash_nam, logger_nam, file_nam, xterm_nam, portkill_nam, killall_nam, except_nam, pinter_nam, shutdown_servers_nam )
+boolKeys = ( gui_nam, splash_nam, logger_nam, file_nam, xterm_nam, portkill_nam, killall_nam, except_nam, pinter_nam, shutdown_servers_nam, launcher_only_nam )
intKeys = ( interp_nam, )
+strKeys = ( launcher_nam )
# values of list type
listKeys = ( embedded_nam, key_nam, modules_nam, standalone_nam, plugins_nam )
self.opts[key] = self.boolValue( val ) # assign boolean value: 0 or 1
elif nam in intKeys:
self.opts[key] = self.intValue( val ) # assign integer value
+ elif nam in strKeys:
+ self.opts[key] = val # assign value
elif nam in listKeys:
self.opts[key] = [ self.strValue( a ) for a in re.split( "[:;,]", val ) ] # assign list value: []
else:
dest="gui",
help=help_str)
- # Show Desktop (inly in GUI mode). Default: True
+ # Show Desktop (only in GUI mode). Default: True
help_str = "1 to activate GUI desktop [default], "
help_str += "0 to not activate GUI desktop (Session_Server starts, but GUI is not shown). "
help_str += "Ignored in the terminal mode."
dest="print_port",
help=help_str)
+ # launch only omniNames and Launcher server
+ help_str = "launch only omniNames and Launcher server"
+ pars.add_argument("--launcher_only",
+ action="store_true",
+ dest="launcher_only",
+ help=help_str)
+
+ # machine and port where is the Launcher
+ help_str = "machine and port where is the Launcher. Usage: "
+ help_str += "--launcher=machine:port"
+ pars.add_argument("--launcher",
+ metavar="<=machine:port>",
+ type=str,
+ dest="launcher",
+ help=help_str)
+
# Do not relink ${HOME}/.omniORB_last.cfg
help_str = "Do not save current configuration ${HOME}/.omniORB_last.cfg"
pars.add_argument("--nosave-config",
# wake up session
help_str = "Wake up a previously closed session. "
help_str += "The session object is found in the naming service pointed by the variable OMNIORB_CONFIG. "
- help_str += "If this variable is not setted, the last configuration is taken. "
+ help_str += "If this variable is not set, the last configuration is taken. "
pars.add_argument("--wake-up-session",
action="store_true",
- dest="wake_up_session",
+ dest="wake_up_session", default=False,
help=help_str)
# server launch mode
args = {}
#def get_env():
#args = []
-def get_env(appname=salomeappname, cfgname=salomecfgname, exeName=None):
+def get_env(appname=salomeappname, cfgname=salomecfgname, exeName=None, keepEnvironment=True):
###
# Collect launch configuration files:
# - The environment variable "<appname>Config" (SalomeAppConfig) which can
# - These directories are analyzed beginning from the last one in the list,
# so the first directory listed in "<appname>Config" environment variable
# has higher priority: it means that if some configuration options
- # is found in the next analyzed cofiguration file - it will be replaced
+ # is found in the next analyzed configuration file - it will be replaced
# - The last configuration file which is parsed is user configuration file
# situated in the home directory (if it exists):
# * ~/.config/salome/.<appname>rc[.<version>]" for Linux (e.g. ~/.config/salome/.SalomeApprc.6.4.0)
# - Command line options have the highest priority and replace options
# specified in configuration file(s)
###
-
global args
config_var = appname+'Config'
else:
dirs += re.split('[;|:]', os.getenv(config_var))
- gui_available = False
- if os.getenv("GUI_ROOT_DIR"):
- gui_resources_dir = os.path.join(os.getenv("GUI_ROOT_DIR"),'share','salome','resources','gui')
- if os.path.isdir(gui_resources_dir):
- gui_available = True
- dirs.append(gui_resources_dir)
- pass
- if not gui_available:
- kernel_resources_dir = os.path.join(os.getenv("KERNEL_ROOT_DIR"),'bin','salome','appliskel')
- if os.getenv("KERNEL_ROOT_DIR") and os.path.isdir( kernel_resources_dir ):
- dirs.append(kernel_resources_dir)
- pass
- os.environ[config_var] = os.pathsep.join(dirs)
+ if not keepEnvironment:
+ if os.getenv("GUI_ROOT_DIR") and os.path.isdir(os.getenv("GUI_ROOT_DIR")):
+ gui_resources_dir = os.path.join(os.getenv("GUI_ROOT_DIR"),'share','salome','resources','gui')
+ if os.path.isdir(gui_resources_dir):
+ dirs.append(gui_resources_dir)
+ pass
+ else:
+ kernel_resources_dir = os.path.join(os.getenv("KERNEL_ROOT_DIR"),'bin','salome','appliskel')
+ if os.getenv("KERNEL_ROOT_DIR") and os.path.isdir( kernel_resources_dir ):
+ dirs.append(kernel_resources_dir)
+ pass
+ os.environ[config_var] = os.pathsep.join(dirs)
dirs.reverse() # reverse order, like in "path" variable - FILO-style processing
if cmd_opts.batch is not None:
args[batch_nam] = True
- if not gui_available:
+ if not os.getenv("GUI_ROOT_DIR") or not os.path.isdir(os.getenv("GUI_ROOT_DIR")):
args[gui_nam] = False
if args[gui_nam]:
if args[gui_nam] and args["session_gui"]:
new_args = []
for sa_obj in args[script_nam]: # args[script_nam] is a list of ScriptAndArgs objects
- script = re.sub(r'^python.*\s+', r'', sa_obj.script)
+ script = re.sub(r'^python. *\s+', r'', sa_obj.script)
new_args.append(ScriptAndArgs(script=script, args=sa_obj.args, out=sa_obj.out))
#
args[script_nam] = new_args
args[shutdown_servers_nam] = cmd_opts.shutdown_servers
pass
+ # Launcher only
+ if cmd_opts.launcher_only is not None:
+ args[launcher_only_nam] = cmd_opts.launcher_only
+
+ # machine and port where is the Launcher
+ if cmd_opts.launcher is not None:
+ args[launcher_nam] = cmd_opts.launcher
+
# Foreground
if cmd_opts.foreground is None:
args[foreground_nam] = 1
args[lang_nam] = cmd_opts.language
# return arguments
- os.environ[config_var] = os.pathsep.join(dirs)
+ if not keepEnvironment:
+ os.environ[config_var] = os.pathsep.join(dirs)
+
# print("Args: ", args)
return args