Merge "ensure-python: Skip "t" versions in pyenv"

This commit is contained in:
Zuul 2025-04-02 10:32:11 +00:00 committed by Gerrit Code Review
commit 9708ed452e
2 changed files with 8 additions and 3 deletions

View File

@ -25,8 +25,10 @@ There are three ways to install the python interpreter:
:type: str :type: str
Optional version of python interpreter to install, such as ``3.7``. Optional version of python interpreter to install, such as ``3.7``.
Note that you should use a string value for this variable rather than Note that you should use a string value for this variable rather than a
a float. This avoids problems with 3.10 being evaluated as 3.1. float. This avoids problems with 3.10 being evaluated as 3.1. With the
pyenv backend it's not currently possible to select special-purpose
builds like the free-threading (no-GIL) variants.
.. zuul:rolevar:: python_use_pyenv .. zuul:rolevar:: python_use_pyenv
:type: bool :type: bool

View File

@ -28,10 +28,13 @@
# NOTE(mnaser): python-build does not allow us to let it install Python from a specific # NOTE(mnaser): python-build does not allow us to let it install Python from a specific
# series so we have to do some magic to find out what's the latest # series so we have to do some magic to find out what's the latest
# release from a series # release from a series
# NOTE(fungi): due to https://github.com/pyenv/pyenv/issues/3015 we need to
# filter out no-GIL/free-threading "t" suffixed versions, since
# they don't provide the expected vanilla executables
- name: Determine Python version - name: Determine Python version
shell: | shell: |
set -o pipefail set -o pipefail
{{ ansible_user_dir }}/.pyenv/plugins/python-build/bin/python-build --definitions | grep ^{{ python_version }} | tail -1 {{ ansible_user_dir }}/.pyenv/plugins/python-build/bin/python-build --definitions | grep ^{{ python_version }} | grep -v t$ | tail -1
args: args:
executable: /bin/bash executable: /bin/bash
register: _python_version register: _python_version