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
33 from salomeLauncherUtils import getConfigFileNames
34 configFileNames, args = getConfigFileNames(args)
36 # WHY? Incorrect/Inexisting files are supposed to be ignored by SalomeRunner.
37 # Might simply need bug fix; please provide test case.
39 for aFile in configFileNames:
40 if not os.path.isfile(aFile):
41 print "ERROR: inexisting file: "+aFile
47 # Create a SalomeRunner which parses configFileNames to initialize environment
49 from salomeRunner import SalomeRunner, SalomeRunnerException
50 runner = SalomeRunner(configFileNames)
52 # Here set specific variables, if needed
53 # runner.addToPath('mypath')
54 # runner.addToLdLibraryPath('myldlibrarypath')
55 # runner.addToPythonPath('mypythonpath')
56 # runner.setEnviron('myvarname', 'value')
58 kernel_root_dir = os.getenv("KERNEL_ROOT_DIR")
60 runner.addToLdLibraryPath(os.path.join(kernel_root_dir, "lib/salome"))
62 gui_root_dir = os.getenv("GUI_ROOT_DIR")
64 runner.addToLdLibraryPath(os.path.join(gui_root_dir, "lib/salome"))
66 paravis_root_dir = os.getenv("PARAVIS_ROOT_DIR")
68 runner.addToLdLibraryPath(os.path.join(paravis_root_dir, "lib/salome"))
71 # Start SALOME, parsing command line arguments
73 print 'Thank you for using SALOME!'
75 except SalomeRunnerException, e:
77 logging.getLogger("salome").error(e)
81 if __name__ == "__main__":