fix(pyenv)!: do not load if a virtualenv is present

BREAKING CHANGE: `pyenv` will not be loaded at startup anymore if a
virtual env if found to avoid overwriting the expected python version.

Closes #12589
This commit is contained in:
Carlo Sala 2024-08-01 20:07:55 +02:00
parent 2527959e79
commit 5c532a85cf
No known key found for this signature in database
GPG Key ID: DA6FB450C1A4FE9A
2 changed files with 5 additions and 1 deletions

View File

@ -2,7 +2,7 @@
This plugin looks for [pyenv](https://github.com/pyenv/pyenv), a Simple Python version This plugin looks for [pyenv](https://github.com/pyenv/pyenv), a Simple Python version
management system, and loads it if it's found. It also loads pyenv-virtualenv, a pyenv management system, and loads it if it's found. It also loads pyenv-virtualenv, a pyenv
plugin to manage virtualenv, if it's found. plugin to manage virtualenv, if it's found. If a venv is found pyenv won't load.
To use it, add `pyenv` to the plugins array in your zshrc file: To use it, add `pyenv` to the plugins array in your zshrc file:

View File

@ -1,3 +1,7 @@
# if there is a virtualenv already loaded pyenv should not be loaded
# see https://github.com/ohmyzsh/ohmyzsh/issues/12589
[[ -n ${VIRTUAL_ENV:-} ]] && return
pyenv_config_warning() { pyenv_config_warning() {
[[ "$ZSH_PYENV_QUIET" != true ]] || return 0 [[ "$ZSH_PYENV_QUIET" != true ]] || return 0