mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Revert version auto-resolution in python-build
It was moved to `pyenv-install`
This commit is contained in:
parent
a12f947cc3
commit
75022d5d7c
2 changed files with 5 additions and 37 deletions
|
@ -2067,25 +2067,12 @@ DEFINITION_PATH="${ARGUMENTS[0]}"
|
||||||
if [ -z "$DEFINITION_PATH" ]; then
|
if [ -z "$DEFINITION_PATH" ]; then
|
||||||
usage 1 >&2
|
usage 1 >&2
|
||||||
elif [ ! -f "$DEFINITION_PATH" ]; then
|
elif [ ! -f "$DEFINITION_PATH" ]; then
|
||||||
|
|
||||||
search_definitions() {
|
|
||||||
for DEFINITION_DIR in "${PYTHON_BUILD_DEFINITIONS[@]}"; do
|
for DEFINITION_DIR in "${PYTHON_BUILD_DEFINITIONS[@]}"; do
|
||||||
if [ -f "${DEFINITION_DIR}/${DEFINITION_PATH}" ]; then
|
if [ -f "${DEFINITION_DIR}/${DEFINITION_PATH}" ]; then
|
||||||
DEFINITION_PATH="${DEFINITION_DIR}/${DEFINITION_PATH}"
|
DEFINITION_PATH="${DEFINITION_DIR}/${DEFINITION_PATH}"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
|
||||||
|
|
||||||
search_definitions
|
|
||||||
if [ ! -f "$DEFINITION_PATH" ]; then
|
|
||||||
if RESOLVED_DEFINITION_PATH="$(command -v pyenv-latest >/dev/null && pyenv-latest -k -q "$DEFINITION_PATH")"; then
|
|
||||||
DEFINITION_PATH="$RESOLVED_DEFINITION_PATH"
|
|
||||||
unset RESOLVED_DEFINITION_PATH
|
|
||||||
search_definitions
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
unset search_definitions
|
|
||||||
|
|
||||||
if [ ! -f "$DEFINITION_PATH" ]; then
|
if [ ! -f "$DEFINITION_PATH" ]; then
|
||||||
echo "python-build: definition not found: ${DEFINITION_PATH}" >&2
|
echo "python-build: definition not found: ${DEFINITION_PATH}" >&2
|
||||||
|
|
|
@ -60,30 +60,11 @@ NUM_DEFINITIONS="$(find "$BATS_TEST_DIRNAME"/../share/python-build -maxdepth 1 -
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "installing nonexistent definition" {
|
@test "installing nonexistent definition" {
|
||||||
stub pyenv-latest false
|
|
||||||
run python-build "nonexistent" "${TMP}/install"
|
run python-build "nonexistent" "${TMP}/install"
|
||||||
assert [ "$status" -eq 2 ]
|
assert [ "$status" -eq 2 ]
|
||||||
assert_output "python-build: definition not found: nonexistent"
|
assert_output "python-build: definition not found: nonexistent"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "resolves prefixes via pyenv-latest" {
|
|
||||||
stub pyenv-latest "echo 2.7.8"
|
|
||||||
export PYTHON_BUILD_ROOT="$TMP"
|
|
||||||
mkdir -p "${PYTHON_BUILD_ROOT}/share/python-build"
|
|
||||||
echo 'echo 2.7.8' > "${PYTHON_BUILD_ROOT}/share/python-build/2.7.8"
|
|
||||||
run python-build "2.7" "${TMP}/install"
|
|
||||||
assert_success "2.7.8"
|
|
||||||
}
|
|
||||||
|
|
||||||
@test "doesn't resolve prefixes if pyenv-latest is unavailable" {
|
|
||||||
export PATH="$(path_without pyenv-latest)"
|
|
||||||
export PYTHON_BUILD_ROOT="$TMP"
|
|
||||||
mkdir -p "${PYTHON_BUILD_ROOT}/share/python-build"
|
|
||||||
echo 'echo 2.7.8' > "${PYTHON_BUILD_ROOT}/share/python-build/2.7.8"
|
|
||||||
run python-build "2.7" "${TMP}/install"
|
|
||||||
assert_failure "python-build: definition not found: 2.7"
|
|
||||||
}
|
|
||||||
|
|
||||||
@test "sorting Python versions" {
|
@test "sorting Python versions" {
|
||||||
export PYTHON_BUILD_ROOT="$TMP"
|
export PYTHON_BUILD_ROOT="$TMP"
|
||||||
mkdir -p "${PYTHON_BUILD_ROOT}/share/python-build"
|
mkdir -p "${PYTHON_BUILD_ROOT}/share/python-build"
|
||||||
|
|
Loading…
Reference in a new issue