25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

75 lines
2.4 KiB

  1. # This file must be used with ". bin/activate.fish" *from fish* (http://fishshell.org)
  2. # you cannot run it directly
  3. function deactivate -d "Exit virtualenv and return to normal shell environment"
  4. # reset old environment variables
  5. if test -n "$_OLD_VIRTUAL_PATH"
  6. set -gx PATH $_OLD_VIRTUAL_PATH
  7. set -e _OLD_VIRTUAL_PATH
  8. end
  9. if test -n "$_OLD_VIRTUAL_PYTHONHOME"
  10. set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
  11. set -e _OLD_VIRTUAL_PYTHONHOME
  12. end
  13. if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
  14. functions -e fish_prompt
  15. set -e _OLD_FISH_PROMPT_OVERRIDE
  16. . ( begin
  17. printf "function fish_prompt\n\t#"
  18. functions _old_fish_prompt
  19. end | psub )
  20. functions -e _old_fish_prompt
  21. end
  22. set -e VIRTUAL_ENV
  23. if test "$argv[1]" != "nondestructive"
  24. # Self destruct!
  25. functions -e deactivate
  26. end
  27. end
  28. # unset irrelavent variables
  29. deactivate nondestructive
  30. set -gx VIRTUAL_ENV "/var/www/html/ecomonde/ecomonde-venv"
  31. set -gx _OLD_VIRTUAL_PATH $PATH
  32. set -gx PATH "$VIRTUAL_ENV/bin" $PATH
  33. # unset PYTHONHOME if set
  34. if set -q PYTHONHOME
  35. set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
  36. set -e PYTHONHOME
  37. end
  38. if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
  39. # fish uses a function instead of an env var to generate the prompt.
  40. # save the current fish_prompt function as the function _old_fish_prompt
  41. . ( begin
  42. printf "function _old_fish_prompt\n\t#"
  43. functions fish_prompt
  44. end | psub )
  45. # with the original prompt function renamed, we can override with our own.
  46. function fish_prompt
  47. # Prompt override?
  48. if test -n "(ecomonde-venv) "
  49. printf "%s%s%s" "(ecomonde-venv) " (set_color normal) (_old_fish_prompt)
  50. return
  51. end
  52. # ...Otherwise, prepend env
  53. set -l _checkbase (basename "$VIRTUAL_ENV")
  54. if test $_checkbase = "__"
  55. # special case for Aspen magic directories
  56. # see http://www.zetadev.com/software/aspen/
  57. printf "%s[%s]%s %s" (set_color -b blue white) (basename (dirname "$VIRTUAL_ENV")) (set_color normal) (_old_fish_prompt)
  58. else
  59. printf "%s(%s)%s%s" (set_color -b blue white) (basename "$VIRTUAL_ENV") (set_color normal) (_old_fish_prompt)
  60. end
  61. end
  62. set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
  63. end