-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.setenv.dot
153 lines (131 loc) · 4.84 KB
/
.setenv.dot
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/bash
## Check that the user is sourcing this script
_script_name=".setenv.dot"
if [[ "${0##*/}" == ${_script_name} ]] ; then
cat 1>&2 <<EOF
ERROR: This script should be sourced with:
source ${0}
EOF
return 1
fi
unset _script_name
if [[ ${BASH_SOURCE#/} == ${BASH_SOURCE} ]] ; then
__scriptpath=$(pwd)/${BASH_SOURCE%/*}
else
__scriptpath=${BASH_SOURCE%/*}
fi
__scriptpath=${__scriptpath%/.}
__DESC='Load package dependencies'
__USAGE="USAGE: ${MYSELF} [-v] [-f] [--cmc|--science]"
__usage_long() {
__toto=$(echo -e ${__USAGE})
more <<EOF
${__DESC}
${__toto}
Options:
-h, --help : print this help
-v, --verbose : verbose mode
-e, --external : only load external dependencies
--dev : fully load exernal deps for development
--cmc : set dependencies for CMC network
--science : set dependencies for Sience network
EOF
unset __toto
}
if [[ -d /ssm/net ]] ; then
export RDENETWORK=${RDENETWORK:-'cmc'}
elif [[ -d /fs/ssm ]] ; then
export RDENETWORK=${RDENETWORK:-'science'}
fi
__verbose=0
__external=0
_rpnpy_dev_mode_=""
while [[ $# -gt 0 ]] ; do
case $1 in
(-h|--help) __usage_long; exit 0;;
(-v|--verbose) ((__verbose=__verbose+1));;
(--dev) _rpnpy_dev_mode_="$1" ;;
(-e|--external) __external=1; _rpnpy_dev_mode_="1";;
(--cmc) export RDENETWORK=cmc ;;
(--science) export RDENETWORK=science ;;
(savehist*) ;;
# (*) if [[ x$1 != x ]] ; then myerror "Option Not recognized: $1";fi;;
# (*) COMP_ARCH=${1:-${COMP_ARCH_DEFAULT}} ;;
(*) echo "WARNING: ignoring '$1'"
esac
shift
done
#=== Simulate installed bndl loading of external dep
if [[ x${_rpnpy_dev_mode_} != x ]] ; then
for __bndlname in DEPENDENCIES.external.bndl DEPENDENCIES.external.${RDENETWORK}.bndl ; do
if [[ -f ${__bndlname} ]] ; then
echo "+ . \${${__scriptpath##*/}}/${__bndlname}"
. r.load.dot $(cat ${__bndlname})
fi
done
fi
if [[ ${__external} == 0 ]] ; then
__bndlname=DEPENDENCIES.mig.bndl
if [[ -f ${__bndlname} ]] ; then
echo "+ . \${${__scriptpath##*/}}/${__bndlname}"
. r.load.dot $(cat ${__bndlname})
fi
fi
if [[ x${ATM_MODEL_DFILES} == x ]] ; then
for __item in /fs/ssm/eccc/mrd/rpn/MIG/GEM/d/gem-data/gem-data_4.2.0/gem-data_4.2.0_all/share/data/dfiles /home/ordenv/ssm-domains9/release/gem-data_4.2.0/gem-data_4.2.0_all/share/data/dfiles ; do
if [[ -d ${__item} ]] ; then
export ATM_MODEL_DFILES=${ATM_MODEL_DFILES:-${__item}}
fi
done
fi
# if [[ x${AFSISIO_ENV_HOME} == x ]] ; then
# #TODO: default AFSISIO on science?
# for __item in /ssm/net/cmoi/base/master/afsisio-env_1.3b6_all/lib/afsisio-env ; do
# if [[ -d ${__item} ]] ; then
# export AFSISIO_ENV_HOME=${AFSISIO_ENV_HOME:-${__item}}
# fi
# done
# fi
#=== Simulate installed bndl post loading
if [[ -f ${__scriptpath}/VERSION ]] ; then
rpnpy_version0="$(cat ${__scriptpath}/VERSION)"
fi
for __item in /home/ordenv/ssm-domains9/log /home/sgem000/log ; do
if [[ -d ${__item} ]] ; then
export RPNPY_LOGDIR=${RPNPY_LOGDIR:-${__item}}
fi
done
. $(pwd)/bin/.env_setup.dot rpnpy ${rpnpy_version:-${rpnpy_version0#*/}} all ${__scriptpath} ${__scriptpath}
# export rpnpy=${__scriptpath}
#=== Simulate installed bndl post loading of .setenv.__extlib__.${ORDENV_PLAT}.dot
if [[ x${_rpnpy_dev_mode_} != x ]] ; then
__item=${TMPDIR}/.rpy.mk.setenv.__extlib__.$$
${__scriptpath}/bin/.rpy.mk.setenv.__extlib__ ${__item}
echo "+ source ${__item} ## \${${__scriptpath##*/}}"
. ${__item}
cat ${__item}
rm -f ${__item}
else
for __item in RPNPY_RMN_LIBPATH RPNPY_RMN_VERSION RPNPY_VGD_LIBPATH RPNPY_VGD_VERSION RPNPY_BURPC_LIBPATH RPNPY_BURPC_VERSION AFSISIO CMCGRIDF ATM_MODEL_DFILES; do
if [[ x${!__item} == x ]] ; then
echo "===> WARNING: ${__item} Not defined <===" 1>&2
fi
done
fi
export SSMVERSION=$(ssm version | cut -d. -f1)
#=== Add Local paths
if [[ x"$_rpnpy_dev_mode_" == x"--dev" ]] ; then
_rpnpy_rde_libdir_=$(rdevar build/lib)
_rpnpy_rde_libdir0_=build-${ORDENV_PLAT}/lib/${COMP_ARCH}
fi
export PATH=${__scriptpath}/bin:$PATH
export PYTHONPATH=${__scriptpath}/lib:$PYTHONPATH
export PYVERSION="$(python -V 2>&1 | cut -d' ' -f2 | cut -d'.' -f1-2)"
export PYTHONPATH=${__scriptpath}/lib:${_scriptpath}/build/lib.$(uname -s | tr 'A-Z' 'a-z')-$(uname -m)-${PYVERSION}:${PYTHONPATH}
export LD_LIBRARY_PATH=${_scriptpath}/build/lib.$(uname -s | tr 'A-Z' 'a-z')-$(uname -m)-${PYVERSION}:${_scriptpath}/${_rpnpy_rde_libdir_:-${_rpnpy_rde_libdir0_}}:$LD_LIBRARY_PATH
#====
## export RPNPY_RMN_VERSION=${RPNPY_RMN_VERSION:-_rpnpy}
## export RPNPY_RMN_LIBPATH=
## export RPNPY_VGD_VERSION=${RPNPY_VGD_VERSION:-_rpnpy}
## export RPNPY_VGD_LIBPATH=
unset __DESC __USAGE __usage_long __verbose __external __item __bndlname __scriptpath _rpnpy_dev_mode_