Browse Source

python: make a reasonable guess about virtualenvwrapper python location

Fixes #1416
master
Kaleb Elwert 7 years ago
parent
commit
09313c0c84
  1. 2
      modules/autosuggestions/external
  2. 14
      modules/python/README.md
  3. 14
      modules/python/init.zsh

2
modules/autosuggestions/external

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

14
modules/python/README.md

@ -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*. This module supports virtual environments from conda and virtualenvwrapper. By default, only virtualenvwrapper is enabled. To disable virtualenvwrapper, add the following to *zpreztorc*.
```sh
zstyle ':prezto:module:python' skip-virtualenvwrapper-init 'on' zstyle ':prezto:module:python' skip-virtualenvwrapper-init 'on'
```
Conda support is enabled by adding the following to *zpreztorc*. Conda support is enabled by adding the following to *zpreztorc*.
```sh
zstyle ':prezto:module:python' conda-init 'on' zstyle ':prezto:module:python' conda-init 'on'
```
Caution: using conda and virtualenvwrapper at the same time may cause conflicts. 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 (`$VIRTUALENVWRAPPER_VIRTUALENV` is explicitly set or `virtualenv` is in
`$PATH`). This can be disabled with: `$PATH`). This can be disabled with:
``` ```sh
zstyle ':prezto:module:python:virtualenv' initialize 'no' 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 Aliases
------- -------

14
modules/python/init.zsh

@ -114,6 +114,20 @@ if (( $+VIRTUALENVWRAPPER_VIRTUALENV || $+commands[virtualenv] )) && \
else else
# Fallback to 'virtualenvwrapper' without 'pyenv' wrapper if available # Fallback to 'virtualenvwrapper' without 'pyenv' wrapper if available
# in '$path' or in an alternative location on a Debian based system. # 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=( virtenv_sources=(
${(@Ov)commands[(I)virtualenvwrapper(_lazy|).sh]} ${(@Ov)commands[(I)virtualenvwrapper(_lazy|).sh]}
/usr/share/virtualenvwrapper/virtualenvwrapper(_lazy|).sh(OnN) /usr/share/virtualenvwrapper/virtualenvwrapper(_lazy|).sh(OnN)

Loading…
Cancel
Save