zuul-jobs/roles/ensure-sphinx/tasks/main.yaml
Monty Taylor 0dc2c9466d
Deal with lack of requirements file better
For projects that only need sphinx and no other actual depenedencies,
there's no real value in failing if we don't find a doc requirements
file. We know all things using ensure-sphinx will, in fact, need sphinx.
Past that, it's entirely reasonable for someone to have no other needs.

Change-Id: I07dfa12f4aceee50a2f2c000df937dcbb09dd557
2017-12-18 12:25:03 -06:00

47 lines
1.4 KiB
YAML

# TODO(mordred) Make this a list of known binary depends that sphinx needs
- name: Install gettext package
package:
name: gettext
state: present
become: yes
- 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
# TODO(dmsimard) Don't assume virtualenv is installed
- name: Install base doc building packages
pip:
name: "{{ item }}"
chdir: "{{ zuul_work_dir }}"
virtualenv: "{{ zuul_work_virtualenv }}"
virtualenv_python: "{{ sphinx_python }}"
extra_args: "{{ upper_constraints | default(omit) }}"
with_items: "{{ doc_building_packages }}"
# 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