Fix openstackdocstheme options for api-ref

Initialize the parameter for current openstackdocstheme so that report a
bug feature works and displays all parameter including git URL and SHA.

We need to add openstackdocstheme as extension so that the parameter are
properly initialized. html_context is not needed anymore. The display of
time of last commit is done by openstackdocstheme.

Closes-Bug: #1743728
Change-Id: I415cacbf0d8d93ad45cc317ab3552a83d3cf69de
This commit is contained in:
Andreas Jaeger 2018-01-17 09:09:53 +01:00 committed by Akihiro Motoki
parent a66c1fc208
commit 2646d7b37d
1 changed files with 7 additions and 16 deletions

View File

@ -23,18 +23,14 @@
# serve to show the default.
import os
import subprocess
import sys
import warnings
import openstackdocstheme
extensions = [
'os_api_ref',
'openstackdocstheme',
]
html_theme = 'openstackdocs'
html_theme_path = [openstackdocstheme.get_html_theme_path()]
html_theme_options = {
"sidebar_mode": "toc",
}
@ -65,6 +61,11 @@ master_doc = 'index'
project = u'Networking API Reference'
copyright = u'2010-present, OpenStack Foundation'
# openstackdocstheme options
repository_name = 'openstack/neutron-lib'
bug_project = 'neutron'
bug_tag = 'api-ref'
# 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.
@ -75,10 +76,6 @@ release = version_info.release_string()
# The short X.Y version.
version = version_info.version_string()
# Config logABug feature
# html_context allows us to pass arbitrary values into the html template
html_context = {"bug_tag": "api-ref", "bug_project": "neutron"}
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
@ -153,13 +150,7 @@ pygments_style = 'sphinx'
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
# html_last_updated_fmt = '%b %d, %Y'
git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local",
"-n1"]
try:
html_last_updated_fmt = subprocess.check_output(git_cmd).decode('utf-8')
except Exception:
warnings.warn('Cannot get last updated time from git repository. '
'Not setting "html_last_updated_fmt".')
html_last_updated_fmt = '%Y-%m-%d %H:%M'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.