python/virtualenv/virtualenv_embedded/activate.sh

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 # This file must be used with "source bin/activate" *from bash*
michael@0 2 # you cannot run it directly
michael@0 3
michael@0 4 deactivate () {
michael@0 5 unset pydoc
michael@0 6
michael@0 7 # reset old environment variables
michael@0 8 if [ -n "$_OLD_VIRTUAL_PATH" ] ; then
michael@0 9 PATH="$_OLD_VIRTUAL_PATH"
michael@0 10 export PATH
michael@0 11 unset _OLD_VIRTUAL_PATH
michael@0 12 fi
michael@0 13 if [ -n "$_OLD_VIRTUAL_PYTHONHOME" ] ; then
michael@0 14 PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME"
michael@0 15 export PYTHONHOME
michael@0 16 unset _OLD_VIRTUAL_PYTHONHOME
michael@0 17 fi
michael@0 18
michael@0 19 # This should detect bash and zsh, which have a hash command that must
michael@0 20 # be called to get it to forget past commands. Without forgetting
michael@0 21 # past commands the $PATH changes we made may not be respected
michael@0 22 if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
michael@0 23 hash -r 2>/dev/null
michael@0 24 fi
michael@0 25
michael@0 26 if [ -n "$_OLD_VIRTUAL_PS1" ] ; then
michael@0 27 PS1="$_OLD_VIRTUAL_PS1"
michael@0 28 export PS1
michael@0 29 unset _OLD_VIRTUAL_PS1
michael@0 30 fi
michael@0 31
michael@0 32 unset VIRTUAL_ENV
michael@0 33 if [ ! "$1" = "nondestructive" ] ; then
michael@0 34 # Self destruct!
michael@0 35 unset -f deactivate
michael@0 36 fi
michael@0 37 }
michael@0 38
michael@0 39 # unset irrelevant variables
michael@0 40 deactivate nondestructive
michael@0 41
michael@0 42 VIRTUAL_ENV="__VIRTUAL_ENV__"
michael@0 43 export VIRTUAL_ENV
michael@0 44
michael@0 45 _OLD_VIRTUAL_PATH="$PATH"
michael@0 46 PATH="$VIRTUAL_ENV/__BIN_NAME__:$PATH"
michael@0 47 export PATH
michael@0 48
michael@0 49 # unset PYTHONHOME if set
michael@0 50 # this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
michael@0 51 # could use `if (set -u; : $PYTHONHOME) ;` in bash
michael@0 52 if [ -n "$PYTHONHOME" ] ; then
michael@0 53 _OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
michael@0 54 unset PYTHONHOME
michael@0 55 fi
michael@0 56
michael@0 57 if [ -z "$VIRTUAL_ENV_DISABLE_PROMPT" ] ; then
michael@0 58 _OLD_VIRTUAL_PS1="$PS1"
michael@0 59 if [ "x__VIRTUAL_PROMPT__" != x ] ; then
michael@0 60 PS1="__VIRTUAL_PROMPT__$PS1"
michael@0 61 else
michael@0 62 if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
michael@0 63 # special case for Aspen magic directories
michael@0 64 # see http://www.zetadev.com/software/aspen/
michael@0 65 PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
michael@0 66 else
michael@0 67 PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
michael@0 68 fi
michael@0 69 fi
michael@0 70 export PS1
michael@0 71 fi
michael@0 72
michael@0 73 alias pydoc="python -m pydoc"
michael@0 74
michael@0 75 # This should detect bash and zsh, which have a hash command that must
michael@0 76 # be called to get it to forget past commands. Without forgetting
michael@0 77 # past commands the $PATH changes we made may not be respected
michael@0 78 if [ -n "$BASH" -o -n "$ZSH_VERSION" ] ; then
michael@0 79 hash -r 2>/dev/null
michael@0 80 fi

mercurial