Generate PDF documentation

Change-Id: I71a0820f2322be7f84ab6555b534368d76bb0359
Story: 2006101
Task: 35148
This commit is contained in:
Michael Johnson 2019-09-13 10:27:51 -07:00
parent cec8b19421
commit 5ea72f9f2c
8 changed files with 177 additions and 32 deletions

View File

@ -4,3 +4,6 @@ openstackdocstheme>=1.20.0 # Apache-2.0
sphinxcontrib-apidoc>=0.2.1 # BSD sphinxcontrib-apidoc>=0.2.1 # BSD
# releasenotes # releasenotes
reno>=2.5.0 # Apache-2.0 reno>=2.5.0 # Apache-2.0
# PDF Docs
sphinxcontrib-svg2pdfconverter>=0.1.0 # BSD

View File

@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import datetime
import os import os
import sys import sys
@ -23,7 +24,8 @@ sys.path.insert(0, os.path.abspath('../..'))
extensions = [ extensions = [
'sphinx.ext.autodoc', 'sphinx.ext.autodoc',
'openstackdocstheme', 'openstackdocstheme',
'sphinxcontrib.apidoc' 'sphinxcontrib.apidoc',
'sphinxcontrib.rsvgconverter'
] ]
# autodoc generation is a bit aggressive and a nuisance when doing heavy # autodoc generation is a bit aggressive and a nuisance when doing heavy
@ -37,7 +39,17 @@ source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
# General information about the project. # General information about the project.
copyright = u'2018, OpenStack Developers' copyright = u'2018-2019, OpenStack Octavia Team'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# Version info
from octavia_lib.version import version_info as octavia_lib_version
release = octavia_lib_version.release_string()
# The short X.Y version.
version = octavia_lib_version.version_string()
# openstackdocstheme options # openstackdocstheme options
repository_name = 'openstack/octavia-lib' repository_name = 'openstack/octavia-lib'
@ -74,15 +86,66 @@ html_theme = 'openstackdocs'
# Output file base name for HTML help builder. # Output file base name for HTML help builder.
htmlhelp_basename = 'octavia-libdoc' htmlhelp_basename = 'octavia-libdoc'
# -- Options for LaTeX output -------------------------------------------------
# Fix Unicode character for sphinx_feature_classification
# Sphinx default latex engine (pdflatex) doesn't know much unicode
latex_preamble = r"""
\usepackage{newunicodechar}
\newunicodechar{}{\sffamily X}
\setcounter{tocdepth}{2}
\authoraddress{\textcopyright %s OpenStack Foundation}
""" % datetime.datetime.now().year
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
# openany: Skip blank pages in generated PDFs
'extraclassoptions': 'openany,oneside',
'makeindex': '',
'printindex': '',
'preamble': latex_preamble
}
# Disable usage of xindy https://bugzilla.redhat.com/show_bug.cgi?id=1643664
# Some distros are missing xindy
latex_use_xindy = False
# Fix missing apostrophe
smartquotes_excludes = {'builders': ['latex']}
# Grouping the document tree into LaTeX files. List of tuples # Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass # (source start file, target name, title, author, documentclass
# [howto/manual]). # [howto/manual]).
latex_documents = [ latex_documents = [(
('index', 'index',
'octavia-lib.tex', 'doc-octavia-lib.tex',
u'octavia-lib Documentation', u'Octavia Library Documentation',
u'OpenStack Developers', 'manual'), u'OpenStack Octavia Team',
] 'manual'
)]
# Example configuration for intersphinx: refer to the Python standard library. # The name of an image file (relative to this directory) to place at the top of
#intersphinx_mapping = {'http://docs.python.org/': None} # the title page.
# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
# latex_use_parts = False
# If true, show page references after internal links.
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
# latex_show_urls = False
# Documents to append as an appendix to all manuals.
# latex_appendices = []
# If false, no module index is generated.
latex_domain_indices = False

View File

