mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-12-22 23:08:00 +00:00
Edit pyenv virtualenv-init check to support non-brew installations
If the pyenv virtualenv plugin is installed using the [pyenv-installer][1] app script or directly via a [Git clone][2], then the pyenv-virtualenv-init executable, that the `pyenv virtualenv-init` command uses, will not exist in the user's PATH and therefore cannot be found using `$commands[pyenv-virtualenv-init]`. Installing the pyenv-virtualenv plugin in this manner is common among Linux users. Using the pyenv `commands` command, which lists all commands pyenv can run, we can find if the virtualenv-init command is available to pyenv and subsequently the virtualenv plugin, without relying on pyenv-virtualenv-init to exist in the user's PATH. [1]: https://github.com/pyenv/pyenv-installer [2]: https://github.com/pyenv/pyenv-virtualenv#installing-as-a-pyenv-plugin
This commit is contained in:
parent
9dfa8a67f6
commit
3194442759
@ -93,7 +93,9 @@ if (( $+VIRTUALENVWRAPPER_VIRTUALENV || $+commands[virtualenv] )) && \
|
|||||||
VIRTUAL_ENV_DISABLE_PROMPT=1
|
VIRTUAL_ENV_DISABLE_PROMPT=1
|
||||||
|
|
||||||
# Enable 'virtualenv' with 'pyenv'.
|
# Enable 'virtualenv' with 'pyenv'.
|
||||||
if (( $+commands[pyenv] && $+commands[pyenv-virtualenv-init] )); then
|
if (( $+commands[pyenv] )) && \
|
||||||
|
pyenv commands | command grep -q virtualenv-init
|
||||||
|
then
|
||||||
eval "$(pyenv virtualenv-init -)"
|
eval "$(pyenv virtualenv-init -)"
|
||||||
# Optionall activate 'virtualenvwrapper' with 'pyenv' is available.
|
# Optionall activate 'virtualenvwrapper' with 'pyenv' is available.
|
||||||
if (( $#commands[(i)pyenv-virtualenvwrapper(_lazy|)] )); then
|
if (( $#commands[(i)pyenv-virtualenvwrapper(_lazy|)] )); then
|
||||||
|
Loading…
Reference in New Issue
Block a user