python: make a reasonable guess about virtualenvwrapper python location

Fixes #1416
main
Kaleb Elwert 7 years ago
parent aa0395244d
commit e021adeb4a

@ -1 +1 @@
Subproject commit 15931f04ffac91a2f9a1a044b6b3ee4050751064
Subproject commit 9f9237ab8a530eeff389161202bbc7283ad6af3e

@ -8,11 +8,15 @@ Settings
This module supports virtual environments from conda and virtualenvwrapper. By default, only virtualenvwrapper is enabled. To disable virtualenvwrapper, add the following to *zpreztorc*.
zstyle ':prezto:module:python' skip-virtualenvwrapper-init 'on'
```sh
zstyle ':prezto:module:python' skip-virtualenvwrapper-init 'on'
```
Conda support is enabled by adding the following to *zpreztorc*.
zstyle ':prezto:module:python' conda-init 'on'
```sh
zstyle ':prezto:module:python' conda-init 'on'
```
Caution: using conda and virtualenvwrapper at the same time may cause conflicts.
@ -106,10 +110,18 @@ zstyle ':prezto:module:python:virtualenv' auto-switch 'yes'
(`$VIRTUALENVWRAPPER_VIRTUALENV` is explicitly set or `virtualenv` is in
`$PATH`). This can be disabled with:
```
```sh
zstyle ':prezto:module:python:virtualenv' initialize 'no'
```
On some systems, the `python` binary doesn't exist so in order to get
virtualenvwrapper to work, the path needs to specified. We do our best to detect
this, but sometimes it needs manual intervention.
```sh
zstyle ':prezto:module:python:virtualenvwrapper' python-path /opt/python3/bin/python3
```
Aliases
-------

@ -114,6 +114,20 @@ if (( $+VIRTUALENVWRAPPER_VIRTUALENV || $+commands[virtualenv] )) && \
else
# Fallback to 'virtualenvwrapper' without 'pyenv' wrapper if available
# in '$path' or in an alternative location on a Debian based system.
#
# If the python-path was manually specified, use that. Otherwise, fall back
# to python3 then python2 in that order. This is needed to fix an issue with
# virtualenvwrapper when used with homebrew, as it no longer shadows the
# system python.
zstyle -s ':prezto:module:python:virtualenvwrapper' python-path '_venv_python'
if [[ -n "$_venv_python" ]]; then
export VIRTUALENVWRAPPER_PYTHON=$_venv_python
elif (( $+commands[python3] )); then
export VIRTUALENVWRAPPER_PYTHON=$commands[python3]
elif (( $+commands[python2] )); then
export VIRTUALENVWRAPPER_PYTHON=$commands[python2]
fi
virtenv_sources=(
${(@Ov)commands[(I)virtualenvwrapper(_lazy|).sh]}
/usr/share/virtualenvwrapper/virtualenvwrapper(_lazy|).sh(OnN)

Loading…
Cancel
Save