codekingpro/portable-devtools
114k
1# This file must be used with "source bin/activate" *from bash*2# you cannot run it directly3 4 5if [ "${BASH_SOURCE-}" = "$0" ]; then6 echo "You must source this script: \$ source $0" >&27 exit 338fi9 10deactivate () {11 unset -f pydoc >/dev/null 2>&1 || true12 13 # reset old environment variables14 # ! [ -z ${VAR+_} ] returns true if VAR is declared at all15 if ! [ -z "${_OLD_VIRTUAL_PATH:+_}" ] ; then16 PATH="$_OLD_VIRTUAL_PATH"17 export PATH18 unset _OLD_VIRTUAL_PATH19 fi20 if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then21 PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME"22 export PYTHONHOME23 unset _OLD_VIRTUAL_PYTHONHOME24 fi25 26 # The hash command must be called to get it to forget past27 # commands. Without forgetting past commands the $PATH changes28 # we made may not be respected29 hash -r 2>/dev/null30 31 if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then32 PS1="$_OLD_VIRTUAL_PS1"33 export PS134 unset _OLD_VIRTUAL_PS135 fi36 37 unset VIRTUAL_ENV38 unset VIRTUAL_ENV_PROMPT39 if [ ! "${1-}" = "nondestructive" ] ; then40 # Self destruct!41 unset -f deactivate42 fi43}44 45# unset irrelevant variables46deactivate nondestructive47 48VIRTUAL_ENV='__VIRTUAL_ENV__'49if ([ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ]) && $(command -v cygpath &> /dev/null) ; then50 VIRTUAL_ENV=$(cygpath -u "$VIRTUAL_ENV")51fi52export VIRTUAL_ENV53 54_OLD_VIRTUAL_PATH="$PATH"55PATH="$VIRTUAL_ENV/__BIN_NAME__:$PATH"56export PATH57 58if [ "x__VIRTUAL_PROMPT__" != x ] ; then59 VIRTUAL_ENV_PROMPT="__VIRTUAL_PROMPT__"60else61 VIRTUAL_ENV_PROMPT=$(basename "$VIRTUAL_ENV")62fi63export VIRTUAL_ENV_PROMPT64 65# unset PYTHONHOME if set66if ! [ -z "${PYTHONHOME+_}" ] ; then67 _OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"68 unset PYTHONHOME69fi70 71if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then72 _OLD_VIRTUAL_PS1="${PS1-}"73 PS1="(${VIRTUAL_ENV_PROMPT}) ${PS1-}"74 export PS175fi76 77# Make sure to unalias pydoc if it's already there78alias pydoc 2>/dev/null >/dev/null && unalias pydoc || true79 80pydoc () {81 python -m pydoc "$@"82}83 84# The hash command must be called to get it to forget past85# commands. Without forgetting past commands the $PATH changes86# we made may not be respected87hash -r 2>/dev/null88 