zuul-jobs/roles/ensure-sphinx/tasks/main.yaml
Kevin Carter 167cc321f4 Update the sphinx python package sets
The role will now use a known functional set of packages based on the
version of python being defined.

To allow users to add packages to a known functional version of
sphinx the variable `doc_building_extra_packages` has been added.
This option will union with `doc_building_packages`, installing all
python packages in a single set.

The releasenotes pre playbook has been updated so that it no longer
overrides the default package set when calling the "ensure-sphinx"
role. The playbook will now use the `doc_building_extra_packages`
option and include only the additional packages it needs. This change
allows folks to rely on the role to setup sphinx correctly without
needing to overriding everything.

Change-Id: Ib3d2fda164b173c82f17fabc20814753bfeaec6e
Signed-off-by: Kevin Carter <kecarter@redhat.com>
2019-07-08 07:48:31 -07:00

59 lines
1.8 KiB
YAML

---
# 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"
ignore_errors: yes
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 if it exists or fallback to
# test-requirements.txt.
- name: Get requirements files
shell:
executable: /bin/bash
chdir: "{{ zuul_work_dir }}"
cmd: |
for f in doc/requirements.txt test-requirements.txt ; do
if [ -f $f ] ; then
echo $f
break
fi
done
register: requirements_file
- name: Gather python version variables
include_vars: "{{ sphinx_python.split('.')[0] }}.yaml"
# TODO(dmsimard) Don't assume virtualenv is installed
- 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_python: "{{ sphinx_python }}"
extra_args: "{{ upper_constraints | default(omit) }}"
# TODO(dmsimard) Don't assume virtualenv is installed
- name: Install found doc requirements
pip:
requirements: "{{ requirements_file.stdout }}"
chdir: "{{ zuul_work_dir }}"
virtualenv: "{{ zuul_work_virtualenv }}"
virtualenv_python: "{{ sphinx_python }}"
extra_args: "{{ upper_constraints | default(omit) }}"
when: requirements_file.stdout_lines