From 6a90cdc520e32c2e2d2f8cf3496dcf29fa5ffb32 Mon Sep 17 00:00:00 2001 From: Alexandra Settle Date: Wed, 25 Sep 2019 16:10:55 +0100 Subject: [PATCH] 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. This PR also introduces the docs testenv and a doc requirements.txt file. Change-Id: If782737efe7114422be9cc3fc586500a2065f07e Story: 2006072 --- doc/requirements.txt | 5 +++++ doc/source/conf.py | 10 +++++++++- doc/source/index.rst | 11 ++++++----- lower-constraints.txt | 4 ---- test-requirements.txt | 4 ---- tox.ini | 23 ++++++++++++++++++++++- 6 files changed, 42 insertions(+), 15 deletions(-) create mode 100644 doc/requirements.txt diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 00000000..6452512e --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1,5 @@ +sphinx>=1.8.0,<2.0.0;python_version=='2.7' # BSD +sphinx>=1.8.0,!=2.1.0;python_version>='3.4' # BSD +sphinxcontrib-svg2pdfconverter>=0.1.0 # BSD +reno>=2.5.0 # Apache-2.0 +openstackdocstheme>=1.18.1 # Apache-2.0 diff --git a/doc/source/conf.py b/doc/source/conf.py index 98678958..6e6d89f5 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -23,6 +23,7 @@ extensions = [ 'sphinx.ext.autodoc', #'sphinx.ext.intersphinx', 'openstackdocstheme', + 'sphinxcontrib.rsvgconverter', ] # autodoc generation is a bit aggressive and a nuisance when doing heavy @@ -71,13 +72,20 @@ html_extra_path = ['_extra'] # 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-castellan.tex', u'%s Documentation' % project, u'OpenStack Foundation', 'manual'), ] +latex_elements = { + 'extraclassoptions': 'openany,oneside', +} + +latex_use_xindy = False + # Example configuration for intersphinx: refer to the Python standard library. #intersphinx_mapping = {'https://docs.python.org/3/': None} diff --git a/doc/source/index.rst b/doc/source/index.rst index 7b9de8ed..bc115c73 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -15,10 +15,11 @@ Contents user/index contributor/index -Indices and tables -================== +.. only:: html -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` + Indices and tables + ================== + * :ref:`genindex` + * :ref:`modindex` + * :ref:`search` diff --git a/lower-constraints.txt b/lower-constraints.txt index 3432ac92..da4eec4f 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -31,7 +31,6 @@ mox3==0.20.0 msgpack-python==0.4.0 netaddr==0.7.18 netifaces==0.10.4 -openstackdocstheme==1.18.1 os-client-config==1.28.0 oslo.config==6.4.0 oslo.context==2.19.2 @@ -56,15 +55,12 @@ python-mimeparse==1.6.0 python-subunit==1.0.0 pytz==2013.6 PyYAML==3.12 -reno==2.5.0 requests==2.14.2 requestsexceptions==1.2.0 rfc3986==0.3.1 six==1.10.0 smmap==0.9.0 snowballstemmer==1.2.1 -Sphinx==1.6.2 -sphinxcontrib-websupport==1.0.1 stevedore==1.20.0 stestr==2.0.0 testscenarios==0.4 diff --git a/test-requirements.txt b/test-requirements.txt index 09534b45..b7cd5921 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -6,14 +6,10 @@ hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 python-barbicanclient>=4.5.2 # Apache-2.0 python-subunit>=1.0.0 # Apache-2.0/BSD -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.18.1 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0 stestr>=2.0.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD testtools>=2.2.0 # MIT bandit>=1.1.0,<1.6.0 # Apache-2.0 -reno>=2.5.0 # Apache-2.0 pifpaf>=0.10.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index 56a9a7f0..f28c215a 100644 --- a/tox.ini +++ b/tox.ini @@ -57,11 +57,32 @@ commands = coverage report [testenv:docs] +# This environment is called from CI scripts to test and publish +# the main docs to https://docs.openstack.org/castellan +description = Build main documentation basepython = python3 -commands = python setup.py build_sphinx +deps = -r{toxinidir}/doc/requirements.txt +commands= + rm -rf doc/build doc/build/doctrees + sphinx-build -W -b html -d doc/build/doctrees doc/source doc/build/html +whitelist_externals = rm + +[testenv:pdf-docs] +basepython = python3 +deps = {[testenv:docs]deps} +envdir = {toxworkdir}/docs +whitelist_externals = + rm + make +commands = + rm -rf doc/build/pdf + sphinx-build -W -b latex doc/source doc/build/pdf + make -C doc/build/pdf [testenv:releasenotes] basepython = python3 +deps = {[testenv:docs]deps} +envdir = {toxworkdir}/docs commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html [testenv:functional]