Salome HOME
b8b43e800f505ecc2a3c53c390a0c23ad420533e
[modules/kernel.git] / bin / appliskel / salome
1 #! /usr/bin/env python
2
3 import os
4 import subprocess
5 import sys
6
7 MODULES = []
8
9
10 def main(args):
11     ''' Load modules then launch salome
12     '''
13     if MODULES:
14         env_modules = MODULES[:]
15         env_modules_option = "--with-env-modules="
16         env_modules_l = [x for x in args if x.startswith(env_modules_option)]
17         if env_modules_l:
18           env_modules += env_modules_l[-1][len(env_modules_option):].split(',')
19           args = [x for x in args if not x.startswith(env_modules_option)]
20         env_modules_option += "%s" % ','.join(env_modules)
21         args.append(env_modules_option)
22
23     currentPath = os.path.realpath(os.path.dirname(os.path.abspath(__file__)))
24     proc = subprocess.Popen(['./.salome_run'] + args,
25                             close_fds=True, cwd=currentPath)
26     out, err = proc.communicate()
27     return out, err, proc.returncode
28
29 if __name__ == "__main__":
30     main(sys.argv[1:])
31 #
32