Switch from oslosphinx to openstackdocstheme

As part of the docs migration work[0] for Pike we need to switch to use
the openstackdocstheme.

[0]https://review.openstack.org/#/c/472275/

Change-Id: I7648dc5681020ffa34c65244117a8e243c29a51d
This commit is contained in:
Sharat Sharma 2017-07-03 18:17:44 +05:30
parent d4d41137ac
commit 70202760f6
3 changed files with 21 additions and 23 deletions

View File

@ -2,9 +2,7 @@
import os import os
import pbr.version import pbr.version
import subprocess
import sys import sys
import warnings
on_rtd = os.environ.get('READTHEDOCS', None) == 'True' on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
@ -21,14 +19,11 @@ sys.path.insert(0, os.path.abspath('./'))
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [ extensions = [
'sphinx.ext.autodoc', 'sphinx.ext.autodoc',
'oslosphinx', 'openstackdocstheme',
] ]
if not on_rtd:
extensions.append('oslosphinx')
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates'] # templates_path = ['_templates']
# The suffix of source filenames. # The suffix of source filenames.
source_suffix = '.rst' source_suffix = '.rst'
@ -73,21 +68,13 @@ modindex_common_prefix = ['mistralclient.']
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. # a list of builtin themes.
if on_rtd: html_theme = 'openstackdocs'
html_theme_path = ['.']
html_theme = 'sphinx_rtd_theme'
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format. # using the given strftime format.
# html_last_updated_fmt = '%b %d, %Y' # html_last_updated_fmt = '%b %d, %Y'
git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local", # Must set this variable to include year, month, day, hours, and minutes.
"-n1"] html_last_updated_fmt = '%Y-%m-%d %H:%M'
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".')
# The name for this set of Sphinx documents. If None, it defaults to # The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation". # "<project> v<release> documentation".
@ -118,3 +105,7 @@ man_pages = [
[u'Mistral Contributors'], 1) [u'Mistral Contributors'], 1)
] ]
# -- Options for openstackdocstheme -------------------------------------------
repository_name = 'openstack/python-mistralclient'
bug_project = 'python-mistralclient'
bug_tag = ''

View File

@ -38,12 +38,12 @@ import pbr.version
# 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 = [ extensions = [
'oslosphinx', 'openstackdocstheme',
'reno.sphinxext', 'reno.sphinxext',
] ]
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates'] # templates_path = ['_templates']
# The suffix of source filenames. # The suffix of source filenames.
source_suffix = '.rst' source_suffix = '.rst'
@ -77,6 +77,8 @@ release = mistralclient_version.version_string_with_vcs()
# today = '' # today = ''
# Else, today_fmt is used as the format for a strftime call. # Else, today_fmt is used as the format for a strftime call.
# today_fmt = '%B %d, %Y' # today_fmt = '%B %d, %Y'
# Must set this variable to include year, month, day, hours, and minutes.
html_last_updated_fmt = '%Y-%m-%d %H:%M'
# List of patterns, relative to source directory, that match files and # List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files. # directories to ignore when looking for source files.
@ -108,7 +110,7 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. # a list of builtin themes.
html_theme = 'default' html_theme = 'openstackdocs'
# Theme options are theme-specific and customize the look and feel of a theme # Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the # further. For a list of options available for each theme, see the
@ -137,7 +139,7 @@ html_theme = 'default'
# Add any paths that contain custom static files (such as style sheets) here, # Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files, # relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css". # so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static'] # html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format. # using the given strftime format.
@ -264,3 +266,8 @@ texinfo_documents = [
# -- Options for Internationalization output ------------------------------ # -- Options for Internationalization output ------------------------------
locale_dirs = ['locale/'] locale_dirs = ['locale/']
# -- Options for openstackdocstheme -------------------------------------------
repository_name = 'openstack/python-mistralclient'
bug_project = 'python-mistralclient'
bug_tag = ''

View File

@ -11,4 +11,4 @@ requests-mock>=1.1 # Apache-2.0
tempest>=14.0.0 # Apache-2.0 tempest>=14.0.0 # Apache-2.0
osprofiler>=1.4.0 # Apache-2.0 osprofiler>=1.4.0 # Apache-2.0
reno!=2.3.1,>=1.8.0 # Apache-2.0 reno!=2.3.1,>=1.8.0 # Apache-2.0
oslosphinx>=4.7.0 # Apache-2.0 openstackdocstheme>=1.11.0 # Apache-2.0