From b95cfa4ad7bd8083d037104310f766074ec73246 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Fri, 24 Jan 2025 17:04:40 +0000 Subject: [PATCH] ensure-python: Skip "t" versions in pyenv The recent addition of "t" version variants in CPython 3.13 has broken the ability of jobs to assume a normal executable name. Change-Id: Ia27bdd4e122980f65c1bb9fc28fedf43c48a5a4e --- roles/ensure-python/README.rst | 6 ++++-- roles/ensure-python/tasks/pyenv.yaml | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/roles/ensure-python/README.rst b/roles/ensure-python/README.rst index 9b568d520..e06110e71 100644 --- a/roles/ensure-python/README.rst +++ b/roles/ensure-python/README.rst @@ -25,8 +25,10 @@ There are three ways to install the python interpreter: :type: str Optional version of python interpreter to install, such as ``3.7``. - Note that you should use a string value for this variable rather than - a float. This avoids problems with 3.10 being evaluated as 3.1. + Note that you should use a string value for this variable rather than a + 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 :type: bool diff --git a/roles/ensure-python/tasks/pyenv.yaml b/roles/ensure-python/tasks/pyenv.yaml index 3e8008533..ab131ab80 100644 --- a/roles/ensure-python/tasks/pyenv.yaml +++ b/roles/ensure-python/tasks/pyenv.yaml @@ -28,10 +28,13 @@ # 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 # 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 shell: | 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: executable: /bin/bash register: _python_version