Advertisement
Guest User

Untitled

a guest
Jan 19th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. # This file must be used with "source bin/activate" *from bash*
  2. # you cannot run it directly
  3.  
  4. deactivate () {
  5. unset -f pydoc >/dev/null 2>&1
  6.  
  7. # reset old environment variables
  8. # ! [ -z ${VAR+_} ] returns true if VAR is declared at all
  9. if ! [ -z "${_OLD_VIRTUAL_PATH+_}" ] ; then
  10. PATH="$_OLD_VIRTUAL_PATH"
  11. export PATH
  12. unset _OLD_VIRTUAL_PATH
  13. fi
  14. if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then
  15. PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME"
  16. export PYTHONHOME
  17. unset _OLD_VIRTUAL_PYTHONHOME
  18. fi
  19.  
  20. # This should detect bash and zsh, which have a hash command that must
  21. # be called to get it to forget past commands. Without forgetting
  22. # past commands the $PATH changes we made may not be respected
  23. if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
  24. hash -r 2>/dev/null
  25. fi
  26.  
  27. if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then
  28. PS1="$_OLD_VIRTUAL_PS1"
  29. export PS1
  30. unset _OLD_VIRTUAL_PS1
  31. fi
  32.  
  33. unset VIRTUAL_ENV
  34. if [ ! "${1-}" = "nondestructive" ] ; then
  35. # Self destruct!
  36. unset -f deactivate
  37. fi
  38. }
  39.  
  40. # unset irrelevant variables
  41. deactivate nondestructive
  42.  
  43. VIRTUAL_ENV="/vol/lab/course/416/venv"
  44. export VIRTUAL_ENV
  45.  
  46. _OLD_VIRTUAL_PATH="$PATH"
  47. PATH="$VIRTUAL_ENV/bin:$PATH"
  48. export PATH
  49.  
  50. # unset PYTHONHOME if set
  51. if ! [ -z "${PYTHONHOME+_}" ] ; then
  52. _OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
  53. unset PYTHONHOME
  54. fi
  55.  
  56. if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then
  57. _OLD_VIRTUAL_PS1="$PS1"
  58. if [ "x" != x ] ; then
  59. PS1="$PS1"
  60. else
  61. PS1="(`basename \"$VIRTUAL_ENV\"`) $PS1"
  62. fi
  63. export PS1
  64. fi
  65.  
  66. # Make sure to unalias pydoc if it's already there
  67. alias pydoc 2>/dev/null >/dev/null && unalias pydoc
  68.  
  69. pydoc () {
  70. python -m pydoc "$@"
  71. }
  72.  
  73. # This should detect bash and zsh, which have a hash command that must
  74. # be called to get it to forget past commands. Without forgetting
  75. # past commands the $PATH changes we made may not be respected
  76. if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
  77. hash -r 2>/dev/null
  78. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement