-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetenv.sh
66 lines (53 loc) · 2.12 KB
/
setenv.sh
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
#
# Default environment setting for development build
#
# usage:
# cd atos-build
# . ./setenv.sh
#
deactivate() {
# Restore old values
PATH="$_OLD_ATOS_PATH" && export PATH
unset _OLD_ATOS_PATH
unset LD_LIBRARY_PATH && [ "${_OLD_LD_LIBRARY_PATH+set}" = set ] && LD_LIBRARY_PATH="$_OLD_LD_LIBRARY_PATH" && export LD_LIBRARY_PATH
unset _OLD_LD_LIBRARY_PATH
unset PYTHONPATH && [ "${_OLD_ATOS_PYTHONPATH+set}" = set ] && PYTHONPATH="$_OLD_ATOS_PYTHONPATH" && export PYTHONPATH
unset _OLD_ATOS_PYTHONPATH
unset PYTHONSTARTUP && [ "${_OLD_ATOS_PYTHONSTARTUP+set}" = set ] && PYTHONSTARTUP="$_OLD_ATOS_PYTHONSTARTUP" && export PYTHONSTARTUP
unset _OLD_ATOS_PYTHONSTARTUP
unset PS1 && [ "${_OLD_ATOS_PS1+set}" = set ] && PS1="$_OLD_ATOS_PS1" && export PS1
unset _OLD_ATOS_PS1
# Make bash and zsh forget about previous commands
# Overwise the last PATH change will not be taken into account
if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
hash -r
fi
unset ATOS_BUILD_SETENV
# Self destroy
unset -f deactivate
}
if [ -n "$ATOS_BUILD_SETENV" ]; then
echo "error: already in ATOS environment. Execute 'deactivate' to get out." >&2
else
echo
echo "Setting up ATOS environment. Execute 'deactivate' to get out."
echo
ATOS_BUILD_SETENV=1
# Save old values
_OLD_ATOS_PATH="$PATH"
unset _OLD_LD_LIBRARY_PATH && [ "${LD_LIBRARY_PATH+set}" = set ] && _OLD_ATOS_PYTHONPATH="$LD_LIBRARY_PATH"
unset _OLD_ATOS_PYTHONPATH && [ "${PYTHONPATH+set}" = set ] && _OLD_ATOS_PYTHONPATH="$PYTHONPATH"
unset _OLD_ATOS_PYTHONSTARTUP && [ "${PYTHONSTARTUP+set}" = set ] && _OLD_ATOS_PYTHONSTARTUP="$PYTHONSTARTUP"
unset _OLD_ATOS_PS1 && [ "${PS1+set}" = set ] && _OLD_ATOS_PS1="$PS1"
# Export the new ones
PATH=$PWD/devimage/bin:$PATH && export PATH
LD_LIBRARY_PATH=$PWD/devimage/lib:$LD_LIBRARY_PATH && export LD_LIBRARY_PATH
PYTHONPATH=$PWD/devimage/lib/python:$PYTHONPATH && export PYTHONPATH
unset PYTHONSTARTUP
PS1="(atos-build) $PS1" && export PS1
# Makes bash and zsh to forget about previous command and take PATH change into
# account
if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
hash -r
fi
fi