Salome HOME
updated copyright message
[modules/kernel.git] / bin / runSalomeNoServer.py
1 #! /usr/bin/env python3
2 # Copyright (C) 2021-2023  CEA, EDF
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20 import setenv
21 import runSalomeCommon
22 import os
23 import logging
24 logger = logging.getLogger()
25
26 class NoSessionServer(runSalomeCommon.CommonSessionServer):
27     def __init__(self,args,modules_list,modules_root_dir):
28         super().__init__(args,modules_list,modules_root_dir)
29         SalomeAppSLConfig=os.getenv("SalomeAppConfig","")
30         os.putenv("SalomeAppSLConfig", SalomeAppSLConfig)
31     def getSessionServerExe(self):
32         return "SALOME_Session_Server_No_Server"
33
34 from server import process_id
35 from addToKillList import addToKillList,killList
36
37 def main():
38     args, modules_list, modules_root_dir = setenv.get_config()
39     mySessionServ = NoSessionServer(args, args.get('modules', []), modules_root_dir)
40     runSalomeCommon.setVerbose(mySessionServ.args["verbosity"])
41     if mySessionServ.args["killall"]:
42         killList()
43     logger.debug("Effective args : {}".format(mySessionServ.args))
44     mySessionServ.setpath(modules_list, modules_root_dir)
45     mySessionServ.run()
46     for pid, cmd in list(process_id.items()):
47         logger.debug("Killing {} {}".format(pid, cmd))
48         addToKillList(pid, cmd)
49
50 if __name__ == "__main__":
51     main()