-
Notifications
You must be signed in to change notification settings - Fork 44
/
nemo_start.py.in
66 lines (55 loc) · 2.46 KB
/
nemo_start.py.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# -*- python -*-
#
# @WARNING@
#
# this file can be copied into your python site-packages, or somewhere where
# then the python command "import nemo_start" will work. This will modify your environment
# such that NEMO commands are accessible to python as if $PATH had been properly
# set in the parent shell (which may be absent), and a few other environment variables
# that the runtime needs.
#
# @todo finish this with all the variable needed
import os
def _check_add(envvar, value, prepend=True):
"""
"""
if envvar in os.environ:
if prepend:
os.environ[envvar] = value+':'+os.environ[envvar]
else:
os.environ[envvar] = os.environ[envvar]+value+':'
else:
os.environ[envvar] = value
if not 'NEMO' in os.environ:
_NEMO = '@NEMO@'
line = open('%s/VERSION' % _NEMO).readlines()[0]
print("Loading NEMO=%s VERSION %s" % (_NEMO,line.strip()))
# _PGPLOT_DIR = '@PGPLOT_DIR@'
_check_add('PATH', '%s/bin' % _NEMO)
_check_add('LD_LIBRARY_PATH', '%s/lib' % _NEMO) # ? opt/lib ?
_check_add('DYLD_LIBRARY_PATH', '%s/lib' % _NEMO) # ? opt/lib ?
os.environ['NEMO'] = '%s' % _NEMO
os.environ['NEMOBIN'] = '%s/bin' % _NEMO # ? opt/bin ?
os.environ['NEMOLIB'] = '%s/lib' % _NEMO
os.environ['NEMOOBJ'] = '%s/obj' % _NEMO
os.environ['BTRPATH'] = '.:%s/obj/bodytrans' % _NEMO
os.environ['POTPATH'] = '.:%s/obj/potential:%s/obj/acc' % (_NEMO,_NEMO)
os.environ['ACCPATH'] = '.:%s/obj/manip:%s/usr/dehnen/falcON/manip' % (_NEMO,_NEMO)
os.environ['YAPP'] = '@YAPP_DEF@'
os.environ['NEMOHOST'] = '@NEMOHOST@'
# export MANIPPATH=.:$NEMO/obj/manip:$NEMO/usr/dehnen/falcON/manip
# export NEMOVER=`cat $NEMO/VERSION`
# export NEMOSYS=`uname -s`
# export NEMOSITE=`hostname`
# export PYTHONPATH=$NEMO/py/modules # ?? do we still need this
#
# falcON @todo check missing items from $FALCON/falcON_start.sh
_FALCON = '@NEMO@' + '/usr/dehnen/falcON'
os.environ['FALCON'] = _FALCON
_check_add('PATH', '%s/bin' % _FALCON)
_check_add('LD_LIBRARY_PATH', '%s/lib' % _FALCON)
_check_add('LD_LIBRARY_PATH', '%s/utils/lib' % _FALCON)
_check_add('DYLD_LIBRARY_PATH', '%s/lib' % _FALCON)
_check_add('DYLD_LIBRARY_PATH', '%s/utils/lib' % _FALCON)
else:
print("NEMO is already loaded")