3 # Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
25 # Preliminary work to initialize path to SALOME Python modules
27 currentPath = os.path.dirname( os.path.abspath( __file__ ) )
28 homePath = os.path.realpath(os.path.expanduser('~'))
29 appliPath = os.path.relpath(currentPath, homePath)
31 pattern = "/bin/salome/appliskel"
32 if appliPath.endswith(pattern):
33 appliPath = appliPath[:-len(pattern)]
35 absoluteAppliPath = os.path.join(homePath, appliPath)
36 os.environ['APPLI'] = appliPath # needed to convert .sh environment files
37 os.environ['ABSOLUTE_APPLI_PATH'] = absoluteAppliPath
39 sys.path[:0] = [absoluteAppliPath+'/bin/salome']
41 # define folder to store omniorb config (initially in virtual application folder)
43 from salomeLauncherUtils import setOmniOrbUserPath
48 # End of preliminary work
51 # Identify application path then locate configuration files
54 if args == ['--help']:
55 from salomeRunner import usage
59 from salomeLauncherUtils import getConfigFileNames
60 configFileNames, args, unexisting = getConfigFileNames(args, checkExistence=True)
61 if len(unexisting) > 0:
62 print "ERROR: unexisting configuration file(s): " + ', '.join(unexisting)
65 # Create a SalomeRunner which parses configFileNames to initialize environment
67 from salomeRunner import SalomeRunner, SalomeRunnerException
68 runner = SalomeRunner(configFileNames)
70 # Here set specific variables, if needed
71 # runner.addToPath('mypath')
72 # runner.addToLdLibraryPath('myldlibrarypath')
73 # runner.addToPythonPath('mypythonpath')
74 # runner.setEnviron('myvarname', 'value')
76 # Start SALOME, parsing command line arguments
78 print 'Thank you for using SALOME!'
80 except SalomeRunnerException, e:
82 logging.getLogger("salome").error(e)
86 if __name__ == "__main__":