diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index eca00319..0b29c4e5 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -2067,25 +2067,12 @@ DEFINITION_PATH="${ARGUMENTS[0]}" if [ -z "$DEFINITION_PATH" ]; then usage 1 >&2 elif [ ! -f "$DEFINITION_PATH" ]; then - - search_definitions() { - for DEFINITION_DIR in "${PYTHON_BUILD_DEFINITIONS[@]}"; do - if [ -f "${DEFINITION_DIR}/${DEFINITION_PATH}" ]; then - DEFINITION_PATH="${DEFINITION_DIR}/${DEFINITION_PATH}" - break - fi - 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 + for DEFINITION_DIR in "${PYTHON_BUILD_DEFINITIONS[@]}"; do + if [ -f "${DEFINITION_DIR}/${DEFINITION_PATH}" ]; then + DEFINITION_PATH="${DEFINITION_DIR}/${DEFINITION_PATH}" + break fi - fi - unset search_definitions + done if [ ! -f "$DEFINITION_PATH" ]; then echo "python-build: definition not found: ${DEFINITION_PATH}" >&2 diff --git a/plugins/python-build/test/definitions.bats b/plugins/python-build/test/definitions.bats index 61d318bf..4f9e32a1 100644 --- a/plugins/python-build/test/definitions.bats +++ b/plugins/python-build/test/definitions.bats @@ -60,30 +60,11 @@ NUM_DEFINITIONS="$(find "$BATS_TEST_DIRNAME"/../share/python-build -maxdepth 1 - } @test "installing nonexistent definition" { - stub pyenv-latest false run python-build "nonexistent" "${TMP}/install" assert [ "$status" -eq 2 ] 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" { export PYTHON_BUILD_ROOT="$TMP" mkdir -p "${PYTHON_BUILD_ROOT}/share/python-build"