Back to index

salome-kernel  6.5.0
envSalome.py
Go to the documentation of this file.
00001 #! /usr/bin/env python
00002 #  -*- coding: iso-8859-1 -*-
00003 # Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00004 #
00005 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00006 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00007 #
00008 # This library is free software; you can redistribute it and/or
00009 # modify it under the terms of the GNU Lesser General Public
00010 # License as published by the Free Software Foundation; either
00011 # version 2.1 of the License.
00012 #
00013 # This library is distributed in the hope that it will be useful,
00014 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 # Lesser General Public License for more details.
00017 #
00018 # You should have received a copy of the GNU Lesser General Public
00019 # License along with this library; if not, write to the Free Software
00020 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00021 #
00022 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00023 #
00024 
00025 import os
00026 import sys
00027 import setenv
00028 
00029 kernel_root=os.getenv("KERNEL_ROOT_DIR")
00030 sys.path[:0]=[kernel_root+"/bin/salome"]
00031 
00032 argv = sys.argv[1:]
00033 sys.argv = argv[1:]
00034 
00035 if argv[0] == "-exec":
00036   #keep options only for execution
00037   del argv[0]
00038   sys.argv = []
00039 
00040 setenv.main(True);
00041 
00042 if sys.platform == "win32":
00043     if len(argv) >= 2:
00044         # Fix a problem of spaces in argv[1]
00045         argv[1] = '"%s"'%(argv[1])
00046         pass
00047     pass
00048 
00049 os.execvp(argv[0],argv)