You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.1 KiB

  1. # This file must be used using `. bin/activate.fish` *within a running fish ( http://fishshell.com ) session*.
  2. # Do not run it directly.
  3. function deactivate -d 'Exit virtualenv mode and return to the normal 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. # Set an empty local `$fish_function_path` to allow the removal of `fish_prompt` using `functions -e`.
  15. set -l fish_function_path
  16. # Erase virtualenv's `fish_prompt` and restore the original.
  17. functions -e fish_prompt
  18. functions -c _old_fish_prompt fish_prompt
  19. functions -e _old_fish_prompt
  20. set -e _OLD_FISH_PROMPT_OVERRIDE
  21. end
  22. set -e VIRTUAL_ENV
  23. if test "$argv[1]" != 'nondestructive'
  24. # Self-destruct!
  25. functions -e pydoc
  26. functions -e deactivate
  27. end
  28. end
  29. # Unset irrelevant variables.
  30. deactivate nondestructive
  31. set -gx VIRTUAL_ENV "/home/yigido/projects/WRO_QR/venv"
  32. set -gx _OLD_VIRTUAL_PATH $PATH
  33. set -gx PATH "$VIRTUAL_ENV/bin" $PATH
  34. # Unset `$PYTHONHOME` if set.
  35. if set -q PYTHONHOME
  36. set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
  37. set -e PYTHONHOME
  38. end
  39. function pydoc
  40. python -m pydoc $argv
  41. end
  42. if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
  43. # Copy the current `fish_prompt` function as `_old_fish_prompt`.
  44. functions -c fish_prompt _old_fish_prompt
  45. function fish_prompt
  46. # Save the current $status, for fish_prompts that display it.
  47. set -l old_status $status
  48. # Prompt override provided?
  49. # If not, just prepend the environment name.
  50. if test -n ""
  51. printf '%s%s' "" (set_color normal)
  52. else
  53. printf '%s(%s) ' (set_color normal) (basename "$VIRTUAL_ENV")
  54. end
  55. # Restore the original $status
  56. echo "exit $old_status" | source
  57. _old_fish_prompt
  58. end
  59. set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
  60. end