6 # Preliminary work to initialize path to SALOME Python modules
8 currentPath = os.path.dirname(__file__)
9 homePath = os.path.realpath(os.path.expanduser('~'))
10 appliPath = os.path.relpath(currentPath, homePath)
12 pattern = "/bin/salome/appliskel"
13 if appliPath.endswith(pattern):
14 appliPath = appliPath[:-len(pattern)]
16 absoluteAppliPath = os.path.join(homePath, appliPath)
17 os.environ['APPLI'] = appliPath # needed to convert .sh environment files
18 os.environ['ABSOLUTE_APPLI_PATH'] = absoluteAppliPath
20 # define folder to store omniorb config (initially in virtual application folder)
21 #omniorbUserPath = os.path.join(homePath, ".salomeConfig/USERS")
22 omniorbUserPath = os.path.join(homePath, appliPath, "USERS")
23 os.environ['OMNIORB_USER_PATH'] = omniorbUserPath
24 if not os.path.exists(omniorbUserPath):
25 os.makedirs(omniorbUserPath)
27 sys.path[:0] = [absoluteAppliPath+'/bin/salome']
28 # End of preliminary work
31 # Identify application path then locate configuration files
34 if args == ['--help']:
35 from salomeRunner import usage
40 from salomeLauncherUtils import getConfigFileNames
41 configFileNames, args = getConfigFileNames(args)
43 # WHY? Incorrect/Inexisting files are supposed to be ignored by SalomeRunner.
44 # Might simply need bug fix; please provide test case.
46 for aFile in configFileNames:
47 if not os.path.isfile(aFile):
48 print "ERROR: inexisting file: "+aFile
54 # Create a SalomeRunner which parses configFileNames to initialize environment
56 from salomeRunner import SalomeRunner, SalomeRunnerException
57 runner = SalomeRunner(configFileNames)
59 # Here set specific variables, if needed
60 # runner.addToPath('mypath')
61 # runner.addToLdLibraryPath('myldlibrarypath')
62 # runner.addToPythonPath('mypythonpath')
63 # runner.setEnviron('myvarname', 'value')
65 # Start SALOME, parsing command line arguments
67 print 'Thank you for using SALOME!'
69 except SalomeRunnerException, e:
71 logging.getLogger("salome").error(e)
75 if __name__ == "__main__":