From 4f14a185aaa024f8a653f66df48f886b470326e9 Mon Sep 17 00:00:00 2001 From: Lukas Piwowarski Date: Wed, 16 Sep 2020 15:07:06 +0200 Subject: [PATCH] Create tox environment to build pdf documentation This patch enables building .pdf documentation using new 'pdf-docs' tox environment. The newly created tox environment creates latex source codes using sphinx-build and then builds the pdf documentation using make. Story: 2006070 Task: 35466 Change-Id: Iefa8795ba985f502f952001cdc616dae20847ef9 --- doc/requirements.txt | 1 + doc/source/conf.py | 11 ++++++++++- tox.ini | 12 +++++++++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/doc/requirements.txt b/doc/requirements.txt index 0673b3d4..e788495b 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -4,3 +4,4 @@ openstackdocstheme>=2.2.1 # Apache-2.0 reno>=3.1.0 # Apache-2.0 sphinx>=2.0.0,!=2.1.0 # BSD +sphinxcontrib-svg2pdfconverter>=0.1.0 # BSD diff --git a/doc/source/conf.py b/doc/source/conf.py index 2c20bb4f..2c8e4679 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -13,6 +13,7 @@ extensions = [ 'sphinx.ext.todo', 'sphinx.ext.viewcode', + 'sphinxcontrib.rsvgconverter', 'openstackdocstheme' ] @@ -38,6 +39,7 @@ copyright = u'2015-2019, OpenStack Foundation' openstackdocs_repo_name = 'openstack/openstack-health' openstackdocs_bug_project = 'openstack-health' openstackdocs_bug_tag = '' +openstackdocs_pdf_link = True # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -161,15 +163,22 @@ latex_elements = { # Additional stuff for the LaTeX preamble. #'preamble': '', + + } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'openstack-health.tex', u'OpenStack-Health Documentation', + ('index', 'doc-openstack-health.tex', u'OpenStack-Health Documentation', u'OpenStack Foundation', 'manual'), ] +latex_use_xindy = False +latex_elements = { + 'extraclassoptions': 'openany,oneside', +} + # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None diff --git a/tox.ini b/tox.ini index 6401dde0..e8c559c9 100644 --- a/tox.ini +++ b/tox.ini @@ -19,14 +19,20 @@ commands = commands = {posargs} [testenv:docs] -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt - -r{toxinidir}/doc/requirements.txt +deps = -r{toxinidir}/doc/requirements.txt commands = rm -rf doc/build sphinx-build -W -b html doc/source doc/build/html whitelist_externals = rm +[testenv:pdf-docs] +deps = {[testenv:docs]deps} +whitelist_externals = + make +commands = + sphinx-build -W -b latex doc/source doc/build/pdf + make -C doc/build/pdf + [testenv:pep8] commands = flake8 {toxinidir}/openstack_health {posargs}