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.

     1 # This file must be used with "source bin/activate" *from bash*
     2 # you cannot run it directly
     4 deactivate () {
     5     unset pydoc
     7     # reset old environment variables
     8     if [ -n "$_OLD_VIRTUAL_PATH" ] ; then
     9         PATH="$_OLD_VIRTUAL_PATH"
    10         export PATH
    11         unset _OLD_VIRTUAL_PATH
    12     fi
    13     if [ -n "$_OLD_VIRTUAL_PYTHONHOME" ] ; then
    14         PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME"
    15         export PYTHONHOME
    16         unset _OLD_VIRTUAL_PYTHONHOME
    17     fi
    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
    23         hash -r 2>/dev/null
    24     fi
    26     if [ -n "$_OLD_VIRTUAL_PS1" ] ; then
    27         PS1="$_OLD_VIRTUAL_PS1"
    28         export PS1
    29         unset _OLD_VIRTUAL_PS1
    30     fi
    32     unset VIRTUAL_ENV
    33     if [ ! "$1" = "nondestructive" ] ; then
    34     # Self destruct!
    35         unset -f deactivate
    36     fi
    37 }
    39 # unset irrelevant variables
    40 deactivate nondestructive
    42 VIRTUAL_ENV="__VIRTUAL_ENV__"
    43 export VIRTUAL_ENV
    45 _OLD_VIRTUAL_PATH="$PATH"
    46 PATH="$VIRTUAL_ENV/__BIN_NAME__:$PATH"
    47 export 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"
    54     unset PYTHONHOME
    55 fi
    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"
    61     else
    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"
    66     else
    67         PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
    68     fi
    69     fi
    70     export PS1
    71 fi
    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
    79     hash -r 2>/dev/null
    80 fi

mercurial