
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
50 lines
1.9 KiB
YAML
50 lines
1.9 KiB
YAML
- name: Include OS-specific variables
|
|
include_vars: "{{ zj_distro_os }}"
|
|
loop_control:
|
|
loop_var: zj_distro_os
|
|
with_first_found:
|
|
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml"
|
|
- "{{ ansible_distribution }}.{{ ansible_architecture }}.yaml"
|
|
- "{{ ansible_distribution }}.yaml"
|
|
- "{{ ansible_os_family }}.yaml"
|
|
|
|
- name: Put .python-version contents into variable
|
|
when:
|
|
- python_version is not defined
|
|
set_fact:
|
|
python_version: "{{ lookup('ansible.builtin.file', zuul.executor.work_root ~ '/' ~ zuul.project.src_dir ~ '/.python-version') }}"
|
|
|
|
- name: Install python build depends
|
|
become: true
|
|
package:
|
|
name: "{{ python_build_depends }}"
|
|
|
|
- name: Clone pyenv repo
|
|
git:
|
|
repo: https://github.com/pyenv/pyenv.git
|
|
dest: "{{ ansible_user_dir }}/.pyenv"
|
|
version: master
|
|
|
|
# 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 }} | grep -v t$ | tail -1
|
|
args:
|
|
executable: /bin/bash
|
|
register: _python_version
|
|
|
|
# NOTE(mnaser): We install Python globally in the system, as that's somewhat
|
|
# similar to behaviour of installing a Python package. It also
|
|
# avoids us having to mess around $PATH.
|
|
- name: Install python
|
|
become: true
|
|
command: "{{ ansible_user_dir }}/.pyenv/plugins/python-build/bin/python-build {{ _python_version.stdout }} /usr/local"
|
|
environment:
|
|
CFLAGS: -O2
|