From: crouzet Date: Fri, 13 Dec 2019 13:42:22 +0000 (+0100) Subject: rename salome.py into run_salome.py X-Git-Tag: V9_5_0a1~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2034125199d446466cef7befc996d0c3943eb3c9;hp=9aa864580c67f5206f7deacd594870cf2433a0c3;p=tools%2FSALOME.git rename salome.py into run_salome.py --- diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt index 3039ff3..f4ab37a 100644 --- a/bin/CMakeLists.txt +++ b/bin/CMakeLists.txt @@ -24,7 +24,7 @@ # These files are executable scripts SET(SCRIPTS start_salome.py # light python launcher - salome.py # python launcher with context api relying on runSalome.py + run_salome.py # python launcher with context api relying on runSalome.py ) SALOME_INSTALL_SCRIPTS("${SCRIPTS}" ${SALOME_INSTALL_SCRIPT_PYTHON}) diff --git a/bin/run_salome.py b/bin/run_salome.py new file mode 100755 index 0000000..8174d47 --- /dev/null +++ b/bin/run_salome.py @@ -0,0 +1,75 @@ +#! /usr/bin/env python3 + +################################################################ +# WARNING: this file is automatically generated by SalomeTools # +# WARNING: and so could be overwritten at any time. # +################################################################ + +import os +import sys +import subprocess + +# Preliminary work to initialize path to SALOME Python modules +def __initialize(): + # define folder to store omniorb config (initially in virtual application folder) + try: + from salomeContextUtils import setOmniOrbUserPath + setOmniOrbUserPath() + except Exception as e: + print(e) + sys.exit(1) +# End of preliminary work + +# salome doc only works for virtual applications. Therefore we overwrite it with this function +def _showDoc(modules): + for module in modules: + modulePath = os.getenv(module+"_ROOT_DIR") + if modulePath != None: + baseDir = os.path.join(modulePath, "share", "doc", "salome") + docfile = os.path.join(baseDir, "gui", module.upper(), "index.html") + if not os.path.isfile(docfile): + docfile = os.path.join(baseDir, "tui", module.upper(), "index.html") + if not os.path.isfile(docfile): + docfile = os.path.join(baseDir, "dev", module.upper(), "index.html") + if os.path.isfile(docfile): + out, err = subprocess.Popen(["xdg-open", docfile]).communicate() + else: + print("Online documentation is not accessible for module:", module) + else: + print(module+"_ROOT_DIR not found!") + +def main(args): + # Identify application path then locate configuration files + __initialize() + + if args == ['--help']: + from salomeContext import usage + usage() + sys.exit(0) + + # Create a SalomeContext + try: + from salomeContext import SalomeContext, SalomeContextException + context = SalomeContext(None) + + # Logger level error + context.getLogger().setLevel(40) + + if len(args) >1 and args[0]=='doc': + _showDoc(args[1:]) + return + + # Start SALOME, parsing command line arguments + out, err, status = context.runSalome(args) + sys.exit(status) + + except SalomeContextException as e: + import logging + logging.getLogger("salome").error(e) + sys.exit(1) + + +if __name__ == "__main__": + args = sys.argv[1:] + main(args) +# diff --git a/bin/salome.py b/bin/salome.py deleted file mode 100755 index 8174d47..0000000 --- a/bin/salome.py +++ /dev/null @@ -1,75 +0,0 @@ -#! /usr/bin/env python3 - -################################################################ -# WARNING: this file is automatically generated by SalomeTools # -# WARNING: and so could be overwritten at any time. # -################################################################ - -import os -import sys -import subprocess - -# Preliminary work to initialize path to SALOME Python modules -def __initialize(): - # define folder to store omniorb config (initially in virtual application folder) - try: - from salomeContextUtils import setOmniOrbUserPath - setOmniOrbUserPath() - except Exception as e: - print(e) - sys.exit(1) -# End of preliminary work - -# salome doc only works for virtual applications. Therefore we overwrite it with this function -def _showDoc(modules): - for module in modules: - modulePath = os.getenv(module+"_ROOT_DIR") - if modulePath != None: - baseDir = os.path.join(modulePath, "share", "doc", "salome") - docfile = os.path.join(baseDir, "gui", module.upper(), "index.html") - if not os.path.isfile(docfile): - docfile = os.path.join(baseDir, "tui", module.upper(), "index.html") - if not os.path.isfile(docfile): - docfile = os.path.join(baseDir, "dev", module.upper(), "index.html") - if os.path.isfile(docfile): - out, err = subprocess.Popen(["xdg-open", docfile]).communicate() - else: - print("Online documentation is not accessible for module:", module) - else: - print(module+"_ROOT_DIR not found!") - -def main(args): - # Identify application path then locate configuration files - __initialize() - - if args == ['--help']: - from salomeContext import usage - usage() - sys.exit(0) - - # Create a SalomeContext - try: - from salomeContext import SalomeContext, SalomeContextException - context = SalomeContext(None) - - # Logger level error - context.getLogger().setLevel(40) - - if len(args) >1 and args[0]=='doc': - _showDoc(args[1:]) - return - - # Start SALOME, parsing command line arguments - out, err, status = context.runSalome(args) - sys.exit(status) - - except SalomeContextException as e: - import logging - logging.getLogger("salome").error(e) - sys.exit(1) - - -if __name__ == "__main__": - args = sys.argv[1:] - main(args) -#