zuul-jobs/roles/ensure-sphinx/tasks/main.yaml
yatinkarel 82d321c6fd ensure-sphix: upgrade setuptools in venv
With [1] pip was ensured to be latest, but for
cases like ubuntu bionic which has too old
setuptools(39.0.1) and that doesn't support version
from file, the support only available with
setuptools-39.2.0[2].

This patch proposes to upgrade setuptools
along with pip to support dependencies which
set's version in a file. Other option is to
pass option --use-deprecated legacy-resolver
to pip install or downgrade pip to working version.

This will resolve issue with translation jobs
in neutron which fails during installation of
pyroute2[3].

[1] https://review.opendev.org/c/zuul/zuul-jobs/+/828441
[2] https://github.com/pypa/setuptools/pull/1359/commits/a960ee1c3
[3] https://zuul.openstack.org/builds?job_name=propose-translation-update&project=openstack%2Fneutron

Change-Id: I23475a48fa9cc924962f2f4b5edc7aeb5dd6261c
2022-04-13 20:35:46 +05:30

71 lines
2.3 KiB
YAML

- name: Install pip
include_role:
name: ensure-pip
# NOTE: gettext command is provided by gettext-base package,
# so we need to check a command provided by gettext package.
- name: Check for gettext installed
command: bash -c "type msgmerge"
failed_when: false
register: gettext_exists
# TODO(mordred) Make this a list of known binary depends that sphinx needs
- name: Install gettext package
package:
name: gettext
state: present
become: yes
when: gettext_exists.rc != 0
- name: Find Constraints File
include_role:
name: find-constraints
# We're not using with_first_found because the files are remote, not local.
# We want to use doc/requirements.txt or releasenotes/requirements.txt
# if it exists else we want to fallback to test-requirements.txt.
- name: Get requirements files
shell:
executable: /bin/bash
chdir: "{{ zuul_work_dir }}"
cmd: |
for f in doc/requirements.txt releasenotes/requirements.txt test-requirements.txt ; do
if [ -f $f ] ; then
echo $f
break
fi
done
register: requirements_file
# Ensure we have the latest pip and setuptools in the sphinx venv, not the system
# one. Older pips don't do things like parse version constraints or
# rust build flags correctly, setuptools<39.2.0 do not support reading version
# from file and some jobs like the translate jobs
# use this environment to install from master requirements.txt that
# needs this sort of thing to work.
- name: Setup virtual environment
pip:
name:
- pip
- setuptools
virtualenv: '{{ zuul_work_virtualenv }}'
virtualenv_command: '{{ ensure_pip_virtualenv_command }}'
extra_args: '--upgrade'
- name: Install base doc building packages
pip:
name: "{{ doc_building_packages | union(doc_building_extra_packages) }}"
chdir: "{{ zuul_work_dir }}"
virtualenv: "{{ zuul_work_virtualenv }}"
virtualenv_command: "{{ ensure_pip_virtualenv_command }}"
extra_args: "{{ upper_constraints | default(omit) }}"
- name: Install found doc requirements
pip:
requirements: "{{ requirements_file.stdout }}"
chdir: "{{ zuul_work_dir }}"
virtualenv: "{{ zuul_work_virtualenv }}"
virtualenv_command: "{{ ensure_pip_virtualenv_command }}"
extra_args: "{{ upper_constraints | default(omit) }}"
when: requirements_file.stdout_lines