|
| 1 | +# This file must be used with "source bin/activate" *from bash* |
| 2 | +# you cannot run it directly |
| 3 | + |
| 4 | + |
| 5 | +if [ "${BASH_SOURCE-}" = "$0" ]; then |
| 6 | + echo "You must source this script: \$ source $0" >&2 |
| 7 | + exit 33 |
| 8 | +fi |
| 9 | + |
| 10 | +deactivate () { |
| 11 | + unset -f pydoc >/dev/null 2>&1 |
| 12 | + |
| 13 | + # reset old environment variables |
| 14 | + # ! [ -z ${VAR+_} ] returns true if VAR is declared at all |
| 15 | + if ! [ -z "${_OLD_VIRTUAL_PATH:+_}" ] ; then |
| 16 | + PATH="$_OLD_VIRTUAL_PATH" |
| 17 | + export PATH |
| 18 | + unset _OLD_VIRTUAL_PATH |
| 19 | + fi |
| 20 | + if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then |
| 21 | + PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME" |
| 22 | + export PYTHONHOME |
| 23 | + unset _OLD_VIRTUAL_PYTHONHOME |
| 24 | + fi |
| 25 | + |
| 26 | + # This should detect bash and zsh, which have a hash command that must |
| 27 | + # be called to get it to forget past commands. Without forgetting |
| 28 | + # past commands the $PATH changes we made may not be respected |
| 29 | + if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then |
| 30 | + hash -r 2>/dev/null |
| 31 | + fi |
| 32 | + |
| 33 | + if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then |
| 34 | + PS1="$_OLD_VIRTUAL_PS1" |
| 35 | + export PS1 |
| 36 | + unset _OLD_VIRTUAL_PS1 |
| 37 | + fi |
| 38 | + |
| 39 | + unset VIRTUAL_ENV |
| 40 | + if [ ! "${1-}" = "nondestructive" ] ; then |
| 41 | + # Self destruct! |
| 42 | + unset -f deactivate |
| 43 | + fi |
| 44 | +} |
| 45 | + |
| 46 | +# unset irrelevant variables |
| 47 | +deactivate nondestructive |
| 48 | + |
| 49 | +VIRTUAL_ENV="/Users/py356p/codebase/pact-python/venv27" |
| 50 | +export VIRTUAL_ENV |
| 51 | + |
| 52 | +_OLD_VIRTUAL_PATH="$PATH" |
| 53 | +PATH="$VIRTUAL_ENV/bin:$PATH" |
| 54 | +export PATH |
| 55 | + |
| 56 | +# unset PYTHONHOME if set |
| 57 | +if ! [ -z "${PYTHONHOME+_}" ] ; then |
| 58 | + _OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME" |
| 59 | + unset PYTHONHOME |
| 60 | +fi |
| 61 | + |
| 62 | +if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then |
| 63 | + _OLD_VIRTUAL_PS1="${PS1-}" |
| 64 | + if [ "x" != x ] ; then |
| 65 | + PS1="${PS1-}" |
| 66 | + else |
| 67 | + PS1="(`basename \"$VIRTUAL_ENV\"`) ${PS1-}" |
| 68 | + fi |
| 69 | + export PS1 |
| 70 | +fi |
| 71 | + |
| 72 | +# Make sure to unalias pydoc if it's already there |
| 73 | +alias pydoc 2>/dev/null >/dev/null && unalias pydoc || true |
| 74 | + |
| 75 | +pydoc () { |
| 76 | + python -m pydoc "$@" |
| 77 | +} |
| 78 | + |
| 79 | +# This should detect bash and zsh, which have a hash command that must |
| 80 | +# be called to get it to forget past commands. Without forgetting |
| 81 | +# past commands the $PATH changes we made may not be respected |
| 82 | +if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then |
| 83 | + hash -r 2>/dev/null |
| 84 | +fi |
0 commit comments