SHOW:
|
|
- or go back to the newest paste.
| 1 | # This file must be used with "source bin/activate" *from bash* | |
| 2 | # you cannot run it directly | |
| 3 | ||
| 4 | deactivate () {
| |
| 5 | unset pydoc | |
| 6 | ||
| 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 | |
| 18 | ||
| 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 | |
| 25 | ||
| 26 | if [ -n "$_OLD_VIRTUAL_PS1" ] ; then | |
| 27 | PS1="$_OLD_VIRTUAL_PS1" | |
| 28 | export PS1 | |
| 29 | unset _OLD_VIRTUAL_PS1 | |
| 30 | fi | |
| 31 | ||
| 32 | unset VIRTUAL_ENV | |
| 33 | if [ ! "$1" = "nondestructive" ] ; then | |
| 34 | # Self destruct! | |
| 35 | unset -f deactivate | |
| 36 | fi | |
| 37 | } | |
| 38 | ||
| 39 | # unset irrelevant variables | |
| 40 | deactivate nondestructive | |
| 41 | ||
| 42 | VIRTUAL_ENV="/home/aditya/Code/status_dashboard/venv" | |
| 43 | export VIRTUAL_ENV | |
| 44 | ||
| 45 | _OLD_VIRTUAL_PATH="$PATH" | |
| 46 | PATH="$VIRTUAL_ENV/bin:$PATH" | |
| 47 | export PATH | |
| 48 | ||
| 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 | |
| 56 | ||
| 57 | if [ -z "$VIRTUAL_ENV_DISABLE_PROMPT" ] ; then | |
| 58 | _OLD_VIRTUAL_PS1="$PS1" | |
| 59 | if [ "x" != x ] ; then | |
| 60 | PS1="$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 | |
| 72 | ||
| 73 | alias pydoc="python -m pydoc" | |
| 74 | ||
| 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 |