]> SALOME platform Git repositories - modules/kernel.git/blob - bin/appliskel/salome
Salome HOME
Debug of CMake build procedure
[modules/kernel.git] / bin / appliskel / salome
1 #! /usr/bin/env python
2
3 # Copyright (C) 2013-2014  CEA/DEN, EDF R&D, OPEN CASCADE
4 #
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.
9 #
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.
14 #
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
18 #
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #
21
22 import os
23 import sys
24
25 # Preliminary work to initialize path to SALOME Python modules
26 def __initialize():
27   currentPath = os.path.dirname( os.path.abspath( __file__ ) )
28   homePath = os.path.realpath(os.path.expanduser('~'))
29   appliPath = os.path.relpath(currentPath, homePath)
30
31   pattern = "/bin/salome/appliskel"
32   if appliPath.endswith(pattern):
33     appliPath = appliPath[:-len(pattern)]
34
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
38
39   sys.path[:0] = [absoluteAppliPath+'/bin/salome']
40
41   # define folder to store omniorb config (initially in virtual application folder)
42   try:
43     from salomeLauncherUtils import setOmniOrbUserPath
44     setOmniOrbUserPath()
45   except Exception, e:
46     print e
47     sys.exit(1)
48 # End of preliminary work
49
50 def main(args):
51   # Identify application path then locate configuration files
52   __initialize()
53
54   if args == ['--help']:
55     from salomeRunner import usage
56     usage()
57     sys.exit(0)
58
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)
63     sys.exit(1)
64
65   # Create a SalomeRunner which parses configFileNames to initialize environment
66   try:
67     from salomeRunner import SalomeRunner, SalomeRunnerException
68     runner = SalomeRunner(configFileNames)
69
70     # Here set specific variables, if needed
71     # runner.addToPath('mypath')
72     # runner.addToLdLibraryPath('myldlibrarypath')
73     # runner.addToPythonPath('mypythonpath')
74     # runner.setEnviron('myvarname', 'value')
75
76     # Start SALOME, parsing command line arguments
77     runner.go(args)
78     print 'Thank you for using SALOME!'
79
80   except SalomeRunnerException, e:
81     import logging
82     logging.getLogger("salome").error(e)
83     sys.exit(1)
84 #
85
86 if __name__ == "__main__":
87   args = sys.argv[1:]
88   main(args)
89 #