activate "root" environment of anaconda/miniconda if environment name is not given

This commit is contained in:
Yamashita, Yuu
2015-07-19 04:19:05 +09:00
parent 25395f0331
commit cdbf7c9972
6 changed files with 34 additions and 37 deletions

View File

@@ -33,23 +33,16 @@ prefix="${PYENV_ACTIVATE:-${VIRTUAL_ENV}}"
unset conda_env
if [ -f "${prefix}/bin/conda" ]; then
if [[ "${prefix}" != "${prefix%/envs/*}" ]]; then
case "$shell" in
bash )
conda_env="${prefix##*/envs/}"
;;
zsh )
conda_env="${prefix##*/envs/}"
;;
* )
echo "false"
exit 1
;;
esac
else
if [[ "$shell" != "bash" ]] && [[ "$shell" != "zsh" ]]; then
[ -n "$NOERROR" ] || echo "pyenv-virtualenv: Only bash and zsh are supported by Anaconda/Miniconda" 1>&2
echo "false"
exit 1
fi
if [[ "${prefix}" != "${prefix%/envs/*}" ]]; then
conda_env="${prefix##*/envs/}"
else
conda_env="root"
fi
fi
if [ -n "${conda_env}" ]; then