-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathactivate
115 lines (98 loc) · 3.14 KB
/
activate
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
# This file must be used with "source ~/cosim2_env/activate" *from bash*
# you cannot run it directly
deactivate_cosim () {
# reset old environment variables
if [ -n "${OLD_VIRTUAL_PATH:-}" ] ; then
PATH="${OLD_VIRTUAL_PATH:-}"
export PATH
unset OLD_VIRTUAL_PATH
fi
if [ -n "${OLD_PYTHONPATH:-}" ] ; then
PYTHONPATH="${OLD_PYTHONPATH:-}"
export PYTHONPATH
unset OLD_PYTHONPATH
fi
if [ -n "${OLD_CXXFLAGS:-}" ] ; then
CXXFLAGS="${OLD_CXXFLAGS:-}"
export CXXFLAGS
unset OLD_CXXFLAGS
fi
if [ -n "${OLD_GLPATH:-}" ] ; then
GLPATH="${OLD_GLPATH:-}"
export GLPATH
unset OLD_GLPATH
fi
if [ -n "${OLD_LD_LIBRARY_PATH:-}" ] ; then
LD_LIBRARY_PATH="${OLD_LD_LIBRARY_PATH:-}"
export LD_LIBRARY_PATH
unset OLD_LD_LIBRARY_PATH
fi
if [ -n "${OLD_PYHELICS_INSTALL:-}" ] ; then
PYHELICS_INSTALL="${OLD_PYHELICS_INSTALL:-}"
export PYHELICS_INSTALL
unset OLD_PYHELICS_INSTALL
fi
if [ -n "${OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
PYTHONHOME="${OLD_VIRTUAL_PYTHONHOME:-}"
export PYTHONHOME
unset OLD_VIRTUAL_PYTHONHOME
fi
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
hash -r 2> /dev/null
fi
if [ -n "${OLD_VIRTUAL_PS1:-}" ] ; then
PS1="${OLD_VIRTUAL_PS1:-}"
export PS1
unset OLD_VIRTUAL_PS1
fi
unset VIRTUAL_ENV
unset GLPATH
if [ ! "${1:-}" = "nondestructive" ] ; then
# Self destruct!
unset -f deactivate_cosim
fi
}
# unset irrelevant variables
deactivate_cosim nondestructive
VIRTUAL_ENV="${HOME}/cosim2_env"
export VIRTUAL_ENV
#OLD_PYTHONPATH="$PYTHONPATH"
#PYTHONPATH="$VIRTUAL_ENV/python"
#export PYTHONPATH
# GridLAB-D required environment variables:
OLD_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=-I${GLD_INSTALL_PATH}/share/gridlabd
export CXXFLAGS
OLD_GLPATH="$GLPATH"
GLPATH=${VIRTUAL_ENV}/lib/gridlabd:${VIRTUAL_ENV}/share/gridlabd
export GLPATH
OLD_LD_LIBRARY_PATH="$LD_LIBRARY_PATH"
LD_LIBRARY_PATH=${VIRTUAL_ENV}/lib:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/bin:$PATH"
export PATH
# unset PYTHONHOME if set
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
# could use `if (set -u; : $PYTHONHOME) ;` in bash
OLD_PYHELICS_INSTALL="$PYHELICS_INSTALL"
PYHELICS_INSTALL=~/cosim2_env
export PYHELICS_INSTALL
if [ -n "${PYTHONHOME:-}" ] ; then
OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
unset PYTHONHOME
fi
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
OLD_VIRTUAL_PS1="${PS1:-}"
PS1="⚡2.8 ${PS1:-}"
export PS1
fi
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
hash -r 2> /dev/null
fi