@ -82,26 +82,32 @@ if zstyle -t ':prezto:module:python:virtualenv' auto-switch 'yes'; then
add-zsh-hook chpwd _python-workon-cwd
add-zsh-hook chpwd _python-workon-cwd
fi
fi
# Load virtualenvwrapper into the shell session, unless requested not to
# Load virtualenvwrapper into the shell session, if pre-requisites are met
if zstyle -T ':prezto:module:python' skip-virtualenvwrapper-init; then
# and unless explicitly requested not to
if ( ( $+VIRTUALENVWRAPPER_VIRTUALENV || $+commands[ virtualenv] ) ) && \
zstyle -T ':prezto:module:python:virtualenv' initialize ; then
# Set the directory where virtual environments are stored.
# Set the directory where virtual environments are stored.
export WORKON_HOME = " ${ WORKON_HOME :- $HOME /.virtualenvs } "
export WORKON_HOME = " ${ WORKON_HOME :- $HOME /.virtualenvs } "
# Disable the virtualenv prompt.
# Disable the virtualenv prompt.
VIRTUAL_ENV_DISABLE_PROMPT = 1
VIRTUAL_ENV_DISABLE_PROMPT = 1
if ( ( $+commands[ pyenv-virtualenvwrapper] ) ) ; then
if ( ( $+commands[ pyenv] ) ) ; then
pyenv virtualenvwrapper
if ( ( $+commands[ pyenv-virtualenv-init] ) ) ; then
elif ( ( $+commands[ pyenv-virtualenv-init] ) ) ; then
eval " $( pyenv virtualenv-init -) "
eval " $( pyenv virtualenv-init -) "
elif ( ( $+commands[ virtualenvwrapper_lazy.sh] ) ) ; then
fi
source " $commands [virtualenvwrapper_lazy.sh] "
if ( ( $# commands[ ( i) pyenv-virtualenvwrapper( _lazy| ) ] ) ) ; then
elif ( ( $+commands[ virtualenvwrapper.sh] ) ) ; then
pyenv " ${ ${ (@O)commands[(I)pyenv-virtualenvwrapper(_lazy|)] } [1]#pyenv- } "
source " $commands [virtualenvwrapper.sh] "
fi
elif [ [ -f /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh ] ] ; then
else
source /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh
# Try 'virtualenvwrapper' without 'pyenv' wrapper in '$path' and other
elif [ [ -f /usr/share/virtualenvwrapper/virtualenvwrapper.sh ] ] ; then
# known locations on a Debian based system.
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
virtenv_sources = (
${ (@Ov)commands[(I)virtualenvwrapper(_lazy|).sh] }
/usr/share/virtualenvwrapper/virtualenvwrapper( _lazy| ) .sh( OnN)
)
source " ${ virtenv_sources [1] } "
unset virtenv_sources
fi
fi
fi
fi
@ -109,7 +115,7 @@ fi
if ( ( $# commands[ ( i) pip( | [ 23] ) ] ) ) ; then
if ( ( $# commands[ ( i) pip( | [ 23] ) ] ) ) ; then
cache_file = " ${ 0 : h } /cache.zsh "
cache_file = " ${ 0 : h } /cache.zsh "
# Detect and use first one available among 'pip', 'pip2', 'pip3' variants
# Detect and use one available from among 'pip', 'pip2', 'pip3' variants
pip_command = " $commands [(i)pip(|[23])] "
pip_command = " $commands [(i)pip(|[23])] "
if [ [ " $pip_command " -nt " $cache_file " || ! -s " $cache_file " ] ] ; then
if [ [ " $pip_command " -nt " $cache_file " || ! -s " $cache_file " ] ] ; then
@ -119,8 +125,7 @@ if (( $#commands[(i)pip(|[23])] )); then
fi
fi
source " $cache_file "
source " $cache_file "
unset cache_file
unset cache_file pip_command
unset pip_command
fi
fi
#
#
@ -128,3 +133,5 @@ fi
#
#
alias py = 'python'
alias py = 'python'
alias py2 = 'python2'
alias py3 = 'python3'