support newer conda

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
This commit is contained in:
Luis Marsano
2018-11-11 05:25:08 -05:00
parent 8c9f7fa766
commit e0a1e9b35c
6 changed files with 83 additions and 41 deletions

View File

@@ -59,7 +59,8 @@ if [ -n "$PYENV_VIRTUALENV_VERBOSE_ACTIVATE" ]; then
fi
# conda package anaconda/miniconda scripts (#173)
if [ -x "${prefix}/bin/conda" ]; then
if [ -d "${prefix}/conda-meta" ] ||
[ -x "${prefix}/bin/conda" ]; then
shopt -s nullglob
case "${shell}" in
fish )