From bcdc61bdf8f45242f5ff800ecce3a4dab506c170 Mon Sep 17 00:00:00 2001 From: macayu17 Date: Sat, 25 Jul 2026 23:40:12 +0530 Subject: [PATCH] pyenv-binary: include plugin definitions in build completion --- plugins/pyenv-binary/libexec/pyenv-binary-build | 10 +++++++++- plugins/pyenv-binary/test/build.bats | 12 ++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/plugins/pyenv-binary/libexec/pyenv-binary-build b/plugins/pyenv-binary/libexec/pyenv-binary-build index 3a0606d0..95093e7f 100755 --- a/plugins/pyenv-binary/libexec/pyenv-binary-build +++ b/plugins/pyenv-binary/libexec/pyenv-binary-build @@ -21,8 +21,16 @@ set -e [ -n "$PYENV_DEBUG" ] && set -x # Provide pyenv completions. Only the definitions are useful here: the options -# `pyenv install' takes are not accepted. +# `pyenv install' takes are not accepted. Include definitions from other +# plugins just as `pyenv install' does. if [ "$1" = "--complete" ]; then + shopt -s nullglob + for plugin_path in "$PYENV_ROOT"/plugins/*/share/python-build; do + PYTHON_BUILD_DEFINITIONS="${PYTHON_BUILD_DEFINITIONS}:${plugin_path}" + done + export PYTHON_BUILD_DEFINITIONS + shopt -u nullglob + echo --archive-url exec python-build --definitions fi diff --git a/plugins/pyenv-binary/test/build.bats b/plugins/pyenv-binary/test/build.bats index aa216da7..a862a840 100644 --- a/plugins/pyenv-binary/test/build.bats +++ b/plugins/pyenv-binary/test/build.bats @@ -11,11 +11,15 @@ stub_build_environment() { create_stub getconf 'echo "glibc 2.17"' } -@test "completion lists the option and the buildable versions" { - create_stub python-build 'echo 3.12.7' +@test "completion lists definitions provided by another plugin" { + mkdir -p "${PYENV_ROOT}/plugins/example/share/python-build" + touch "${PYENV_ROOT}/plugins/example/share/python-build/3.12.7-example" + PATH="${BATS_TEST_DIRNAME}/../../python-build/bin:${PATH}" + run pyenv-binary-build --complete - assert_success "--archive-url -3.12.7" + assert_success + assert_line "--archive-url" + assert_line "3.12.7-example" } @test "fails with no arguments" {