Get ready for os-api-ref sphinx theme change

We need some magic to keep the build working as we move away from
oslosphinx and towards openstackdocstheme, the theme we are going to
use for all the docs.

For more details see:
http://lists.openstack.org/pipermail/openstack-dev/2016-August/101996.html

Change-Id: I378b1afade4725758c024e06b239b0af64d1b19a
This commit is contained in:
Graham Hayes 2016-08-19 14:25:06 +01:00 committed by John Garbutt
parent f3d001f36c
commit 389ded42e0

View File

@ -29,6 +29,36 @@ import subprocess
import sys import sys
import warnings import warnings
# TODO(Graham Hayes): Remove the following block of code when os-api-ref is
# using openstackdocstheme
import os_api_ref
if getattr(os_api_ref, 'THEME', 'olsosphinx') == 'openstackdocstheme':
# We are on the new version with openstackdocstheme support
extensions = [
'os_api_ref',
]
import openstackdocstheme # noqa
html_theme = 'openstackdocs'
html_theme_path = [openstackdocstheme.get_html_theme_path()]
html_theme_options = {
"sidebar_mode": "toc",
}
else:
# We are on the old version without openstackdocstheme support
extensions = [
'os_api_ref',
'oslosphinx',
]
# End temporary block
# If extensions (or modules to document with autodoc) are in another directory, # 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 # add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here. # documentation root, use os.path.abspath to make it absolute, like shown here.
@ -41,11 +71,6 @@ sys.path.insert(0, os.path.abspath('./'))
# Add any Sphinx extension module names here, as strings. They can be # Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'os_api_ref',
'oslosphinx',
]
# The suffix of source filenames. # The suffix of source filenames.
source_suffix = '.rst' source_suffix = '.rst'