2 # -*- coding: iso-8859-1 -*-
3 # Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
5 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
6 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
8 # This library is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Lesser General Public
10 # License as published by the Free Software Foundation; either
11 # version 2.1 of the License.
13 # This library is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Lesser General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with this library; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
26 # \brief Module that provides services to launch SALOME
29 import sys, os, string, glob, time, pickle, re
32 from launchConfigureParser import verbose
33 from server import process_id, Server
37 # -----------------------------------------------------------------------------
39 from killSalome import killAllPorts
43 kill servers from a previous SALOME exection, if needed,
44 on the CORBA port given in args of runSalome
47 from killSalomeWithPort import killMyPort
48 my_port=str(args['port'])
52 print "problem in killLocalPort()"
56 def givenPortKill(port):
58 kill servers from a previous SALOME exection, if needed,
59 on the same CORBA port
62 from killSalomeWithPort import killMyPort
67 print "problem in LocalPortKill(), killMyPort(%s)"%port
71 def kill_salome(args):
73 Kill servers from previous SALOME executions, if needed;
74 depending on args 'killall' or 'portkill', kill all executions,
75 or only execution on the same CORBA port
80 elif args['portkill']:
81 givenPortKill(str(args['port']))
83 # -----------------------------------------------------------------------------
85 # Class definitions to launch CORBA Servers
88 class InterpServer(Server):
89 def __init__(self,args):
91 if sys.platform != "win32":
92 env_ld_library_path=['env', 'LD_LIBRARY_PATH=' + os.getenv("LD_LIBRARY_PATH")]
93 self.CMD=['xterm', '-e']+ env_ld_library_path + ['python']
95 self.CMD=['cmd', '/c', 'start cmd.exe', '/K', 'python']
100 print "INTERPSERVER::command = ", command
101 if sys.platform == "win32":
103 pid = win32pm.spawnpid( string.join(command, " "),'-nc' )
105 pid = os.spawnvp(os.P_NOWAIT, command[0], command)
106 process_id[pid]=self.CMD
111 def get_cata_path(list_modules,modules_root_dir):
112 """Build a list of catalog paths (cata_path) to initialize the ModuleCatalog server
117 for module in list_modules:
118 if modules_root_dir.has_key(module):
119 module_root_dir=modules_root_dir[module]
120 module_cata=module+"Catalog.xml"
121 cata_file=os.path.join(module_root_dir, "share",setenv.salome_subdir, "resources",module.lower(), module_cata)
123 if os.path.exists(cata_file):
124 cata_path.append(cata_file)
125 modules_cata[module]=cata_file
127 cata_file=os.path.join(module_root_dir, "share",setenv.salome_subdir, "resources", module_cata)
128 if os.path.exists(cata_file):
129 cata_path.append(cata_file)
130 modules_cata[module]=cata_file
132 for path in os.getenv("SALOME_CATALOGS_PATH","").split(os.pathsep):
133 if os.path.exists(path):
134 for cata_file in glob.glob(os.path.join(path,"*Catalog.xml")):
135 module_name= os.path.basename(cata_file)[:-11]
136 if not modules_cata.has_key(module_name):
137 cata_path.append(cata_file)
138 modules_cata[module_name]=cata_file
143 def simanStudyName(args):
145 if _siman_name is None:
146 # siman session paramenters and checkout processing
150 for param in [ 'study', 'scenario', 'user']:
151 siman_param = "siman_%s"%param
152 if siman_param in args:
153 siman_data.append(args[siman_param])
155 print "SIMAN %s must be defined using parameter --siman-%s=XXX" % (siman_param, siman_param)
158 if len(siman_data) == 3:
159 _siman_name = "_".join(siman_data)
165 class CatalogServer(Server):
166 def __init__(self,args):
169 self.SCMD1=['SALOME_ModuleCatalog_Server','-common']
171 home_dir=os.getenv('HOME')
172 if home_dir is not None:
173 self.SCMD2=['-personal',os.path.join(home_dir,'Salome/resources/CatalogModulePersonnel.xml')]
175 def setpath(self,modules_list,modules_root_dir):
176 list_modules = modules_list[:]
177 list_modules.reverse()
178 if self.args["gui"] :
179 list_modules = ["KERNEL", "GUI"] + list_modules
181 list_modules = ["KERNEL"] + list_modules
183 cata_path=get_cata_path(list_modules,modules_root_dir)
185 self.CMD=self.SCMD1 + ['"' + string.join(cata_path,'"::"') + '"'] + self.SCMD2
189 class SalomeDSServer(Server):
190 def __init__(self,args):
193 self.CMD=['SALOMEDS_Server']
197 class ConnectionManagerServer(Server):
198 def __init__(self,args):
201 self.CMD=['SALOME_ConnectionManagerServer']
205 class RegistryServer(Server):
206 def __init__(self,args):
209 self.CMD=['SALOME_Registry_Server', '--salome_session','theSession']
213 class ContainerCPPServer(Server):
214 def __init__(self,args):
217 self.CMD=['SALOME_Container','FactoryServer']
221 class LoggerServer(Server):
222 def __init__(self,args):
225 from salome_utils import generateFileName
226 if sys.platform == "win32": dirpath = os.environ["HOME"]
227 else: dirpath = "/tmp"
228 logfile = generateFileName( dirpath,
234 print "==========================================================="
235 print "Logger server: put log to the file:"
237 print "==========================================================="
238 self.CMD=['SALOME_Logger_Server', logfile]
240 pass # end of LoggerServer class
244 class SessionServer(Server):
245 def __init__(self,args,modules_list,modules_root_dir):
246 self.args = args.copy()
247 # Bug 11512 (Problems with runSalome --xterm on Mandrake and Debian Sarge)
248 #self.args['xterm']=0
251 self.SCMD1=['SALOME_Session_Server']
253 if 'registry' in self.args['embedded']:
254 self.SCMD1+=['--with','Registry',
255 '(','--salome_session','theSession',')']
256 if 'moduleCatalog' in self.args['embedded']:
257 self.SCMD1+=['--with','ModuleCatalog','(','-common']
258 home_dir=os.getenv('HOME')
259 if home_dir is not None:
260 self.SCMD2+=['-personal',os.path.join(home_dir,'Salome/resources/CatalogModulePersonnel.xml')]
262 if 'study' in self.args['embedded']:
263 self.SCMD2+=['--with','SALOMEDS','(',')']
264 if 'cppContainer' in self.args['embedded']:
265 self.SCMD2+=['--with','Container','(','FactoryServer',')']
266 if 'SalomeAppEngine' in self.args['embedded']:
267 self.SCMD2+=['--with','SalomeAppEngine','(',')']
269 if 'cppContainer' in self.args['standalone'] or 'cppContainer' in self.args['embedded']:
271 if 'pyContainer' in self.args['standalone'] or 'pyContainer' in self.args['embedded']:
272 raise Exception('Python containers no longer supported')
275 if self.args.has_key('session_gui'):
276 session_gui = self.args['session_gui']
279 if self.args['splash']:
280 self.SCMD2+=['SPLASH']
282 if self.args['study_hdf'] is not None:
283 self.SCMD2+=['--study-hdf=%s'%self.args['study_hdf']]
285 if simanStudyName(self.args):
286 self.SCMD2+=['--siman-study=%s'%simanStudyName(self.args)]
289 if self.args.has_key('pyscript') and len(self.args['pyscript']) > 0:
290 msg = json.dumps(self.args['pyscript'])
291 self.SCMD2+=['--pyscript=%s'%(msg)]
295 if self.args['noexcepthandler']:
296 self.SCMD2+=['noexcepthandler']
297 if self.args.has_key('user_config'):
298 self.SCMD2+=['--resources=%s'%self.args['user_config']]
299 if self.args.has_key('modules'):
301 #keep only modules with GUI
302 for m in modules_list:
303 if m not in modules_root_dir:
304 list_modules.insert(0,m)
306 fr1 = os.path.join(modules_root_dir[m],"share","salome","resources",m.lower(),"SalomeApp.xml")
307 fr2 = os.path.join(modules_root_dir[m],"share","salome","resources","SalomeApp.xml")
308 if os.path.exists(fr1) or os.path.exists(fr2):
309 list_modules.insert(0,m)
310 list_modules.reverse()
311 self.SCMD2+=['--modules (%s)' % ":".join(list_modules)]
315 def setpath(self,modules_list,modules_root_dir):
316 list_modules = modules_list[:]
317 list_modules.reverse()
318 if self.args["gui"] :
319 list_modules = ["KERNEL", "GUI"] + list_modules
321 list_modules = ["KERNEL"] + list_modules
323 cata_path=get_cata_path(list_modules,modules_root_dir)
325 if (self.args["gui"]) & ('moduleCatalog' in self.args['embedded']):
326 #Use '::' instead ":" because drive path with "D:\" is invalid on windows platform
327 self.CMD=self.SCMD1 + ['"' + string.join(cata_path,'"::"') + '"'] + self.SCMD2
329 self.CMD=self.SCMD1 + self.SCMD2
330 if self.args.has_key('test'):
331 self.CMD+=['-test'] + self.args['test']
332 elif self.args.has_key('play'):
333 self.CMD+=['-play'] + self.args['play']
335 if self.args["gdb_session"] or self.args["ddd_session"]:
336 f = open(".gdbinit4salome", "w")
338 args = " ".join(self.CMD[1:])
339 args = args.replace("(", "\(")
340 args = args.replace(")", "\)")
344 if self.args["ddd_session"]:
345 self.CMD = ["ddd", "--command=.gdbinit4salome", self.CMD[0]]
346 elif self.args["gdb_session"]:
347 self.CMD = ["xterm", "-e", "gdb", "--command=.gdbinit4salome", self.CMD[0]]
351 if self.args["valgrind_session"]:
353 val = os.getenv("VALGRIND_OPTIONS")
357 self.CMD = l + self.CMD
362 class LauncherServer(Server):
363 def __init__(self,args):
366 self.SCMD1=['SALOME_LauncherServer']
369 if 'registry' in self.args['embedded']:
370 self.SCMD1+=['--with','Registry',
371 '(','--salome_session','theSession',')']
372 if 'moduleCatalog' in self.args['embedded']:
373 self.SCMD1+=['--with','ModuleCatalog','(','-common']
374 self.SCMD2+=['-personal',
375 '${HOME}/Salome/resources/CatalogModulePersonnel.xml',')']
376 if 'study' in self.args['embedded']:
377 self.SCMD2+=['--with','SALOMEDS','(',')']
378 if 'cppContainer' in self.args['embedded']:
379 self.SCMD2+=['--with','Container','(','FactoryServer',')']
381 def setpath(self,modules_list,modules_root_dir):
382 list_modules = modules_list[:]
383 list_modules.reverse()
384 if self.args["gui"] :
385 list_modules = ["KERNEL", "GUI"] + list_modules
387 list_modules = ["KERNEL"] + list_modules
389 cata_path=get_cata_path(list_modules,modules_root_dir)
391 if (self.args["gui"]) & ('moduleCatalog' in self.args['embedded']):
392 #Use '::' instead ":" because drive path with "D:\" is invalid on windows platform
393 self.CMD=self.SCMD1 + ['"' + string.join(cata_path,'"::"') + '"'] + self.SCMD2
395 self.CMD=self.SCMD1 + self.SCMD2
397 class NotifyServer(Server):
398 def __init__(self,args,modules_root_dir):
401 self.modules_root_dir=modules_root_dir
402 myLogName = os.environ["LOGNAME"]
403 self.CMD=['notifd','-c',
404 self.modules_root_dir["KERNEL"] +'/share/salome/resources/kernel/channel.cfg',
405 '-DFactoryIORFileName=/tmp/'+myLogName+'_rdifact.ior',
406 '-DChannelIORFileName=/tmp/'+myLogName+'_rdichan.ior',
407 '-DReportLogFile=/tmp/'+myLogName+'_notifd.report',
408 '-DDebugLogFile=/tmp/'+myLogName+'_notifd.debug',
412 # -----------------------------------------------------------------------------
415 """Salome Session Graphic User Interface activation"""
419 import SALOME_ModuleCatalog
420 import SALOME_Session_idl
421 session=clt.waitNS("/Kernel/Session",SALOME.Session)
422 session.GetInterface()
424 # -----------------------------------------------------------------------------
426 def startSalome(args, modules_list, modules_root_dir):
427 """Launch all SALOME servers requested by args"""
428 init_time = os.times()
430 if verbose(): print "startSalome ", args
433 # Set server launch command
435 if args.has_key('server_launch_mode'):
436 Server.set_server_launch_mode(args['server_launch_mode'])
439 # Wake up session option
441 if args['wake_up_session']:
442 if "OMNIORB_CONFIG" not in os.environ:
443 from salome_utils import generateFileName
444 omniorbUserPath = os.getenv("OMNIORB_USER_PATH")
446 if omniorbUserPath is not None:
447 kwargs["with_username"]=True
449 last_running_config = generateFileName(omniorbUserPath, prefix="omniORB",
454 os.environ['OMNIORB_CONFIG'] = last_running_config
459 # Initialisation ORB and Naming Service
462 clt=orbmodule.client(args)
465 # Wake up session option
467 if args['wake_up_session']:
471 import SALOME_ModuleCatalog
472 import SALOME_Session_idl
473 session = clt.waitNS("/Kernel/Session",SALOME.Session)
474 status = session.GetStatSession()
476 from salome_utils import getPortNumber
477 port = getPortNumber()
480 msg += "Session GUI for port number %s is already active."%(port)
482 msg += "If you which to wake up another session,"
484 msg += "please use variable OMNIORB_CONFIG"
486 msg += "to get the correct session object in naming service."
487 sys.stdout.write(msg+"\n")
490 session.GetInterface()
491 args["session_object"] = session
494 # Save Naming service port name into
495 # the file args["ns_port_log_file"]
496 if args.has_key('ns_port_log_file'):
497 omniorbUserPath = os.getenv("OMNIORB_USER_PATH")
498 file_name = os.path.join(omniorbUserPath, args["ns_port_log_file"])
499 f = open(file_name, "w")
500 f.write(os.environ['NSPORT'])
503 # Launch Logger Server (optional)
504 # and wait until it is registered in naming service
508 myServer=LoggerServer(args)
510 clt.waitLogger("Logger")
512 # Notify Server launch
515 if sys.platform != "win32":
516 if verbose(): print "Notify Server to launch"
518 myServer=NotifyServer(args,modules_root_dir)
521 # set siman python path before the session server launching to import scripts inside python console
522 if simanStudyName(args):
523 # MPV: use os.environ here because session server is launched in separated process and sys.path is missed in this case
524 os.environ["PYTHONPATH"] = "/tmp/SimanSalome/" + args['siman_study'] + "/" + \
525 args['siman_scenario'] + "/" + args['siman_user'] + os.pathsep + os.environ["PYTHONPATH"];
527 # Launch Session Server (to show splash ASAP)
531 mySessionServ = SessionServer(args,args['modules'],modules_root_dir)
532 mySessionServ.setpath(modules_list,modules_root_dir)
536 # Launch Registry Server,
537 # and wait until it is registered in naming service
540 if ('registry' not in args['embedded']) | (args["gui"] == 0) :
541 myServer=RegistryServer(args)
543 if sys.platform == "win32":
544 clt.waitNS("/Registry")
546 clt.waitNSPID("/Registry",myServer.PID)
549 # Launch Catalog Server,
550 # and wait until it is registered in naming service
553 if ('moduleCatalog' not in args['embedded']) | (args["gui"] == 0):
554 cataServer=CatalogServer(args)
555 cataServer.setpath(modules_list,modules_root_dir)
557 import SALOME_ModuleCatalog
558 if sys.platform == "win32":
559 clt.waitNS("/Kernel/ModulCatalog",SALOME_ModuleCatalog.ModuleCatalog)
561 clt.waitNSPID("/Kernel/ModulCatalog",cataServer.PID,SALOME_ModuleCatalog.ModuleCatalog)
564 # Launch SalomeDS Server,
565 # and wait until it is registered in naming service
568 #print "ARGS = ",args
569 if ('study' not in args['embedded']) | (args["gui"] == 0):
571 myServer=SalomeDSServer(args)
573 if sys.platform == "win32":
574 clt.waitNS("/myStudyManager")
576 clt.waitNSPID("/myStudyManager",myServer.PID)
579 # Launch LauncherServer
582 myCmServer = LauncherServer(args)
583 myCmServer.setpath(modules_list,modules_root_dir)
587 # Launch ConnectionManagerServer
590 myConnectionServer = ConnectionManagerServer(args)
591 myConnectionServer.run()
594 from Utils_Identity import getShortHostName
596 if os.getenv("HOSTNAME") == None:
597 if os.getenv("HOST") == None:
598 os.environ["HOSTNAME"]=getShortHostName()
600 os.environ["HOSTNAME"]=os.getenv("HOST")
602 theComputer = getShortHostName()
605 # Launch local C++ Container (FactoryServer),
606 # and wait until it is registered in naming service
609 if ('cppContainer' in args['standalone']) | (args["gui"] == 0) :
610 myServer=ContainerCPPServer(args)
612 if sys.platform == "win32":
613 clt.waitNS("/Containers/" + theComputer + "/FactoryServer")
615 clt.waitNSPID("/Containers/" + theComputer + "/FactoryServer",myServer.PID)
617 if 'pyContainer' in args['standalone']:
618 raise Exception('Python containers no longer supported')
621 # Wait until Session Server is registered in naming service
629 import SALOME_ModuleCatalog
630 import SALOME_Session_idl
631 if sys.platform == "win32":
632 session=clt.waitNS("/Kernel/Session",SALOME.Session)
634 session=clt.waitNSPID("/Kernel/Session",mySessionServ.PID,SALOME.Session)
635 args["session_object"] = session
636 end_time = os.times()
638 print "Start SALOME, elapsed time : %5.1f seconds"% (end_time[4]
641 # ASV start GUI without Loader
643 # session.GetInterface()
646 # additionnal external python interpreters
652 nbaddi = args['interp']
655 traceback.print_exc()
656 print "-------------------------------------------------------------"
657 print "-- to get an external python interpreter:runSalome --interp=1"
658 print "-------------------------------------------------------------"
660 if verbose(): print "additional external python interpreters: ", nbaddi
662 for i in range(nbaddi):
664 anInterp=InterpServer(args)
667 # set PYTHONINSPECT variable (python interpreter in interactive mode)
669 os.environ["PYTHONINSPECT"]="1"
675 # siman session paramenters and checkout processing
676 if simanStudyName(args):
677 print '**********************************************'
678 print "Siman study name= '" + simanStudyName(args) + "'"
680 obj = clt.Resolve('myStudyManager')
681 myStudyManager = obj._narrow(SALOMEDS.StudyManager)
682 aNewStudy = myStudyManager.NewStudy(simanStudyName(args))
683 aSimS = myStudyManager.GetSimanStudy()
684 aSimS._set_StudyId(args['siman_study'])
685 aSimS._set_ScenarioId(args['siman_scenario'])
686 aSimS._set_UserId(args['siman_user'])
687 aSimS.CheckOut(aNewStudy)
688 # if session server is enabled, activate the created study
690 print "Activate the SIMAN study in the SALOME GUI"
691 obj = clt.Resolve('/Kernel/Session')
692 mySession = obj._narrow(SALOME.Session)
693 mySession.emitMessage("simanCheckoutDone " + simanStudyName(args))
694 print '**********************************************'
698 # -----------------------------------------------------------------------------
700 def useSalome(args, modules_list, modules_root_dir):
702 Launch all SALOME servers requested by args,
703 save list of process, give info to user,
704 show registered objects in Naming Service.
710 clt = startSalome(args, modules_list, modules_root_dir)
713 traceback.print_exc()
716 print "--- Error during Salome launch ---"
720 from addToKillList import addToKillList
721 from killSalomeWithPort import getPiDict
723 filedict = getPiDict(args['port'])
724 for pid, cmd in process_id.items():
725 addToKillList(pid, cmd, args['port'])
728 if verbose(): print """
729 Saving of the dictionary of Salome processes in %s
730 To kill SALOME processes from a console (kill all sessions from all ports):
732 To kill SALOME from the present interpreter, if it is not closed :
733 killLocalPort() --> kill this session
734 (use CORBA port from args of runSalome)
735 givenPortKill(port) --> kill a specific session with given CORBA port
736 killAllPorts() --> kill all sessions
738 runSalome, with --killall option, starts with killing
739 the processes resulting from the previous execution.
743 # Print Naming Service directory list
749 print " --- registered objects tree in Naming Service ---"
753 if not args['gui'] or not args['session_gui']:
754 if args['shutdown_servers']:
755 class __utils__(object):
756 def __init__(self, port):
758 import killSalomeWithPort
759 self.killSalomeWithPort = killSalomeWithPort
762 self.killSalomeWithPort.killMyPort(self.port)
765 args['shutdown_servers'] = __utils__(args['port'])
769 # run python scripts, passed as command line arguments
771 if args.has_key('pyscript'):
772 if args.has_key('gui') and args.has_key('session_gui'):
773 if not args['gui'] or not args['session_gui']:
774 toimport = args['pyscript']
776 from salomeLauncherUtils import formatScriptsAndArgs
777 command = formatScriptsAndArgs(toimport)
779 proc = subprocess.Popen(command, shell=True)
781 if res: sys.exit(1) # if there's an error when executing script, we should explicitly exit
785 def execScript(script_path):
786 print 'executing', script_path
787 sys.path.insert(0, os.path.dirname(script_path))
788 execfile(script_path,globals())
791 # -----------------------------------------------------------------------------
793 def registerEnv(args, modules_list, modules_root_dir):
795 Register args, modules_list, modules_root_dir in a file
796 for further use, when SALOME is launched embedded in an other application.
798 if sys.platform == "win32":
799 fileEnv = os.getenv('TEMP')
803 fileEnv += os.getenv('USER') + "_" + str(args['port']) \
804 + '_' + args['appname'].upper() + '_env'
805 fenv=open(fileEnv,'w')
806 pickle.dump((args, modules_list, modules_root_dir),fenv)
808 os.environ["SALOME_LAUNCH_CONFIG"] = fileEnv
810 # -----------------------------------------------------------------------------
813 """Salome Launch, when embedded in other application"""
814 fileEnv = os.environ["SALOME_LAUNCH_CONFIG"]
815 fenv=open(fileEnv,'r')
816 args, modules_list, modules_root_dir = pickle.load(fenv)
819 from searchFreePort import searchFreePort
820 searchFreePort(args, 0)
821 clt = useSalome(args, modules_list, modules_root_dir)
824 # -----------------------------------------------------------------------------
827 """Salome launch as a main application"""
829 # define folder to store omniorb config (initially in virtual application folder)
831 from salomeLauncherUtils import setOmniOrbUserPath
837 from salome_utils import getHostName
838 print "runSalome running on %s" % getHostName()
839 args, modules_list, modules_root_dir = setenv.get_config()
843 if args.has_key('save_config'):
844 save_config = args['save_config']
847 if args['wake_up_session']:
851 from searchFreePort import searchFreePort
852 searchFreePort(args, save_config, args.get('useport'))
856 setenv.set_env(args, modules_list, modules_root_dir)
857 clt = useSalome(args, modules_list, modules_root_dir)
860 # -----------------------------------------------------------------------------
862 def foreGround(clt, args):
864 if "session_object" not in args:
866 session = args["session_object"]
868 # Wait until gui is arrived
877 status = session.GetStatSession()
878 gui_detected = status.activeGUI
883 from time import sleep
893 from salome_utils import getPortNumber
894 port = getPortNumber()
897 if sys.platform == "win32":
898 server.CMD = [os.getenv("PYTHONBIN"), "-m", "killSalomeWithPort", "--spy", "%s"%(os.getpid()), "%s"%(port)]
900 server.CMD = ["killSalomeWithPort.py", "--spy", "%s"%(os.getpid()), "%s"%(port)]
902 # os.system("killSalomeWithPort.py --spy %s %s &"%(os.getpid(), port))
908 status = session.GetStatSession()
909 assert status.activeGUI
912 from time import sleep
916 except KeyboardInterrupt:
917 from killSalomeWithPort import killMyPort
927 test = args['gui'] and args['session_gui']
928 test = test or args['wake_up_session']
930 # The next test covers the --pinter option or var PYTHONINSPECT setted
932 test = test and not os.environ.get('PYTHONINSPECT')
934 # The next test covers the python -i $KERNEL_ROOT_DIR/bin/salome/runSalome.py case
937 from ctypes import POINTER, c_int, cast, pythonapi
938 iflag_ptr = cast(pythonapi.Py_InteractiveFlag, POINTER(c_int))
939 test = test and not iflag_ptr.contents.value
943 test = test and os.getenv("SALOME_TEST_MODE", "0") != "1"
944 test = test and args['foreground']
947 foreGround(clt, args)
953 # -----------------------------------------------------------------------------
955 if __name__ == "__main__":