exits as error if the virtual environment doesn't have python executable (#104)

conda's environment might not have `python` executable. If the prefix
doesn't contain `python` in it, `pyenv-which` might be ran into infinite
loop if some of `which` hooks invoke `pyenv-virtualenv-prefix`.
This commit is contained in:
Yamashita, Yuu
2015-11-26 10:30:13 +00:00
parent 353062df09
commit 1edff311d5
3 changed files with 29 additions and 10 deletions

View File

@@ -123,12 +123,16 @@ create_conda() {
mkdir -p "${PYENV_ROOT}/versions/$version/bin"
touch "${PYENV_ROOT}/versions/$version/bin/activate"
touch "${PYENV_ROOT}/versions/$version/bin/conda"
touch "${PYENV_ROOT}/versions/$version/bin/python"
chmod +x "${PYENV_ROOT}/versions/$version/bin/conda"
chmod +x "${PYENV_ROOT}/versions/$version/bin/python"
local conda_env
for conda_env; do
mkdir -p "${PYENV_ROOT}/versions/$version/envs/$conda_env/bin"
touch "${PYENV_ROOT}/versions/$version/envs/$conda_env/bin/activate"
touch "${PYENV_ROOT}/versions/$version/envs/$conda_env/bin/conda"
touch "${PYENV_ROOT}/versions/$version/envs/$conda_env/bin/python"
chmod +x "${PYENV_ROOT}/versions/$version/envs/$conda_env/bin/conda"
chmod +x "${PYENV_ROOT}/versions/$version/envs/$conda_env/bin/python"
done
}