mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-08 11:33:55 -05:00
pyenv-virtualenvs could not list conda environments & pyenv shell would only activate the base conda environment the conda detection criteria of testing the presence of `conda` or `activate` files under `$(pyenv root)/versions/$version/bin` appears to be the culprit, since newer environments no longer include these files: those files reside in the base conda environment - add detection criteria of `$(pyenv root)/versions/$version/conda-meta` - compute the real prefix to the base environment from `realpath $(realpath $(pyenv root)/versions/$version)/../..` - to allow that, enhance substitute `realpath` in `pyenv-virtualenvs` to reduce relative paths `.` & `..`, and factor that code out to a file under `libexec` for reuse - hook `which` to locate conda from the real prefix
12 lines
468 B
Bash
12 lines
468 B
Bash
# newer versions of conda share programs from the real prefix
|
|
# this hook tries to find the executable there
|
|
|
|
if [ ! -x "${PYENV_COMMAND_PATH}" ] && [[ "${PYENV_COMMAND_PATH##*/}" == "conda" ]]; then
|
|
if [ -d "${PYENV_ROOT}/versions/${version}/conda-meta" ]; then
|
|
conda_command_path="$(pyenv-virtualenv-prefix "$version")"/bin/"${PYENV_COMMAND_PATH##*/}"
|
|
if [ -x "${conda_command_path}" ]; then
|
|
PYENV_COMMAND_PATH="${conda_command_path}"
|
|
fi
|
|
fi
|
|
fi
|