2017-07-19 21:25:12 -04:00
|
|
|
PROTOTYPE_SOURCE_SHIM_PATH="${SHIM_PATH}/.pyenv-source-shim"
|
|
|
|
|
|
|
|
shims=()
|
2017-07-20 20:43:23 -04:00
|
|
|
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
|
2017-07-19 21:25:12 -04:00
|
|
|
shims[${#shims[*]}]="${shim})return 0;;"
|
|
|
|
fi
|
|
|
|
done
|
2017-07-20 20:43:23 -04:00
|
|
|
shopt -u nullglob
|
2017-07-20 20:55:11 -04:00
|
|
|
eval "source_shim(){ case \"\${1##*/}\" in ${shims[@]} *)return 1;;esac;}"
|
2017-07-19 21:25:12 -04:00
|
|
|
|
|
|
|
cat > "${PROTOTYPE_SOURCE_SHIM_PATH}" <<SH
|
|
|
|
[ -n "\$PYENV_DEBUG" ] && set -x
|
|
|
|
export PYENV_ROOT="${PYENV_ROOT}"
|
|
|
|
program="\$("$(command -v pyenv)" which "\${BASH_SOURCE##*/}")"
|
|
|
|
if [ -e "\${program}" ]; then
|
|
|
|
. "\${program}" "\$@"
|
|
|
|
fi
|
|
|
|
SH
|
|
|
|
chmod +x "${PROTOTYPE_SOURCE_SHIM_PATH}"
|
|
|
|
|
|
|
|
shopt -s nullglob
|
|
|
|
for shim in "${SHIM_PATH}/"*; do
|
|
|
|
if source_shim "${shim}"; then
|
|
|
|
cp "${PROTOTYPE_SOURCE_SHIM_PATH}" "${shim}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
shopt -u nullglob
|
|
|
|
|
|
|
|
rm -f "${PROTOTYPE_SOURCE_SHIM_PATH}"
|