From 0dc2c9466ddbbe468b7a639af7dab8df7118b0e6 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Mon, 18 Dec 2017 12:19:16 -0600 Subject: [PATCH] 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 --- roles/ensure-sphinx/tasks/main.yaml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/roles/ensure-sphinx/tasks/main.yaml b/roles/ensure-sphinx/tasks/main.yaml index 422c20e80..2a8f7da58 100644 --- a/roles/ensure-sphinx/tasks/main.yaml +++ b/roles/ensure-sphinx/tasks/main.yaml @@ -23,19 +23,10 @@ break fi done - failed_when: "'requirements.txt' not in requirements_file.stdout" register: requirements_file # TODO(dmsimard) Don't assume virtualenv is installed -- name: Initialize virtual environment - pip: - requirements: "{{ requirements_file.stdout }}" - chdir: "{{ zuul_work_dir }}" - virtualenv: "{{ zuul_work_virtualenv }}" - virtualenv_python: "{{ sphinx_python }}" - extra_args: "{{ upper_constraints | default(omit) }}" - -- name: Install doc building packages +- name: Install base doc building packages pip: name: "{{ item }}" chdir: "{{ zuul_work_dir }}" @@ -43,3 +34,13 @@ 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