From cea462b0e465fbc906281ce0823818daadc37dc0 Mon Sep 17 00:00:00 2001
From: Kaifeng Wang <kaifeng.w@gmail.com>
Date: Mon, 17 Jun 2019 11:53:01 +0800
Subject: [PATCH] Build pdf doc

The is one of community goals that each project could produce a
single PDF file. The pdf should be in the output of openstack-tox-docs
job.

TeX packages are required to build PDF locally, following is recommended:

* inkscape
* texlive-latex-base
* texlive-latex-extra
* texlive-fonts-recommended

More about the goal:
https://governance.openstack.org/tc/goals/train/pdf-doc-generation.html
https://etherpad.openstack.org/p/train-pdf-support-goal
https://etherpad.openstack.org/p/pdf-goal-train-common-problems

Change-Id: Ic036194e33224be9341dbde901c4ba4717ccbbc8
---
 doc/source/conf.py    | 8 +++-----
 test-requirements.txt | 2 +-
 tox.ini               | 6 ++++++
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/doc/source/conf.py b/doc/source/conf.py
index bb32542..8fe8777 100755
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -37,13 +37,11 @@ source_suffix = '.rst'
 master_doc = 'index'
 
 # General information about the project.
-project = u'ironic-python-agent-builder'
 copyright = u'2017, OpenStack Developers'
 
 # openstackdocstheme options
 repository_name = 'openstack/ironic-python-agent-builder'
-bug_project = 'ironic-python-agent'
-bug_tag = ''
+use_storyboard = True
 
 # If true, '()' will be appended to :func: etc. cross-reference text.
 add_function_parentheses = True
@@ -66,14 +64,14 @@ html_theme = 'openstackdocs'
 html_last_updated_fmt = '%Y-%m-%d %H:%M'
 
 # Output file base name for HTML help builder.
-htmlhelp_basename = '%sdoc' % project
+htmlhelp_basename = 'ironic-python-agent-builderdoc'
 
 # Grouping the document tree into LaTeX files. List of tuples
 # (source start file, target name, title, author, documentclass
 # [howto/manual]).
 latex_documents = [
     ('index',
-     '%s.tex' % project,
+     'doc-ironic-python-agent-builder.tex',
      u'Ironic Python Agent Builder Documentation',
      u'OpenStack Developers', 'manual'),
 ]
diff --git a/test-requirements.txt b/test-requirements.txt
index c574c45..0e95301 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -5,6 +5,6 @@
 doc8>=0.6.0 # Apache-2.0
 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
-openstackdocstheme>=1.17.0 # Apache-2.0
+openstackdocstheme>=1.20.0 # Apache-2.0
 # releasenotes
 reno>=2.5.0 # Apache-2.0
diff --git a/tox.ini b/tox.ini
index 9ad8ddc..a225c5f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -23,6 +23,12 @@ commands = {posargs}
 basepython = python3
 commands = python setup.py build_sphinx
 
+[testenv:pdf-docs]
+whitelist_externals = make
+basepython = python3
+commands = sphinx-build -b latex doc/source doc/build/pdf
+           make -C doc/build/pdf
+
 [testenv:releasenotes]
 basepython = python3
 commands =