mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-25 15:20:08 +00:00
virtualenvwrapper: rewrite init script location code (#8521)
This commit is contained in:
parent
77aa1795d2
commit
e81782ac3f
1 changed files with 19 additions and 45 deletions
|
@ -1,55 +1,29 @@
|
||||||
virtualenvwrapper='virtualenvwrapper.sh'
|
function {
|
||||||
virtualenvwrapper_lazy='virtualenvwrapper_lazy.sh'
|
# search in these locations for the init script:
|
||||||
|
for f in $commands[virtualenvwrapper_lazy.sh] \
|
||||||
if (( $+commands[$virtualenvwrapper_lazy] )); then
|
$commands[virtualenvwrapper.sh] \
|
||||||
function {
|
/usr/share/virtualenvwrapper/virtualenvwrapper{_lazy,}.sh \
|
||||||
setopt local_options
|
/usr/local/bin/virtualenvwrapper{_lazy,}.sh \
|
||||||
unsetopt equals
|
/etc/bash_completion.d/virtualenvwrapper \
|
||||||
virtualenvwrapper=${${virtualenvwrapper_lazy}:c}
|
/usr/share/bash-completion/completions/virtualenvwrapper
|
||||||
source ${${virtualenvwrapper_lazy}:c}
|
do
|
||||||
[[ -z "$WORKON_HOME" ]] && WORKON_HOME="$HOME/.virtualenvs"
|
if [[ -f $f ]]; then
|
||||||
}
|
source $f
|
||||||
elif (( $+commands[$virtualenvwrapper] )); then
|
|
||||||
function {
|
|
||||||
setopt local_options
|
|
||||||
unsetopt equals
|
|
||||||
source ${${virtualenvwrapper}:c}
|
|
||||||
}
|
|
||||||
elif [[ -f "/usr/local/bin/virtualenvwrapper.sh" ]]; then
|
|
||||||
function {
|
|
||||||
setopt local_options
|
|
||||||
unsetopt equals
|
|
||||||
virtualenvwrapper="/usr/local/bin/virtualenvwrapper.sh"
|
|
||||||
source "/usr/local/bin/virtualenvwrapper.sh"
|
|
||||||
}
|
|
||||||
elif [[ -f "/usr/share/virtualenvwrapper/virtualenvwrapper.sh" ]]; then
|
|
||||||
function {
|
|
||||||
setopt local_options
|
|
||||||
unsetopt equals
|
|
||||||
virtualenvwrapper="/usr/share/virtualenvwrapper/virtualenvwrapper.sh"
|
|
||||||
source "/usr/share/virtualenvwrapper/virtualenvwrapper.sh"
|
|
||||||
}
|
|
||||||
elif [[ -f "/etc/bash_completion.d/virtualenvwrapper" ]]; then
|
|
||||||
function {
|
|
||||||
setopt local_options
|
|
||||||
unsetopt equals
|
|
||||||
virtualenvwrapper="/etc/bash_completion.d/virtualenvwrapper"
|
|
||||||
source "/etc/bash_completion.d/virtualenvwrapper"
|
|
||||||
}
|
|
||||||
else
|
|
||||||
print "[oh-my-zsh] virtualenvwrapper plugin: Cannot find ${virtualenvwrapper}.\n"\
|
|
||||||
"Please install with \`pip install virtualenvwrapper\`" >&2
|
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
print "[oh-my-zsh] virtualenvwrapper plugin: Cannot find virtualenvwrapper.sh.\n"\
|
||||||
|
"Please install with \`pip install virtualenvwrapper\`" >&2
|
||||||
|
}
|
||||||
|
|
||||||
if ! type workon &>/dev/null; then
|
if ! type workon &>/dev/null; then
|
||||||
print "[oh-my-zsh] virtualenvwrapper plugin: shell function 'workon' not defined.\n"\
|
print "[oh-my-zsh] virtualenvwrapper plugin: shell function 'workon' not defined.\n"\
|
||||||
"Please check ${virtualenvwrapper}" >&2
|
"Please check ${virtualenvwrapper}" >&2
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$WORKON_HOME" == "" ]]; then
|
if [[ -z "$WORKON_HOME" ]]; then
|
||||||
print "[oh-my-zsh] \$WORKON_HOME is not defined so plugin virtualenvwrapper will not work" >&2
|
WORKON_HOME="$HOME/.virtualenvs"
|
||||||
return
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
|
if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
|
||||||
|
|
Loading…
Reference in a new issue