mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
This commit is contained in:
parent
0314de0c73
commit
52d6acc3b0
2 changed files with 31 additions and 0 deletions
30
pyenv.d/rehash/source.bash
Normal file
30
pyenv.d/rehash/source.bash
Normal file
|
@ -0,0 +1,30 @@
|
|||
PROTOTYPE_SOURCE_SHIM_PATH="${SHIM_PATH}/.pyenv-source-shim"
|
||||
|
||||
shims=()
|
||||
for shim in $(cat "${BASH_SOURCE%/*}/source.txt"); do
|
||||
if [ -n "${shim%%#*}" ]; then
|
||||
shims[${#shims[*]}]="${shim})return 0;;"
|
||||
fi
|
||||
done
|
||||
eval "source_shim(){ case \"\$1\" in ${shims[@]} *)return 1;;esac;}"
|
||||
|
||||
cat > "${PROTOTYPE_SOURCE_SHIM_PATH}" <<SH
|
||||
#!/usr/bin/env bash
|
||||
[ -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}"
|
1
pyenv.d/rehash/source.txt
Normal file
1
pyenv.d/rehash/source.txt
Normal file
|
@ -0,0 +1 @@
|
|||
gettext.sh
|
Loading…
Reference in a new issue