1 # This file must be used with "source bin/activate" *from bash*
2 # you cannot run it directly
7 # reset old environment variables
8 if [ -n "$_OLD_VIRTUAL_PATH" ] ; then
9 PATH
="$_OLD_VIRTUAL_PATH"
11 unset _OLD_VIRTUAL_PATH
13 if [ -n "$_OLD_VIRTUAL_PYTHONHOME" ] ; then
14 PYTHONHOME
="$_OLD_VIRTUAL_PYTHONHOME"
16 unset _OLD_VIRTUAL_PYTHONHOME
19 # This should detect bash and zsh, which have a hash command that must
20 # be called to get it to forget past commands. Without forgetting
21 # past commands the $PATH changes we made may not be respected
22 if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
26 if [ -n "$_OLD_VIRTUAL_PS1" ] ; then
27 PS1
="$_OLD_VIRTUAL_PS1"
29 unset _OLD_VIRTUAL_PS1
33 if [ ! "$1" = "nondestructive" ] ; then
39 # unset irrelevant variables
40 deactivate nondestructive
42 VIRTUAL_ENV
="__VIRTUAL_ENV__"
45 _OLD_VIRTUAL_PATH
="$PATH"
46 PATH
="$VIRTUAL_ENV/__BIN_NAME__:$PATH"
49 # unset PYTHONHOME if set
50 # this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
51 # could use `if (set -u; : $PYTHONHOME) ;` in bash
52 if [ -n "$PYTHONHOME" ] ; then
53 _OLD_VIRTUAL_PYTHONHOME
="$PYTHONHOME"
57 if [ -z "$VIRTUAL_ENV_DISABLE_PROMPT" ] ; then
58 _OLD_VIRTUAL_PS1
="$PS1"
59 if [ "x__VIRTUAL_PROMPT__" != x
] ; then
60 PS1
="__VIRTUAL_PROMPT__$PS1"
62 if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
63 # special case for Aspen magic directories
64 # see http://www.zetadev.com/software/aspen/
65 PS1
="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
67 PS1
="(`basename \"$VIRTUAL_ENV\"`)$PS1"
73 alias pydoc
="python -m pydoc"
75 # This should detect bash and zsh, which have a hash command that must
76 # be called to get it to forget past commands. Without forgetting
77 # past commands the $PATH changes we made may not be respected
78 if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then