--config=<file,folder,...>
==========================
Initialize SALOME context from a list of context files and/or a list
- of folders containing context files. The list is comma-separated, whithout
+ of folders containing context files. The list is comma-separated, without
any blank characters.
'''
"""
def __init__(self, configFileNames=0):
self.getLogger().setLevel(logging.INFO)
- #it could be None explicitely (if user use multiples setVariable...for standalone)
+ #it could be None explicitly (if user use multiples setVariable...for standalone)
if configFileNames is None:
return
configFileNames = configFileNames or []
if len(configFileNames) == 0:
raise SalomeContextException("No configuration files given")
- reserved=['PATH', 'DYLD_FALLBACK_LIBRARY_PATH', 'DYLD_LIBRARY_PATH', 'LD_LIBRARY_PATH', 'PYTHONPATH', 'MANPATH', 'PV_PLUGIN_PATH', 'INCLUDE', 'LIBPATH', 'SALOME_PLUGINS_PATH', 'LIBRARY_PATH']
+ reserved=['PATH', 'DYLD_FALLBACK_LIBRARY_PATH', 'DYLD_LIBRARY_PATH', 'LD_LIBRARY_PATH', 'PYTHONPATH', 'MANPATH', 'PV_PLUGIN_PATH', 'INCLUDE', 'LIBPATH', 'SALOME_PLUGINS_PATH', 'LIBRARY_PATH', 'QT_PLUGIN_PATH']
for filename in configFileNames:
basename, extension = os.path.splitext(filename)
if extension == ".cfg":
"""
Run SALOME!
- Args consist in a mandatory command followed by optionnal parameters.
+ Args consist in a mandatory command followed by optional parameters.
See usage for details on commands.
"""
def _startSalome(self, args):
try:
res = getattr(self, command)(options) # run appropriate method
- return res or (None, None)
+ return res or 0
except SystemExit as ex:
if ex.code != 0:
self.getLogger().error("SystemExit %s in method %s.", ex.code, command)
import runSalome
runSalome.runSalome()
+ return 0
#
def _setContext(self, args=None):
print "*** SALOME context has already been set."
print "*** Enter 'exit' (only once!) to leave SALOME context."
print "***"
- return
+ return 0
os.environ["SALOME_CONTEXT_SET"] = "yes"
print "***"
cmd = ["/bin/bash"]
proc = subprocess.Popen(cmd, shell=False, close_fds=True)
- return proc.communicate()
+ proc.communicate()
+ return proc.returncode
#
def _runSession(self, args=None):
ports = args
if not ports:
print "Port number(s) not provided to command: salome kill <port(s)>"
- return
+ return 1
from multiprocessing import Process
from killSalomeWithPort import killMyPort
p = Process(target = killMyPort, args=(port,))
p.start()
p.join()
- pass
+ return 0
#
def _killAll(self, unused=None):
from killSalome import killAllPorts
killAllPorts()
pass
+ return 0
#
def _runTests(self, args=None):
if "-h" in args or "--help" in args:
print usage + epilog
- return
+ return 0
if "-p" in args or "--ports" in args:
import PortManager
if "-v" in args or "--version" in args:
print "Running with python", platform.python_version()
- self._runAppli(["--version"])
+ return self._runAppli(["--version"])
+
+ return 0
#
def _showDoc(self, args=None):
modules = args
if not modules:
print "Module(s) not provided to command: salome doc <module(s)>"
- return
+ return 1
appliPath = os.getenv("ABSOLUTE_APPLI_PATH")
if not appliPath:
context = pickle.loads(sys.argv[1])
args = pickle.loads(sys.argv[2])
- context._startSalome(args)
+ status = context._startSalome(args)
+ sys.exit(status)
else:
usage()
#