1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-15 23:03:53 -05:00

Merge remote-tracking branch 'rbenv/master' into rbenv-20151121

This commit is contained in:
Yamashita, Yuu
2015-11-21 04:13:52 +00:00
24 changed files with 309 additions and 111 deletions

View File

@@ -1,18 +1,20 @@
unset PYENV_VERSION
unset PYENV_DIR
if enable -f "${BATS_TEST_DIRNAME}"/../libexec/pyenv-realpath.dylib realpath 2>/dev/null; then
PYENV_TEST_DIR="$(realpath "$BATS_TMPDIR")/pyenv"
else
if [ -n "$PYENV_NATIVE_EXT" ]; then
echo "pyenv: failed to load \`realpath' builtin" >&2
exit 1
fi
PYENV_TEST_DIR="${BATS_TMPDIR}/pyenv"
fi
# guard against executing this block twice due to bats internals
if [ "$PYENV_ROOT" != "${PYENV_TEST_DIR}/root" ]; then
if [ -z "$PYENV_TEST_DIR" ]; then
PYENV_TEST_DIR="${BATS_TMPDIR}/pyenv"
export PYENV_TEST_DIR="$(mktemp -d "${PYENV_TEST_DIR}.XXX" 2>/dev/null || echo "$PYENV_TEST_DIR")"
if enable -f "${BATS_TEST_DIRNAME}"/../libexec/pyenv-realpath.dylib realpath 2>/dev/null; then
export PYENV_TEST_DIR="$(realpath "$PYENV_TEST_DIR")"
else
if [ -n "$PYENV_NATIVE_EXT" ]; then
echo "pyenv: failed to load \`realpath' builtin" >&2
exit 1
fi
fi
export PYENV_ROOT="${PYENV_TEST_DIR}/root"
export HOME="${PYENV_TEST_DIR}/home"
@@ -22,6 +24,9 @@ if [ "$PYENV_ROOT" != "${PYENV_TEST_DIR}/root" ]; then
PATH="${BATS_TEST_DIRNAME}/libexec:$PATH"
PATH="${PYENV_ROOT}/shims:$PATH"
export PATH
for xdg_var in `env 2>/dev/null | grep ^XDG_ | cut -d= -f1`; do unset "$xdg_var"; done
unset xdg_var
fi
teardown() {
@@ -106,7 +111,7 @@ assert() {
# but in which system utils necessary for pyenv operation are still available.
path_without() {
local exe="$1"
local path="${PATH}:"
local path=":${PATH}:"
local found alt util
for found in $(which -a "$exe"); do
found="${found%/*}"
@@ -118,8 +123,9 @@ path_without() {
ln -s "${found}/$util" "${alt}/$util"
fi
done
path="${path/${found}:/${alt}:}"
path="${path/:${found}:/:${alt}:}"
fi
done
path="${path#:}"
echo "${path%:}"
}