@ -3,14 +3,38 @@
You can adapt this file completely to your liking, but it should at least You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive. contain the root `toctree` directive.
===========================================
Welcome to the documentation of Octavia lib Welcome to the documentation of Octavia lib
=========================================== ===========================================
.. include:: ../../README.rst .. only:: html
octavia-lib Documentation: .. include:: ../../README.rst
--------------------------------
.. only:: latex
.. image:: https://governance.openstack.org/tc/badges/octavia-lib.svg
A library to support Octavia provider drivers.
This python module provides a python library for Octavia provider driver
developers.
See the provider driver development guide for more information:
https://docs.openstack.org/octavia/latest/contributor/guides/providers.html
Octavia-lib is distributed under the terms of the Apache License, Version 2.0.
The full terms and conditions of this license are detailed in the LICENSE file.
* Free software: Apache license
* Documentation: https://docs.openstack.org/octavia-lib/latest
* Source: https://opendev.org/openstack/octavia-lib
* Bugs: https://storyboard.openstack.org/#!/project/openstack/octavia-lib
.. only:: html
octavia-lib Documentation:
--------------------------
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
@ -24,9 +48,11 @@ octavia-lib Documentation:
admin/index admin/index
reference/index reference/index
Indices and tables .. only:: html
==================
* :ref:`genindex` Indices and tables
* :ref:`modindex` ------------------
* :ref:`search`
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@ -4,9 +4,11 @@ Usage
Instructions for using the library are provided in the `Provider Driver Development Guide <https://docs.openstack.org/octavia/latest/contributor/guides/providers.html>`_. Instructions for using the library are provided in the `Provider Driver Development Guide <https://docs.openstack.org/octavia/latest/contributor/guides/providers.html>`_.
Indices and Search .. only:: html
------------------
* :ref:`genindex` Indices and Search
* :ref:`modindex` ------------------
* :ref:`search`
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@ -11,14 +11,21 @@ References
Octavia Project Documentation <https://docs.openstack.org/octavia/latest/> Octavia Project Documentation <https://docs.openstack.org/octavia/latest/>
Octavia API Reference <https://docs.openstack.org/api-ref/load-balancer/> Octavia API Reference <https://docs.openstack.org/api-ref/load-balancer/>
Indices and Search .. only: html
------------------
* :ref:`genindex` Indices and Search
* :ref:`modindex` ------------------
* :ref:`search`
.. toctree:: * :ref:`genindex`
:hidden: * :ref:`modindex`
* :ref:`search`
modules/modules .. only:: latex
Module Reference
----------------
.. toctree::
:hidden:
modules/modules

View File

@ -11,6 +11,7 @@ pbr==2.0.0
pylint==1.9.2 pylint==1.9.2
python-subunit==1.0.0 python-subunit==1.0.0
six==1.10.0 six==1.10.0
sphinxcontrib-svg2pdfconverter==0.1.0
stestr==2.0.0 stestr==2.0.0
tenacity==5.0.2 tenacity==5.0.2
testtools==2.2.0 testtools==2.2.0

32
octavia_lib/version.py Normal file
View File

@ -0,0 +1,32 @@
# Copyright 2011-2014 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import pbr.version
OCTAVIA_LIB_VENDOR = "OpenStack Foundation"
OCTAVIA_LIB_PRODUCT = "OpenStack Octavia library"
version_info = pbr.version.VersionInfo('octavia-lib')
def vendor_string():
return OCTAVIA_LIB_VENDOR
def product_string():
return OCTAVIA_LIB_PRODUCT
def version_string_with_package():
return version_info.version_string()

11
tox.ini
View File

@ -52,6 +52,17 @@ commands =
rm -rf doc/build doc/source/reference/modules rm -rf doc/build doc/source/reference/modules
sphinx-build -W -b html doc/source doc/build/html sphinx-build -W -b html doc/source doc/build/html
[testenv:pdf-docs]
basepython = python3
deps = {[testenv:docs]deps}
whitelist_externals =
make
rm
commands =
rm -rf doc/build/pdf
sphinx-build -W -b latex doc/source doc/build/pdf
make -C doc/build/pdf
[testenv:releasenotes] [testenv:releasenotes]
basepython = python3 basepython = python3
deps = {[testenv:docs]deps} deps = {[testenv:docs]deps}