Ian Wienand e3b7e0dcf6 ensure-sphinx: upgrade pip
Change I98c3da5b02a4ac7fb9d7bd8e00170762e77b9f40 caused a regression,
because previously virtualenv would be pulling the latest pip, whereas
"pip -m venv" is using the system-vendored pip, which is older.

Upgrade pip to the latest in the sphinx environment to maintain the
status-quo.

Change-Id: I1004c2727379f73eafc8b32a3e14842200ad342c
2022-02-09 11:44:06 +11:00

68 lines
2.2 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 in the sphinx venv, not the system
# one. Older pips don't do things like parse version constraints or
# rust build flags correctly, 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
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