From e748c14db8e1f5f42ef1281259f8bcea36c06d57 Mon Sep 17 00:00:00 2001 From: "Yamashita, Yuu" Date: Tue, 10 May 2016 04:21:53 +0000 Subject: [PATCH 1/2] Skip creating shims for system executables bundled with Anaconda (fixes #594, #599) With this, we'd be able to remove a hook script for `pyenv which` eventually. --- pyenv.d/rehash/anaconda.bash | 123 +++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 pyenv.d/rehash/anaconda.bash diff --git a/pyenv.d/rehash/anaconda.bash b/pyenv.d/rehash/anaconda.bash new file mode 100644 index 00000000..dc1472a6 --- /dev/null +++ b/pyenv.d/rehash/anaconda.bash @@ -0,0 +1,123 @@ +# Anaconda comes with binaries of system packages (e.g. `openssl`, `curl`). +# Creating shims for those binaries will prevent pyenv users to run those +# commands normally when not using Anaconda. +# +# This hooks is intended to skip creating shims for those executables. + +conda_exists() { + shopt -s nullglob + local condas=($(echo "${PYENV_ROOT}/versions/"*"/bin/conda" "${PYENV_ROOT}/versions/"*"/envs/"*"/bin/conda")) + shopt -u nullglob + [ -n "${condas}" ] +} + +conda_shims() { + ## curl + cat < Date: Thu, 19 May 2016 00:14:22 +0000 Subject: [PATCH 2/2] Remove `which` hook for Anaconda in favor of `rehash` hook --- pyenv.d/which/anaconda.bash | 170 ------------------------------------ 1 file changed, 170 deletions(-) delete mode 100644 pyenv.d/which/anaconda.bash diff --git a/pyenv.d/which/anaconda.bash b/pyenv.d/which/anaconda.bash deleted file mode 100644 index 2ca579ac..00000000 --- a/pyenv.d/which/anaconda.bash +++ /dev/null @@ -1,170 +0,0 @@ -# Anaconda comes with binaries of system packages (e.g. `openssl`, `curl`). -# Creating shims for those binaries will prevent pyenv users to run those -# commands normally when not using Anaconda. -# -# This is a limited edition of https://github.com/yyuu/pyenv-which-ext -# and it will looks for original `PATH` if there is Anaconda/Miniconda -# installed and the command name is blacklisted. - -conda_exists() { - shopt -s nullglob - local condas=($(echo "${PYENV_ROOT}/versions/"*"/bin/conda" "${PYENV_ROOT}/versions/"*"/envs/"*"/bin/conda")) - shopt -u nullglob - [ -n "${condas}" ] -} - -conda_shims() { - ## curl - cat </dev/null || true)" ]; then - PYENV_COMMAND_PATH="$(lookup_from_path "$PYENV_COMMAND" || true)" - fi - fi - else - if conda_shims | grep -q -x "$PYENV_COMMAND"; then - PYENV_COMMAND_PATH="$(lookup_from_path "$PYENV_COMMAND" || true)" - fi - fi - fi -fi