]> SALOME platform Git repositories - modules/kernel.git/blobdiff - bin/appliskel/salome_common.py
Salome HOME
Merge branch 'V9_11_BR'
[modules/kernel.git] / bin / appliskel / salome_common.py
index 9b9b25b77d54724801da923841e9012243f6b0d3..51cecf85f6c247feaa3bdd60b170c1d6ff5e52be 100644 (file)
@@ -1,4 +1,4 @@
-    #! /usr/bin/env python3
+#! /usr/bin/env python3
 # Copyright (C) 2021-2023  CEA, EDF
 #
 # This library is free software; you can redistribute it and/or
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
+import json
 import os
 import subprocess
 import sys
 
-MODULES = []
-
 
 def main(args):
     ''' Load modules then launch salome
     '''
-    if MODULES:
-        env_modules = MODULES[:]
+    appliPath = os.path.realpath(os.path.dirname(os.path.abspath(__file__)))
+    MODULES_FILE = os.path.join(appliPath, "env_modules.json")
+    if os.path.isfile(MODULES_FILE):
+        env_modules = json.loads(open(MODULES_FILE).read()).get('env_modules')
         env_modules_option = "--with-env-modules="
         env_modules_l = [x for x in args if x.startswith(env_modules_option)]
         if env_modules_l:
@@ -38,8 +39,7 @@ def main(args):
         env_modules_option += "%s" % ','.join(env_modules)
         args.append(env_modules_option)
 
-    appliPath = os.path.dirname(os.path.realpath(__file__))
-    os.environ["ROOT_SALOME_INSTALL"]=appliPath
+    os.environ["ROOT_SALOME_INSTALL"] = appliPath
     proc = subprocess.Popen([os.path.join(appliPath, '.salome_run')] + args, close_fds=True)
     out, err = proc.communicate()
     sys.exit(proc.returncode)