-
Notifications
You must be signed in to change notification settings - Fork 25
/
deactivate
55 lines (46 loc) · 1.35 KB
/
deactivate
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
#
# This file must be used with "source bin/activate" *from bash*
# you cannot run it directly
#
# Shameless taken from the python virtual-env package
_script_home() {
(
cd "$(dirname "${BASH_SOURCE[0]}")"/..; pwd
)
}
unload_mb () {
if [ -n "$_OLD_VIRTUAL_PATH" ] ; then
PATH="$_OLD_VIRTUAL_PATH"
export PATH
unset _OLD_VIRTUAL_PATH
fi
if [ -n "$_OLD_VIRTUAL_PYTHONPATH" ] ; then
PYTHONPATH="$_OLD_VIRTUAL_PATH"
export PYTHONPATH
unset _OLD_VIRTUAL_PYTHONPATH
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
fi
unset MB_ENV
if [ ! "$1" = "nondestructive" ] ; then
# Self destruct!
unset -f unload_mb
fi
if [ -n "$_OLD_PS1" ] ; then
PS1="$_OLD_PS1"
export PS1
unset _OLD_PS1
fi
}
# unset irrelavent variables
unload_mb nondestructive
# 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
fi