forked from parapluu/encore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
activate
76 lines (66 loc) · 2.17 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
# This file must be used with "source bin/activate" *from bash*
# you cannot run it directly
deactivate () {
# reset old environment variables
if [ -n "$_OLD_VIRTUAL_PATH" ] ; then
PATH="$_OLD_VIRTUAL_PATH"
export PATH
unset _OLD_VIRTUAL_PATH
fi
if [ -n "$_OLD_VIRTUAL_ENCORECHOME" ] ; then
ENCORECHOME="$_OLD_VIRTUAL_ENCORECHOME"
export ENCORECHOME
unset _OLD_VIRTUAL_ENCORECHOME
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 ENCOREC_VIRTUAL_ENV
if [ ! "$1" = "nondestructive" ] ; then
# Self destruct!
unset -f deactivate
fi
}
# unset irrelevant variables
deactivate nondestructive
ENCOREC_VIRTUAL_ENV=$(pwd)
export ENCOREC_VIRTUAL_ENV
_OLD_VIRTUAL_PATH="$PATH"
PATH="$ENCOREC_VIRTUAL_ENV/release:$PATH"
export PATH
# unset ENCORECHOME if set
# this will fail if ENCORECHOME is set to the empty string (which is bad anyway)
# could use `if (set -u; : $ENCORECHOME) ;` in bash
if [ -n "$ENCORECHOME" ] ; then
_OLD_VIRTUAL_ENCORECHOME="$ENCORECHOME"
unset ENCORECHOME
fi
if [ -z "$ENCOREC_VIRTUAL_ENV_DISABLE_PROMPT" ] ; then
_OLD_VIRTUAL_PS1="$PS1"
if [ "x" != x ] ; then
PS1="$PS1"
else
if [ "`basename \"$ENCOREC_VIRTUAL_ENV\"`" = "__" ] ; then
# special case for Aspen magic directories
# see http://www.zetadev.com/software/aspen/
PS1="[`basename \`dirname \"$ENCOREC_VIRTUAL_ENV\"\``] $PS1"
else
PS1="(`basename \"$ENCOREC_VIRTUAL_ENV\"`)$PS1"
fi
fi
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