Merge "Revert "Add sphinx_python variable to sphinx role and job""
This commit is contained in:
commit
23c9fde929
@ -16,11 +16,6 @@ All pip installs are done with a provided constraints file, if given.
|
||||
|
||||
List of python packages to install for building docs.
|
||||
|
||||
.. zuul:rolevar:: sphinx_python
|
||||
:default: python2
|
||||
|
||||
Version of python to use, either ``python2`` or ``python3``.
|
||||
|
||||
.. zuul:rolevar:: zuul_work_virtualenv
|
||||
:default: ~/.venv
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
zuul_work_dir: "{{ zuul.project.src_dir }}"
|
||||
zuul_work_virtualenv: "{{ ansible_user_dir }}/.venv"
|
||||
sphinx_python: python2
|
||||
doc_building_packages:
|
||||
- sphinx
|
||||
|
@ -9,27 +9,36 @@
|
||||
include_role:
|
||||
name: find-constraints
|
||||
|
||||
# Note (dmsimard): This installs doc/requirements.txt or test-requirements.txt
|
||||
# if the former is not found. If neither are found, this task is skipped.
|
||||
# TODO(dmsimard) Don't assume virtualenv is installed
|
||||
- name: Initialize virtual environment
|
||||
pip:
|
||||
requirements: "{{ item }}"
|
||||
- name: Install virtualenv and doc requirements files if found
|
||||
shell:
|
||||
executable: /bin/bash
|
||||
chdir: "{{ zuul_work_dir }}"
|
||||
virtualenv: "{{ zuul_work_virtualenv }}"
|
||||
virtualenv_python: "{{ sphinx_python }}"
|
||||
extra_args: "{{ upper_constraints | default(omit) }}"
|
||||
with_first_found:
|
||||
- files:
|
||||
- "{{ zuul_work_dir }}/doc/requirements.txt"
|
||||
- "{{ zuul_work_dir }}/test-requirements.txt"
|
||||
skip: true
|
||||
# NOTE(mordred) There is a bug in ansible-lint that mistakenly detects
|
||||
# setting the VENV variable below as an error if it occurs on the fist
|
||||
# line. Work around that by putting a comment as the first line until we
|
||||
# can get a fix upstream.
|
||||
cmd: |
|
||||
# Create virtualenv is it does not already exist
|
||||
VENV={{ zuul_work_virtualenv }}
|
||||
if [ ! -d $VENV ] ; then
|
||||
virtualenv $VENV
|
||||
fi
|
||||
source $VENV/bin/activate
|
||||
# skipping requirements.txt as it gets picked up by installing the
|
||||
# python package itself
|
||||
for f in doc/requirements.txt test-requirements.txt ; do
|
||||
if [ -f $f ] ; then
|
||||
pip install $CONSTRAINTS -r $f
|
||||
break
|
||||
fi
|
||||
done
|
||||
environment:
|
||||
CONSTRAINTS: "{{ upper_constraints|default('') }}"
|
||||
|
||||
- name: Install 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 }}"
|
||||
|
@ -28,7 +28,7 @@
|
||||
- name: Install requirements if they exist
|
||||
pip:
|
||||
chdir: "{{ zuul_work_dir }}"
|
||||
virtualenv: "{{ zuul_work_virtualenv }}"
|
||||
virtualenv: "{{ ansible_user_dir }}/.venv"
|
||||
requirements: requirements.txt
|
||||
extra_args: "{{ upper_constraints|default(omit) }}"
|
||||
register: requirements_install
|
||||
@ -45,7 +45,7 @@
|
||||
# the ChangeLog to have been generated.
|
||||
- name: Make sdist to generate ChangeLog
|
||||
command:
|
||||
cmd: "{{ zuul_work_virtualenv }}/bin/python setup.py sdist"
|
||||
cmd: "{{ ansible_user_dir }}/.venv/bin/python setup.py sdist"
|
||||
chdir: "{{ zuul_work_dir }}"
|
||||
when:
|
||||
- install_package
|
||||
@ -61,7 +61,7 @@
|
||||
- name: Install the project if it is a Python project
|
||||
pip:
|
||||
chdir: "{{ zuul_work_dir }}"
|
||||
virtualenv: "{{ zuul_work_virtualenv }}"
|
||||
virtualenv: "{{ ansible_user_dir }}/.venv"
|
||||
name: .
|
||||
extra_args: --no-deps
|
||||
when:
|
||||
|
@ -10,14 +10,11 @@
|
||||
sphinx_warning_is_error: "{{ check_result.warning_is_error }}"
|
||||
|
||||
- name: Run sphinx
|
||||
shell:
|
||||
executable: /bin/bash
|
||||
cmd: |
|
||||
# Source the activate file so that sphinx subcommands have the correct
|
||||
# paths set.
|
||||
source {{ zuul_work_virtualenv }}/bin/activate
|
||||
sphinx-build -b {{ item }} \
|
||||
{% if sphinx_warning_is_error %} -W {% endif %} \
|
||||
command:
|
||||
cmd: >
|
||||
{{ zuul_work_virtualenv }}/bin/sphinx-build
|
||||
-b {{ item }}
|
||||
{% if sphinx_warning_is_error %} -W {% endif %}
|
||||
{{ sphinx_source_dir }} {{ sphinx_build_dir }}/{{ item }}
|
||||
chdir: "{{ zuul_work_dir }}"
|
||||
with_items: "{{ sphinx_builders }}"
|
||||
|
Loading…
Reference in New Issue
Block a user