diff --git a/pyenv.d/rehash/conda.bash b/pyenv.d/rehash/conda.bash index 9b22dfb0..a45a9966 100644 --- a/pyenv.d/rehash/conda.bash +++ b/pyenv.d/rehash/conda.bash @@ -12,12 +12,14 @@ conda_exists() { } shims=() -for shim in $(cat "${BASH_SOURCE%/*}/conda.txt"); do - if [ -n "${shim%%#*}" ]; then +shopt -s nullglob +for shim in $(cat "${BASH_SOURCE%/*}/conda.d/"*".list" | sort | uniq | sed -e 's/#.*$//' | sed -e '/^[[:space:]]*$/d'); do + if [ -n "${shim##*/}" ]; then shims[${#shims[*]}]="${shim})return 0;;" fi done -eval "conda_shim(){ case \"\$1\" in ${shims[@]} *)return 1;;esac;}" +shopt -u nullglob +eval "conda_shim(){ case \"\${1##*/}\" in ${shims[@]} *)return 1;;esac;}" # override `make_shims` to avoid conflict between pyenv-virtualenv's `envs.bash` # https://github.com/pyenv/pyenv-virtualenv/blob/v20160716/etc/pyenv.d/rehash/envs.bash diff --git a/pyenv.d/rehash/conda.d/.gitignore b/pyenv.d/rehash/conda.d/.gitignore new file mode 100644 index 00000000..655d89c2 --- /dev/null +++ b/pyenv.d/rehash/conda.d/.gitignore @@ -0,0 +1,3 @@ +* +!/.gitignore +!/default.list diff --git a/pyenv.d/rehash/conda.txt b/pyenv.d/rehash/conda.d/default.list similarity index 100% rename from pyenv.d/rehash/conda.txt rename to pyenv.d/rehash/conda.d/default.list diff --git a/pyenv.d/rehash/source.bash b/pyenv.d/rehash/source.bash new file mode 100644 index 00000000..6bcbcbd7 --- /dev/null +++ b/pyenv.d/rehash/source.bash @@ -0,0 +1,31 @@ +PROTOTYPE_SOURCE_SHIM_PATH="${SHIM_PATH}/.pyenv-source-shim" + +shims=() +shopt -s nullglob +for shim in $(cat "${BASH_SOURCE%/*}/source.d/"*".list" | sort | uniq | sed -e 's/#.*$//' | sed -e '/^[[:space:]]*$/d'); do + if [ -n "${shim##*/}" ]; then + shims[${#shims[*]}]="${shim})return 0;;" + fi +done +shopt -u nullglob +eval "source_shim(){ case \"\${1##*/}\" in ${shims[@]} *)return 1;;esac;}" + +cat > "${PROTOTYPE_SOURCE_SHIM_PATH}" <