Revert "Revert "Add sphinx_python variable to sphinx role and job""
The first version of this change was broken, fix it with updating
roles/ensure-sphinx/tasks/main.yaml to run the test-requirements check
really on the remove node.
This reverts commit 68ded2251f
.
Change-Id: I481e032834fdbf674157b2c9a8fa6f95fc570ddb
This commit is contained in:
parent
68ded2251f
commit
88279bd6cc
@ -16,6 +16,11 @@ All pip installs are done with a provided constraints file, if given.
|
|||||||
|
|
||||||
List of python packages to install for building docs.
|
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
|
.. zuul:rolevar:: zuul_work_virtualenv
|
||||||
:default: ~/.venv
|
:default: ~/.venv
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
zuul_work_dir: "{{ zuul.project.src_dir }}"
|
zuul_work_dir: "{{ zuul.project.src_dir }}"
|
||||||
zuul_work_virtualenv: "{{ ansible_user_dir }}/.venv"
|
zuul_work_virtualenv: "{{ ansible_user_dir }}/.venv"
|
||||||
|
sphinx_python: python2
|
||||||
doc_building_packages:
|
doc_building_packages:
|
||||||
- sphinx
|
- sphinx
|
||||||
|
@ -9,36 +9,37 @@
|
|||||||
include_role:
|
include_role:
|
||||||
name: find-constraints
|
name: find-constraints
|
||||||
|
|
||||||
- name: Install virtualenv and doc requirements files if found
|
# 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:
|
shell:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
chdir: "{{ zuul_work_dir }}"
|
chdir: "{{ zuul_work_dir }}"
|
||||||
# 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: |
|
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
|
for f in doc/requirements.txt test-requirements.txt ; do
|
||||||
if [ -f $f ] ; then
|
if [ -f $f ] ; then
|
||||||
pip install $CONSTRAINTS -r $f
|
echo $f
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
environment:
|
failed_when: "'requirements.txt' not in requirements_file.stdout"
|
||||||
CONSTRAINTS: "{{ upper_constraints|default('') }}"
|
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 doc building packages
|
||||||
pip:
|
pip:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
chdir: "{{ zuul_work_dir }}"
|
chdir: "{{ zuul_work_dir }}"
|
||||||
virtualenv: "{{ zuul_work_virtualenv }}"
|
virtualenv: "{{ zuul_work_virtualenv }}"
|
||||||
|
virtualenv_python: "{{ sphinx_python }}"
|
||||||
extra_args: "{{ upper_constraints | default(omit) }}"
|
extra_args: "{{ upper_constraints | default(omit) }}"
|
||||||
with_items: "{{ doc_building_packages }}"
|
with_items: "{{ doc_building_packages }}"
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
- name: Install requirements if they exist
|
- name: Install requirements if they exist
|
||||||
pip:
|
pip:
|
||||||
chdir: "{{ zuul_work_dir }}"
|
chdir: "{{ zuul_work_dir }}"
|
||||||
virtualenv: "{{ ansible_user_dir }}/.venv"
|
virtualenv: "{{ zuul_work_virtualenv }}"
|
||||||
requirements: requirements.txt
|
requirements: requirements.txt
|
||||||
extra_args: "{{ upper_constraints|default(omit) }}"
|
extra_args: "{{ upper_constraints|default(omit) }}"
|
||||||
register: requirements_install
|
register: requirements_install
|
||||||
@ -45,7 +45,7 @@
|
|||||||
# the ChangeLog to have been generated.
|
# the ChangeLog to have been generated.
|
||||||
- name: Make sdist to generate ChangeLog
|
- name: Make sdist to generate ChangeLog
|
||||||
command:
|
command:
|
||||||
cmd: "{{ ansible_user_dir }}/.venv/bin/python setup.py sdist"
|
cmd: "{{ zuul_work_virtualenv }}/bin/python setup.py sdist"
|
||||||
chdir: "{{ zuul_work_dir }}"
|
chdir: "{{ zuul_work_dir }}"
|
||||||
when:
|
when:
|
||||||
- install_package
|
- install_package
|
||||||
@ -61,7 +61,7 @@
|
|||||||
- name: Install the project if it is a Python project
|
- name: Install the project if it is a Python project
|
||||||
pip:
|
pip:
|
||||||
chdir: "{{ zuul_work_dir }}"
|
chdir: "{{ zuul_work_dir }}"
|
||||||
virtualenv: "{{ ansible_user_dir }}/.venv"
|
virtualenv: "{{ zuul_work_virtualenv }}"
|
||||||
name: .
|
name: .
|
||||||
extra_args: --no-deps
|
extra_args: --no-deps
|
||||||
when:
|
when:
|
||||||
|
@ -10,11 +10,14 @@
|
|||||||
sphinx_warning_is_error: "{{ check_result.warning_is_error }}"
|
sphinx_warning_is_error: "{{ check_result.warning_is_error }}"
|
||||||
|
|
||||||
- name: Run sphinx
|
- name: Run sphinx
|
||||||
command:
|
shell:
|
||||||
cmd: >
|
executable: /bin/bash
|
||||||
{{ zuul_work_virtualenv }}/bin/sphinx-build
|
cmd: |
|
||||||
-b {{ item }}
|
# Source the activate file so that sphinx subcommands have the correct
|
||||||
{% if sphinx_warning_is_error %} -W {% endif %}
|
# paths set.
|
||||||
|
source {{ zuul_work_virtualenv }}/bin/activate
|
||||||
|
sphinx-build -b {{ item }} \
|
||||||
|
{% if sphinx_warning_is_error %} -W {% endif %} \
|
||||||
{{ sphinx_source_dir }} {{ sphinx_build_dir }}/{{ item }}
|
{{ sphinx_source_dir }} {{ sphinx_build_dir }}/{{ item }}
|
||||||
chdir: "{{ zuul_work_dir }}"
|
chdir: "{{ zuul_work_dir }}"
|
||||||
with_items: "{{ sphinx_builders }}"
|
with_items: "{{ sphinx_builders }}"
|
||||||
|
@ -174,6 +174,11 @@
|
|||||||
Optional path to a pip constraints file for installing python
|
Optional path to a pip constraints file for installing python
|
||||||
libraries.
|
libraries.
|
||||||
|
|
||||||
|
.. zuul:jobvar:: sphinx_python
|
||||||
|
:default: python2
|
||||||
|
|
||||||
|
Version of python to use, either ``python2`` or ``python3``.
|
||||||
|
|
||||||
.. zuul:jobvar:: zuul_work_dir
|
.. zuul:jobvar:: zuul_work_dir
|
||||||
:default: {{ zuul.project.src_dir }}
|
:default: {{ zuul.project.src_dir }}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user