mirror of
https://github.com/pyenv/pyenv.git
synced 2026-09-10 07:36:16 -04:00
rename to _PYENV_INSTALL_PREFIX; cleanup
This commit is contained in:
parent
715c939abf
commit
c02421b51d
|
|
@ -76,27 +76,27 @@ export PYENV_DIR
|
|||
|
||||
shopt -s nullglob
|
||||
|
||||
PYENV_INSTALL_PATH="$(abs_dirname "$0")"
|
||||
PYENV_INSTALL_PATH="${PYENV_INSTALL_PATH%/*}"
|
||||
_PYENV_INSTALL_PREFIX="$(abs_dirname "$0")"
|
||||
_PYENV_INSTALL_PREFIX="${_PYENV_INSTALL_PREFIX%/*}"
|
||||
|
||||
export PYENV_INSTALL_PATH
|
||||
export _PYENV_INSTALL_PREFIX
|
||||
|
||||
for plugin_bin in "${PYENV_INSTALL_PATH}"/plugins/*/bin; do
|
||||
for plugin_bin in "${_PYENV_INSTALL_PREFIX}"/plugins/*/bin; do
|
||||
PATH="${plugin_bin}:${PATH}"
|
||||
done
|
||||
# PYENV_ROOT can be set to anything, so it may happen to be equal to the base path above,
|
||||
# resulting in duplicate PATH entries
|
||||
if [ "${PYENV_INSTALL_PATH}" != "$PYENV_ROOT" ]; then
|
||||
if [ "${_PYENV_INSTALL_PREFIX}" != "$PYENV_ROOT" ]; then
|
||||
for plugin_bin in "${PYENV_ROOT}"/plugins/*/bin; do
|
||||
PATH="${plugin_bin}:${PATH}"
|
||||
done
|
||||
fi
|
||||
export PATH="${PYENV_INSTALL_PATH}/libexec:${PATH}"
|
||||
export PATH="${_PYENV_INSTALL_PREFIX}/libexec:${PATH}"
|
||||
|
||||
PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:${PYENV_ROOT}/pyenv.d"
|
||||
if [ "${PYENV_INSTALL_PATH}" != "$PYENV_ROOT" ]; then
|
||||
if [ "${_PYENV_INSTALL_PREFIX}" != "$PYENV_ROOT" ]; then
|
||||
# Add pyenv's own `pyenv.d` unless pyenv was cloned to PYENV_ROOT
|
||||
PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:${PYENV_INSTALL_PATH}/pyenv.d"
|
||||
PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:${_PYENV_INSTALL_PREFIX}/pyenv.d"
|
||||
fi
|
||||
PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:/usr/etc/pyenv.d:/usr/local/etc/pyenv.d:/etc/pyenv.d:/usr/lib/pyenv/hooks"
|
||||
for plugin_hook in "${PYENV_ROOT}/plugins/"*/etc/pyenv.d; do
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ function print_env() {
|
|||
}
|
||||
|
||||
function print_completion() {
|
||||
completion="${PYENV_INSTALL_PATH}/completions/pyenv.${shell}"
|
||||
completion="${_PYENV_INSTALL_PREFIX}/completions/pyenv.${shell}"
|
||||
if [ -r "$completion" ]; then
|
||||
echo "source '$completion'"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -265,12 +265,12 @@ for DEFINITION in "${DEFINITIONS[@]}"; do
|
|||
echo "See all available versions with \`pyenv install --list'."
|
||||
echo
|
||||
echo -n "If the version you need is missing, try upgrading pyenv"
|
||||
if [ "${PYENV_INSTALL_PATH}" != "${PYENV_INSTALL_PATH#$(brew --prefix 2>/dev/null)}" ]; then
|
||||
if [[ command -v brew && "${_PYENV_INSTALL_PREFIX}" == "$(brew --prefix)/"* ]; then
|
||||
printf ":\n\n"
|
||||
echo " brew update && brew upgrade pyenv"
|
||||
elif [ -d "${PYENV_INSTALL_PATH}/.git" ]; then
|
||||
elif [ -d "${_PYENV_INSTALL_PREFIX}/.git" ]; then
|
||||
printf ":\n\n"
|
||||
echo " cd ${PYENV_INSTALL_PATH} && git pull && cd -"
|
||||
echo " cd ${_PYENV_INSTALL_PREFIX} && git pull && cd -"
|
||||
else
|
||||
printf ".\n"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ OUT
|
|||
stub_python_build "--definitions : echo 2.6.9 2.7.9-rc1 2.7.9-rc2 3.4.2 | tr ' ' $'\\n'"
|
||||
|
||||
mkdir "$BATS_TEST_TMPDIR/.git"
|
||||
PYENV_INSTALL_PATH="$BATS_TEST_TMPDIR" run pyenv-install 2.7.9
|
||||
_PYENV_INSTALL_PREFIX="$BATS_TEST_TMPDIR" run pyenv-install 2.7.9
|
||||
assert_failure
|
||||
assert_output <<OUT
|
||||
ERROR
|
||||
|
|
@ -166,7 +166,7 @@ OUT
|
|||
stub_python_build 'echo ERROR >&2 && exit 2' \
|
||||
"--definitions : true"
|
||||
|
||||
PYENV_INSTALL_PATH="$BATS_TEST_TMPDIR" run pyenv-install 1.9.3
|
||||
_PYENV_INSTALL_PREFIX="$BATS_TEST_TMPDIR" run pyenv-install 1.9.3
|
||||
assert_failure
|
||||
assert_output <<OUT
|
||||
ERROR
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
load test_helper
|
||||
|
||||
_setup() {
|
||||
export GIT_DIR="${HOME}/.git"
|
||||
mkdir -p "$HOME"
|
||||
git config --global user.name "Tester"
|
||||
git config --global user.email "tester@test.local"
|
||||
export GIT_DIR="${PYENV_TEST_DIR}/.git"
|
||||
mkdir -p "$GIT_DIR"
|
||||
git config user.name "Tester"
|
||||
git config user.email "tester@test.local"
|
||||
cd "$PYENV_TEST_DIR"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,10 +36,9 @@ create_executable() {
|
|||
}
|
||||
|
||||
@test "setup shell completions" {
|
||||
exec_root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
|
||||
PYENV_INSTALL_PATH="${exec_root}" run pyenv-init - bash
|
||||
run pyenv-init - bash
|
||||
assert_success
|
||||
assert_line "source '${exec_root}/completions/pyenv.bash'"
|
||||
assert_line "source '${_PYENV_INSTALL_PREFIX}/completions/pyenv.bash'"
|
||||
}
|
||||
|
||||
@test "detect parent shell" {
|
||||
|
|
@ -62,10 +61,9 @@ OUT
|
|||
}
|
||||
|
||||
@test "setup shell completions (fish)" {
|
||||
exec_root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
|
||||
PYENV_INSTALL_PATH="${exec_root}" run pyenv-init - fish
|
||||
run pyenv-init - fish
|
||||
assert_success
|
||||
assert_line "source '${exec_root}/completions/pyenv.fish'"
|
||||
assert_line "source '${_PYENV_INSTALL_PREFIX}/completions/pyenv.fish'"
|
||||
}
|
||||
|
||||
@test "fish instructions" {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ unset PYENV_VERSION
|
|||
unset PYENV_DIR
|
||||
|
||||
setup() {
|
||||
if ! enable -f "${BATS_TEST_DIRNAME}"/../libexec/pyenv-realpath.dylib realpath 2>/dev/null; then
|
||||
export _PYENV_INSTALL_PREFIX="${BATS_TEST_DIRNAME%/*}"
|
||||
if ! enable -f "${_PYENV_INSTALL_PREFIX}"/libexec/pyenv-realpath.dylib realpath 2>/dev/null; then
|
||||
if [ -n "$PYENV_NATIVE_EXT" ]; then
|
||||
echo "pyenv: failed to load \`realpath' builtin" >&2
|
||||
exit 1
|
||||
|
|
@ -19,13 +20,12 @@ setup() {
|
|||
export BATS_TEST_TMPDIR="${bats_test_tmpdir}"
|
||||
export PYENV_TEST_DIR="${BATS_TEST_TMPDIR}/pyenv"
|
||||
export PYENV_ROOT="${PYENV_TEST_DIR}/root"
|
||||
export PYENV_INSTALL_PATH="${PYENV_TEST_DIR}"
|
||||
export HOME="${PYENV_TEST_DIR}/home"
|
||||
export PYENV_HOOK_PATH="${PYENV_ROOT}/pyenv.d"
|
||||
|
||||
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
|
||||
PATH="${PYENV_TEST_DIR}/bin:$PATH"
|
||||
PATH="${BATS_TEST_DIRNAME%/*}/libexec:$PATH"
|
||||
PATH="${_PYENV_INSTALL_PREFIX}/libexec:$PATH"
|
||||
PATH="${BATS_TEST_DIRNAME}/libexec:$PATH"
|
||||
PATH="${PYENV_ROOT}/shims:$PATH"
|
||||
export PATH
|
||||
|
|
|
|||
Loading…
Reference in a new issue