Switch docs theme to versioned RTD

To match change I2870450ffd02f55509fcc1297d050b09deafbfb9 in Zuul.

Change-Id: I87c9aa56f59b7c4b97f79d63b737607fb3519d41
This commit is contained in:
James E. Blair 2021-12-15 13:40:36 -08:00
parent 074f2d9d55
commit e824242afe
5 changed files with 229 additions and 36 deletions

View File

@ -3,3 +3,4 @@ sphinxcontrib-programoutput
sphinx-autodoc-typehints
reno>=2.8.0 # Apache-2.0
zuul-sphinx
sphinx_rtd_theme

View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Layer_1"
x="0px"
y="0px"
viewBox="0 0 1999.9989 533.33301"
xml:space="preserve"
sodipodi:docname="Zuul_Logo_Full_Horizontal_RGB_DarkBlue.svg"
width="1999.9988"
height="533.33301"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)"><metadata
id="metadata1646"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs1644" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1983"
inkscape:window-height="845"
id="namedview1642"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="0.2545462"
inkscape:cx="107.94999"
inkscape:cy="28.799999"
inkscape:window-x="235"
inkscape:window-y="67"
inkscape:window-maximized="0"
inkscape:current-layer="Layer_1" />
<style
type="text/css"
id="style1625">
.st0{fill:#071D49;}
</style>
<g
id="g1639"
transform="matrix(9.2592535,0,0,9.2592535,-316.66647,-399.99975)"
style="fill:#ffffff;fill-opacity:1">
<path
class="st0"
d="m 34.2,100.8 h 66.5 L 86.5,76.2 v -8.4 l 3.9,-5.1 H 78.6 L 67.4,43.2 56.2,62.7 H 44.4 l 3.9,5.1 v 8.4 z M 48.4,97.4 H 40 l 8.4,-14.5 z m 5.7,0 H 51.7 V 77.6 h 2.4 z m 0,-23.1 h -2.4 v -2.4 h 2.4 z M 65.7,97.4 H 57.5 V 77.6 h 8.2 z m 11.6,0 H 69.1 V 77.6 h 8.2 z m 0,-23.1 H 57.5 v -2.4 h 19.8 z m 5.8,23.1 H 80.7 V 77.6 h 2.4 z m 0,-23.1 h -2.4 v -2.4 h 2.4 z m 3.4,8.6 8.4,14.5 h -8.4 z m -19.1,-33 7.4,12.7 H 60 Z M 83.6,66 83.1,66.7 v 1.8 H 51.7 V 66.7 L 51.2,66 Z"
id="path1627"
style="fill:#ffffff;fill-opacity:1" />
<g
id="g1637"
style="fill:#ffffff;fill-opacity:1">
<polygon
class="st0"
points="227.5,86 250.2,86 246.7,80 233.5,80 233.5,57.2 227.5,60.7 "
id="polygon1629"
style="fill:#ffffff;fill-opacity:1" />
<path
class="st0"
d="m 207.5,74.2 v 0 0 c 0,3.6 -2.9,6.5 -6.5,6.5 -3.6,0 -6.5,-2.9 -6.5,-6.5 v 0 0 -17 l -6,3.5 v 13.5 0 c 0,6.9 5.6,12.5 12.5,12.5 6.9,0 12.5,-5.6 12.5,-12.5 v 0 -17 l -6,3.5 z"
id="path1631"
style="fill:#ffffff;fill-opacity:1" />
<path
class="st0"
d="m 168.4,74.2 v 0 0 c 0,3.6 -2.9,6.5 -6.5,6.5 -3.6,0 -6.5,-2.9 -6.5,-6.5 v 0 0 -17 l -6,3.5 v 13.5 0 c 0,6.9 5.6,12.5 12.5,12.5 6.9,0 12.5,-5.6 12.5,-12.5 v 0 -17 l -6,3.5 z"
id="path1633"
style="fill:#ffffff;fill-opacity:1" />
<polygon
class="st0"
points="110.4,86 131.9,86 135.4,80 120.8,80 133.9,57.2 113.8,57.2 110.4,63.3 123.5,63.3 "
id="polygon1635"
style="fill:#ffffff;fill-opacity:1" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -0,0 +1,15 @@
{# Based on versions.html from sphinx_rtd_theme, Licensed under ASL2 #}
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="{{ _('Versions') }}">
<span class="rst-current-version" data-toggle="rst-current-version">
<span class="fa fa-book">{{ _('Versions') }}</span>
v: {{ current_version }}
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
<dl>
{% for slug, url in versions %}
<dd><a href="{{ url }}">{{ slug }}</a></dd>
{% endfor %}
</dl>
</div>
</div>

View File

@ -1,60 +1,150 @@
# Configuration file for the Sphinx documentation builder.
# -*- coding: utf-8 -*-
# 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
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# 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
# documentation root, use os.path.abspath to make it absolute, like shown here.
# http://www.apache.org/licenses/LICENSE-2.0
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# 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 sys, os, datetime
import subprocess
import re
from zuulclient import version
# -- Project information -----------------------------------------------------
# The minimum version to link to
min_version = (0, 0, 0)
project = 'Zuul-client'
copyright = '2020, OpenStack'
author = 'OpenStack'
# -- General configuration ---------------------------------------------------
sys.path.insert(0, os.path.abspath('../..'))
# -- General configuration ----------------------------------------------------
# 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 = [
'sphinx.ext.autodoc',
'sphinx_autodoc_typehints',
'sphinxcontrib.programoutput',
'zuul_sphinx',
# 'zuul.sphinx.zuul',
'reno.sphinxext',
'sphinx_rtd_theme',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# autodoc generation is a bit aggressive and a nuisance when doing heavy
# text edit cycles.
# execute "export SPHINX_DEBUG=1" in your terminal to disable
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
primary_domain = 'zuul'
# The suffix of source filenames.
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'Zuul-Client'
copyright = u'2012-%s, Zuul project contributors' % datetime.date.today().year
doc_root = os.environ.get('ZUUL_DOC_ROOT', '/docs/%s' % (project.lower()))
# If true, '()' will be appended to :func: etc. cross-reference text.
add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
add_module_names = True
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# -- Options for HTML output -------------------------------------------------
# -- Options for HTML output --------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
#html_theme = 'alabaster'
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
html_theme = "sphinx_rtd_theme"
if version.is_release:
version = version.release_string
current_version = version.release_string
versions = [('latest', f'{doc_root}/')]
else:
# Uncomment this if we want to use the in-development version
# number (eg 4.10.5.dev4 887cf31e4 )
# version = version.get_version_string()
version = 'latest'
current_version = 'latest'
versions = [('latest', f'{doc_root}/')]
try:
output = subprocess.check_output(['git', 'tag']).decode('utf8')
except subprocess.CalledProcessError:
output = ''
interesting_tags = []
for tag in output.splitlines():
if re.match('^\d+\.\d+\.\d+$', tag):
parts = tuple(map(int, tag.split('.')))
if parts < min_version:
continue
interesting_tags.append((parts, tag))
for parts, tag in reversed(sorted(interesting_tags, key=lambda x: x[0])):
versions.append((tag, f'{doc_root}/{tag}/'))
# 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
# documentation.
html_theme_options = {
'collapse_navigation': False,
'navigation_depth': -1,
'logo_only': True,
}
html_context = {
# This controls what is displayed at the top of the navbar.
'version': version,
# This controls what the caret selection displays at the bottom of
# the navbar.
'current_version': current_version,
# A tuple of (slug, url)
'versions': versions,
}
# 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,
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ['_static']
html_static_path = ['_static']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
html_logo = '_static/logo.svg'
# Output file base name for HTML help builder.
htmlhelp_basename = '%sdoc' % project
# 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,
u'%s Documentation' % project,
u'Zuul contributors', 'manual'),
]
# Example configuration for intersphinx: refer to the Python standard library.
#intersphinx_mapping = {'http://docs.python.org/': None}
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Additional Zuul role paths
zuul_role_paths = []

View File

@ -56,6 +56,7 @@ commands =
coverage xml -o cover/coverage.xml
[testenv:docs]
usedevelop = True
install_command = pip install {opts} {packages}
deps =
-r{toxinidir}/doc/requirements.txt