11# This file must be used with "source bin/activate" *from bash*
2- # you cannot run it directly
2+ # You cannot run it directly
33
44deactivate () {
55 # reset old environment variables
@@ -14,12 +14,10 @@ deactivate () {
1414 unset _OLD_VIRTUAL_PYTHONHOME
1515 fi
1616
17- # This should detect bash and zsh, which have a hash command that must
18- # be called to get it to forget past commands. Without forgetting
19- # past commands the $PATH changes we made may not be respected
20- if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
21- hash -r 2> /dev/null
22- fi
17+ # Call hash to forget past locations. Without forgetting
18+ # past locations the $PATH changes we made may not be respected.
19+ # See "man bash" for more details. hash is usually a builtin of your shell
20+ hash -r 2> /dev/null
2321
2422 if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
2523 PS1="${_OLD_VIRTUAL_PS1:-}"
@@ -28,6 +26,7 @@ deactivate () {
2826 fi
2927
3028 unset VIRTUAL_ENV
29+ unset VIRTUAL_ENV_PROMPT
3130 if [ ! "${1:-}" = "nondestructive" ] ; then
3231 # Self destruct!
3332 unset -f deactivate
@@ -37,13 +36,27 @@ deactivate () {
3736# unset irrelevant variables
3837deactivate nondestructive
3938
40- VIRTUAL_ENV="/Users/alexoh/Documents/GitHub/arrastools/.venv"
41- export VIRTUAL_ENV
39+ # on Windows, a path can contain colons and backslashes and has to be converted:
40+ case "$(uname)" in
41+ CYGWIN*|MSYS*|MINGW*)
42+ # transform D:\path\to\venv to /d/path/to/venv on MSYS and MINGW
43+ # and to /cygdrive/d/path/to/venv on Cygwin
44+ VIRTUAL_ENV=$(cygpath /Users/alexoh/Documents/GitHub/arrastools/.venv)
45+ export VIRTUAL_ENV
46+ ;;
47+ *)
48+ # use the path as-is
49+ export VIRTUAL_ENV=/Users/alexoh/Documents/GitHub/arrastools/.venv
50+ ;;
51+ esac
4252
4353_OLD_VIRTUAL_PATH="$PATH"
44- PATH="$VIRTUAL_ENV/bin:$PATH"
54+ PATH="$VIRTUAL_ENV/" bin" :$PATH"
4555export PATH
4656
57+ VIRTUAL_ENV_PROMPT='(.venv) '
58+ export VIRTUAL_ENV_PROMPT
59+
4760# unset PYTHONHOME if set
4861# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
4962# could use `if (set -u; : $PYTHONHOME) ;` in bash
5467
5568if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
5669 _OLD_VIRTUAL_PS1="${PS1:-}"
57- PS1="(.venv) ${PS1:-}"
70+ PS1="("'( .venv) '" ) ${PS1:-}"
5871 export PS1
5972fi
6073
61- # This should detect bash and zsh, which have a hash command that must
62- # be called to get it to forget past commands. Without forgetting
74+ # Call hash to forget past commands. Without forgetting
6375# past commands the $PATH changes we made may not be respected
64- if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
65- hash -r 2> /dev/null
66- fi
76+ hash -r 2> /dev/null
0 commit comments