Version: 6.3.1

bin/smesh_setenv.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #  -*- coding: iso-8859-1 -*-
00003 # Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00004 #
00005 # This library is free software; you can redistribute it and/or
00006 # modify it under the terms of the GNU Lesser General Public
00007 # License as published by the Free Software Foundation; either
00008 # version 2.1 of the License.
00009 #
00010 # This library is distributed in the hope that it will be useful,
00011 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 # Lesser General Public License for more details.
00014 #
00015 # You should have received a copy of the GNU Lesser General Public
00016 # License along with this library; if not, write to the Free Software
00017 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00018 #
00019 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00020 #
00021 
00022 import os, sys
00023 from setenv import add_path, get_lib_dir, salome_subdir
00024 
00025 # -----------------------------------------------------------------------------
00026 
00027 def set_env(args):
00028     """Add to the PATH-variables modules specific paths"""
00029 
00030     python_version="python%d.%d" % sys.version_info[0:2]
00031 
00032     os.environ["SMESH_MeshersList"]="StdMeshers"
00033     if not os.environ.has_key("SALOME_StdMeshersResources"):
00034         os.environ["SALOME_StdMeshersResources"] \
00035         = os.environ["SMESH_ROOT_DIR"]+"/share/"+salome_subdir+"/resources/smesh"
00036         pass
00037     if args.has_key("SMESH_plugins"):
00038         for plugin in args["SMESH_plugins"]:
00039             plugin_root = ""
00040             if os.environ.has_key(plugin+"_ROOT_DIR"):
00041                 plugin_root = os.environ[plugin+"_ROOT_DIR"]
00042             else:
00043                 # workaround to avoid modifications of existing environment
00044                 if os.environ.has_key(plugin.upper()+"_ROOT_DIR"):
00045                     plugin_root = os.environ[plugin.upper()+"_ROOT_DIR"]
00046                     pass
00047                 pass
00048             if plugin_root != "":
00049                 os.environ["SMESH_MeshersList"] \
00050                 = os.environ["SMESH_MeshersList"]+":"+plugin
00051                 if not os.environ.has_key("SALOME_"+plugin+"Resources"):
00052                     os.environ["SALOME_"+plugin+"Resources"] \
00053                     = plugin_root+"/share/"+salome_subdir+"/resources/"+plugin.lower()
00054                     add_path(os.path.join(plugin_root,get_lib_dir(),python_version, "site-packages",salome_subdir), "PYTHONPATH")
00055                     add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "PYTHONPATH")
00056                     
00057                     if sys.platform == "win32":
00058                         add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "PATH")
00059                         add_path(os.path.join(plugin_root,"bin",salome_subdir), "PYTHONPATH")
00060                     else:
00061                         add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "LD_LIBRARY_PATH")
00062                         add_path(os.path.join(plugin_root,"bin",salome_subdir), "PYTHONPATH")
00063                         add_path(os.path.join(plugin_root,"bin",salome_subdir), "PATH")
00064                         pass
00065                     pass
00066                 pass
00067             pass
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS