X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=bin%2Fsetenv.py;h=15482951385c34bc2ecc5dcffb87bcce87594da7;hb=7e6982e9ccf83f3ede551d990d5a80807dcf1a87;hp=44ac6dbe7e83fba3630e7db15f6dc34cb579cb27;hpb=bbac39ee34bd6a5e6fd051024209399b97b818b1;p=modules%2Fkernel.git diff --git a/bin/setenv.py b/bin/setenv.py index 44ac6dbe7..154829513 100755 --- a/bin/setenv.py +++ b/bin/setenv.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -8,7 +8,7 @@ # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either -# version 2.1 of the License. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -64,7 +64,7 @@ def add_path(directory, variable_name): newpath = string.join(newpath, splitsym) os.environ[variable_name] = newpath if variable_name == "PYTHONPATH": - sys.path[:0] = [directory] + sys.path[:0] = [os.path.realpath(directory)] # ----------------------------------------------------------------------------- @@ -81,12 +81,12 @@ def get_lib_dir(): def get_config(silent=False): """ Get list of modules, paths. - + Read args from launch configure xml file and command line options. Check variables _ROOT_DIR and set list of used modules. - Return args, modules_list, modules_root_dir + Return args, modules_list, modules_root_dir """ - + # read args from launch configure xml file and command line options #*** Test additional option @@ -150,14 +150,14 @@ def get_config(silent=False): def set_env(args, modules_list, modules_root_dir, silent=False): """Add to the PATH-variables modules specific paths""" - + import os - from salome_utils import getTmpDir, generateFileName, makeTmpDir, getPortNumber + from salome_utils import getLogDir, generateFileName, makeTmpDir, getPortNumber # create temporary directory for environment files needed by modules from the list port = getPortNumber(False) if port: - tmp_dir = getTmpDir() + tmp_dir = getLogDir() env_dir = generateFileName(tmp_dir, prefix="env", with_port=True) makeTmpDir(env_dir) pass @@ -167,12 +167,13 @@ def set_env(args, modules_list, modules_root_dir, silent=False): if os.getenv('SALOME_BATCH') == None: os.putenv('SALOME_BATCH','0') if args["gui"] : - modules_list = modules_list[:] + ["GUI"] - modules_list = modules_list[:] + ["KERNEL"] + modules_list = modules_list[:] + ["GUI"] + modules_list = modules_list[:] + ["KERNEL"] for module in modules_list : if modules_root_dir.has_key(module): module_root_dir = modules_root_dir[module] - modules_root_dir_list[:0] = [module_root_dir] + 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") @@ -223,9 +224,9 @@ def set_env(args, modules_list, modules_root_dir, silent=False): os.environ["SALOMEPATH"]=";".join(modules_root_dir_list) else: os.environ["SALOMEPATH"]=":".join(modules_root_dir_list) - + # set trace environment variable - + if not os.environ.has_key("SALOME_trace"): os.environ["SALOME_trace"]="local" if args['file']: