forked from SpiNNakerManchester/SupportScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactivate
More file actions
134 lines (117 loc) · 3.61 KB
/
activate
File metadata and controls
134 lines (117 loc) · 3.61 KB
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
# This file must be used with "source bin/activate" *from bash*
# you cannot run it directly
deactivate () {
unset pydoc
# reset old environment variables
if [ -n "$_OLD_NEURAL_MODELLING_DIRS" ] ; then
NEURAL_MODELLING_DIRS="$_OLD_NEURAL_MODELLING_DIRS"
export NEURAL_MODELLING_DIRS
unset _OLD_NEURAL_MODELLING_DIRS
else
unset NEURAL_MODELLING_DIRS
fi
if [ -n "$_OLD_SPINN_DIRS" ] ; then
SPINN_DIRS="$_OLD_SPINN_DIRS"
export SPINN_DIRS
unset _OLD_SPINN_DIRS
else
unset SPINN_DIRS
fi
if [ -n "$_OLD_PERL5LIB" ] ; then
PERL5LIB="$_OLD_PERL5LIB"
export PERL5LIB
unset _OLD_PERL5LIB
else
unset PERL5LIB
fi
if [ -n "$_OLD_PYTHONUSERBASE" ] ; then
PYTHONUSERBASE="$_OLD_PYTHONUSERBASE"
export PYTHONUSERBASE
unset _OLD_PYTHONUSERBASE
else
unset PYTHONUSERBASE
fi
if [ -n "$_OLD_VIRTUAL_PATH" ] ; then
PATH="$_OLD_VIRTUAL_PATH"
export PATH
unset _OLD_VIRTUAL_PATH
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
if [ ! "$1" = "nondestructive" ] ; then
# Self destruct!
unset -f deactivate
fi
}
# unset irrelevant variables
deactivate nondestructive
VIRTUAL_ENV="$(dirname "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")")"
BASE_NAME="$(basename "$VIRTUAL_ENV")"
export VIRTUAL_ENV
_OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/bin:$VIRTUAL_ENV/spinnaker_tools/tools/:$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
if [ -n "$PYTHONHOME" ] ; then
_OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
unset PYTHONHOME
fi
if [ -z "$VIRTUAL_ENV_DISABLE_PROMPT" ] ; then
_OLD_VIRTUAL_PS1="$PS1"
if [ "x" != x ] ; then
PS1="$PS1"
else
if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
# special case for Aspen magic directories
# see http://www.zetadev.com/software/aspen/
PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
else
PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
fi
fi
export PS1
fi
if [ -n "$PERL5LIB" ] ; then
_OLD_PERL5LIB="$PERL5LIB"
fi
PERL5LIB="$VIRTUAL_ENV/spinnaker_tools/tools/:$PERL5LIB"
export PERL5LIB
if [ -n "$SPINN_DIRS" ] ; then
_OLD_SPINN_DIRS="$SPINN_DIRS"
fi
SPINN_DIRS="$VIRTUAL_ENV/spinnaker_tools"
export SPINN_DIRS
if [ -n "$NEURAL_MODELLING_DIRS" ] ; then
_OLD_NEURAL_MODELLING_DIRS="$NEURAL_MODELLING_DIRS"
fi
NEURAL_MODELLING_DIRS="$VIRTUAL_ENV/sPyNNaker/neural_modelling/"
export NEURAL_MODELLING_DIRS
if [ -n "$PYTHONUSERBASE" ] ; then
_OLD_PYTHONUSERBASE="$PYTHONUSERBASE"
fi
PYTHONUSERBASE="$HOME/.local/$BASE_NAME/"
export PYTHONUSERBASE
alias pydoc="python -m pydoc"
# 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