args = {}
#def get_env():
#args = []
-def get_env(appname=salomeappname, cfgname=salomecfgname, exeName=None, keepEnvironment=True):
+def get_env(appname=salomeappname, cfgname=salomecfgname, exeName=None):
###
# Collect launch configuration files:
# - The environment variable "<appname>Config" (SalomeAppConfig) which can
else:
dirs += re.split('[;|:]', os.getenv(config_var))
- if not keepEnvironment:
- if os.getenv("GUI_ROOT_DIR") and os.path.isdir(os.getenv("GUI_ROOT_DIR")):
- gui_resources_dir = os.path.join(os.getenv("GUI_ROOT_DIR"),'share','salome','resources','gui')
- if os.path.isdir(gui_resources_dir):
- dirs.append(gui_resources_dir)
- pass
- else:
- kernel_resources_dir = os.path.join(os.getenv("KERNEL_ROOT_DIR"),'bin','salome','appliskel')
- if os.getenv("KERNEL_ROOT_DIR") and os.path.isdir( kernel_resources_dir ):
- dirs.append(kernel_resources_dir)
- pass
- os.environ[config_var] = os.pathsep.join(dirs)
+ gui_available = False
+ if os.getenv("GUI_ROOT_DIR"):
+ gui_resources_dir = os.path.join(os.getenv("GUI_ROOT_DIR"),'share','salome','resources','gui')
+ if os.path.isdir(gui_resources_dir):
+ gui_available = True
+ dirs.append(gui_resources_dir)
+ pass
+ if not gui_available:
+ kernel_resources_dir = os.path.join(os.getenv("KERNEL_ROOT_DIR"),'bin','salome','appliskel')
+ if os.getenv("KERNEL_ROOT_DIR") and os.path.isdir( kernel_resources_dir ):
+ dirs.append(kernel_resources_dir)
+ pass
+ os.environ[config_var] = os.pathsep.join(dirs)
dirs.reverse() # reverse order, like in "path" variable - FILO-style processing
if cmd_opts.batch is not None:
args[batch_nam] = True
- if not os.getenv("GUI_ROOT_DIR") or not os.path.isdir(os.getenv("GUI_ROOT_DIR")):
+ if not gui_available:
args[gui_nam] = False
if args[gui_nam]:
args[lang_nam] = cmd_opts.language
# return arguments
- if not keepEnvironment:
- os.environ[config_var] = os.pathsep.join(dirs)
-
+ os.environ[config_var] = os.pathsep.join(dirs)
# print("Args: ", args)
return args
# -----------------------------------------------------------------------------
-def get_config(silent=False, exeName=None, keepEnvironment=True):
+def get_config(silent=False, exeName=None):
"""
Get list of modules, paths.
import launchConfigureParser
- args = launchConfigureParser.get_env(exeName=exeName, keepEnvironment=keepEnvironment)
+ args = launchConfigureParser.get_env(exeName=exeName)
# Check variables <module>_ROOT_DIR
# -----------------------------------------------------------------------------
-def set_env(args, modules_list, modules_root_dir, silent=False, keepEnvironment=True):
+def set_env(args, modules_list, modules_root_dir, silent=False):
"""Add to the PATH-variables modules specific paths"""
import os
os.putenv('SALOME_BATCH','0')
if args["gui"] :
modules_list = modules_list[:] + ["GUI"]
- if not keepEnvironment:
- modules_list = modules_list[:] + ["KERNEL"]
- for module in modules_list :
- if module in modules_root_dir:
- module_root_dir = modules_root_dir[module]
- if module_root_dir not in modules_root_dir_list:
- modules_root_dir_list[:0] = [module_root_dir]
- if sys.platform == "win32":
- add_path(os.path.join(module_root_dir,get_lib_dir(),salome_subdir),
- "PATH")
- elif sys.platform == "darwin":
- add_path(os.path.join(module_root_dir,get_lib_dir(),salome_subdir),
- "DYLD_LIBRARY_PATH")
- else:
- add_path(os.path.join(module_root_dir,get_lib_dir(),salome_subdir),
- "LD_LIBRARY_PATH")
- add_path(os.path.join(module_root_dir,"bin",salome_subdir),
- "PATH")
- if os.path.exists(os.path.join(module_root_dir, "examples")):
- add_path(os.path.join(module_root_dir,"examples"),
- "PYTHONPATH")
- pass
- add_path(os.path.join(module_root_dir,"bin",salome_subdir),
- "PYTHONPATH")
- # add lib before site-packages to load script instead of dll if any (win32 platform)
- add_path(os.path.join(module_root_dir,get_lib_dir(),salome_subdir),
+ modules_list = modules_list[:] + ["KERNEL"]
+ for module in modules_list :
+ if module in modules_root_dir:
+ module_root_dir = modules_root_dir[module]
+ if module_root_dir not in modules_root_dir_list:
+ modules_root_dir_list[:0] = [module_root_dir]
+ if sys.platform == "win32":
+ add_path(os.path.join(module_root_dir,get_lib_dir(),salome_subdir),
+ "PATH")
+ elif sys.platform == "darwin":
+ add_path(os.path.join(module_root_dir,get_lib_dir(),salome_subdir),
+ "DYLD_LIBRARY_PATH")
+ else:
+ add_path(os.path.join(module_root_dir,get_lib_dir(),salome_subdir),
+ "LD_LIBRARY_PATH")
+ add_path(os.path.join(module_root_dir,"bin",salome_subdir),
+ "PATH")
+ if os.path.exists(os.path.join(module_root_dir, "examples")):
+ add_path(os.path.join(module_root_dir,"examples"),
"PYTHONPATH")
- add_path(os.path.join(module_root_dir,get_lib_dir(),
+ pass
+ add_path(os.path.join(module_root_dir,"bin",salome_subdir),
+ "PYTHONPATH")
+ # add lib before site-packages to load script instead of dll if any (win32 platform)
+ add_path(os.path.join(module_root_dir,get_lib_dir(),salome_subdir),
+ "PYTHONPATH")
+ add_path(os.path.join(module_root_dir,get_lib_dir(),
+ python_version,"site-packages",
+ salome_subdir),
+ "PYTHONPATH")
+ import platform
+ if platform.machine() == "x86_64":
+ add_path(os.path.join(module_root_dir,"lib64",
python_version,"site-packages",
salome_subdir),
"PYTHONPATH")
- import platform
- if platform.machine() == "x86_64":
- add_path(os.path.join(module_root_dir,"lib64",
- python_version,"site-packages",
- salome_subdir),
- "PYTHONPATH")
+ pass
+ add_path(os.path.join(module_root_dir,get_lib_dir(),
+ python_version,"site-packages",
+ salome_subdir,
+ "shared_modules"),
+ "PYTHONPATH")
+
+ # set environment by modules from the list
+ if port:
+ try:
+ mod=__import__(module.lower()+"_setenv")
+ mod.set_env(args)
pass
- add_path(os.path.join(module_root_dir,get_lib_dir(),
- python_version,"site-packages",
- salome_subdir,
- "shared_modules"),
- "PYTHONPATH")
-
- # set environment by modules from the list
- if port:
- try:
- mod=__import__(module.lower()+"_setenv")
- mod.set_env(args)
- pass
- except:
- pass
+ except:
pass
pass
pass
+ pass
- if sys.platform == 'win32':
- os.environ["SALOMEPATH"]=";".join(modules_root_dir_list)
- else:
- os.environ["SALOMEPATH"]=":".join(modules_root_dir_list)
+ if sys.platform == 'win32':
+ os.environ["SALOMEPATH"]=";".join(modules_root_dir_list)
+ else:
+ os.environ["SALOMEPATH"]=":".join(modules_root_dir_list)
- pass
# set trace environment variable
if "SALOME_trace" not in os.environ: