PDF Documentation Build tox target

This patch adds a `pdf-docs` tox target that will build
PDF versions of our docs. As per the Train community goal:

  https://governance.openstack.org/tc/goals/selected/train/pdf-doc-generation.html

Add sphinxcontrib-svg2pdfconverter to doc/requirements.txt
to convert our SVGs.

Change-Id: I887bd71b3304a9a9078cf60c48b02b871dd8146f
Story: 2006105
This commit is contained in:
Dmitriy Rabotyagov 2019-10-17 19:47:35 +03:00
parent 3018868844
commit b7eaa12dcb
4 changed files with 31 additions and 22 deletions

View File

@ -10,7 +10,8 @@
# automatically be proposed to all the repositories which use it.
sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD
sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD
sphinx>=1.8.0,!=2.1.0,>=1.6.2;python_version>='3.4' # BSD
sphinxcontrib-svg2pdfconverter>=0.1.0 # BSD
openstackdocstheme>=1.20.0 # Apache-2.0
reno>=2.5.0 # Apache-2.0
doc8>=0.6.0 # Apache-2.0

View File

View File

@ -22,9 +22,7 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
import openstackdocstheme
import pbr.version
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@ -42,6 +40,7 @@ import os
extensions = [
'sphinx.ext.autodoc',
'openstackdocstheme',
'sphinxcontrib.rsvgconverter',
]
# Add any paths that contain templates here, relative to this directory.
@ -66,16 +65,16 @@ description = 'OpenStack-Ansible deploys OpenStack environments using Ansible.'
project = 'OpenStack-Ansible'
role_name = 'os_horizon'
target_name = 'openstack-ansible-' + role_name
title = 'OpenStack-Ansible Documentation: ' + role_name + 'role'
title = 'OpenStack-Ansible Documentation: ' + role_name + ' role'
# openstackdocstheme options
repository_name = 'openstack/openstack-ansible-os_horizon'
bug_project = 'openstack-ansible-os_horizon'
repository_name = 'openstack/' + target_name
bug_project = project.lower()
bug_tag = ''
# The link to the browsable source code (for the left hand menu)
oslosphinx_cgit_link = (
"https://git.openstack.org/cgit/openstack/{}".format(target_name)
"https://opendev.org/openstack/{}".format(target_name)
)
# The version info for the project you're documenting, acts as replacement for
@ -89,17 +88,6 @@ release = version_info.version_string_with_vcs()
# The short X.Y version.
version = version_info.canonical_version_string()
# A few variables have to be set for the log-a-bug feature.
# gitsha: The SHA checksum of the bug description. Automatically extracted from git log.
# bug_tag: Tag for categorizing the bug. Must be set manually.
# These variables are passed to the logabug code via html_context.
git_cmd = "/usr/bin/git log | head -n1 | cut -f2 -d' '"
gitsha = os.popen(git_cmd).read().strip('\n')
bug_project = project.lower()
bug_title = "Documentation bug"
html_context = {"gitsha": gitsha, "bug_tag": "docs",
"bug_title": bug_title, "bug_project": bug_project }
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
@ -157,7 +145,7 @@ html_theme = 'openstackdocs'
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = [openstackdocstheme.get_html_theme_path()]
# html_theme_path = [openstackdocstheme.get_html_theme_path()]
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
@ -263,10 +251,12 @@ latex_elements = {
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, target_name + '.tex',
title, author, 'manual'),
(master_doc, 'doc-' + target_name + '.tex',
title.replace("_", "\_"), author, 'manual'),
]
latex_use_xindy = False
# The name of an image file (relative to this directory) to place at the top of
# the title page.
# latex_logo = None
@ -323,3 +313,11 @@ texinfo_documents = [
# If true, do not generate a @detailmenu in the "Top" node's menu.
# texinfo_no_detailmenu = False
# -- Options for PDF output --------------------------------------------------
pdf_documents = [
(master_doc, target_name,
title, author)
]
locale_dirs = ['locale/']

12
tox.ini
View File

@ -35,12 +35,22 @@ setenv =
[testenv:docs]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
commands=
commands =
bash -c "rm -rf doc/build"
doc8 doc
sphinx-build -b html doc/source doc/build/html
[testenv:pdf-docs]
basepython = python3
deps = {[testenv:docs]deps}
whitelist_externals =
make
commands =
sphinx-build -W -b latex doc/source doc/build/pdf
make -C doc/build/pdf
[doc8]
# Settings for doc8:
extensions = .rst