diff options
author | Brandon Sandrowicz <brandon@sandrowicz.org> | 2014-05-20 09:41:36 -0400 |
---|---|---|
committer | Marc Cornellà <marc.cornella@live.com> | 2015-02-10 20:32:52 +0100 |
commit | 4161aa4f9de45233bdee7073933498422a50d213 (patch) | |
tree | 95f931da8b100a4fdb44ff6ddb2be5538ad7c983 /plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh | |
parent | 8830f65c4dbb1d1727540c0d1f983237383884f0 (diff) | |
download | zsh-4161aa4f9de45233bdee7073933498422a50d213.tar.gz zsh-4161aa4f9de45233bdee7073933498422a50d213.tar.bz2 zsh-4161aa4f9de45233bdee7073933498422a50d213.zip |
Fixing virtualenvwrapper plugin for Ubuntu (and Debian)
Ubuntu and Debian store the system-installed virtualenvwrapper in
/etc/bash_completion.d/virtualenvwrapper, so that it gets automatically sourced
at startup in Bash. By not putting it somewhere in $PATH, they end up excluding
others (e.g. Zsh) that might want to use that file. Oops!
The virtualenvwrapper plugin should account for this so that Ubuntu (or Debian)
users don't end up with this message:
zsh virtualenvwrapper plugin: Cannot find virtualenvwrapper.sh. Please install with `pip install virtualenvwrapper`.
even when they have a virtualenvwrapper installed to a known location.
Diffstat (limited to 'plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh')
-rw-r--r-- | plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh index 217ab0722..9a0616b72 100644 --- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh +++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh @@ -1,12 +1,19 @@ virtualenvwrapper='virtualenvwrapper.sh' -if (( $+commands[$virtualenvwrapper] )); then +if (( $+commands[$virtualenvwrapper] )); then source ${${virtualenvwrapper}:c} +elif [[ -f "/etc/bash_completion.d/virtualenvwrapper" ]]; then + virtualenvwrapper="/etc/bash_completion.d/virtualenvwrapper" + source "/etc/bash_completion.d/virtualenvwrapper" +else + print "zsh virtualenvwrapper plugin: Cannot find ${virtualenvwrapper}. Please install with \`pip install virtualenvwrapper\`." + return +fi +if type workon 2>&1 >/dev/null; then if [[ "$WORKON_HOME" == "" ]]; then echo "\$WORKON_HOME is not defined so ZSH plugin virtualenvwrapper will not work" else - if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then # Automatically activate Git projects's virtual environments based on the # directory name of the project. Virtual environment name can be overridden @@ -61,5 +68,5 @@ if (( $+commands[$virtualenvwrapper] )); then fi fi else - print "zsh virtualenvwrapper plugin: Cannot find ${virtualenvwrapper}. Please install with \`pip install virtualenvwrapper\`." + print "zsh virtualenvwrapper plugin: shell function 'workon' not defined. Please check ${virtualenvwrapper}." >&2 fi |