Fix: Update Sphinx to fix RTD build
[releng/global-jjb.git] / docs / conf.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 #
4 # Linux Foundation Release Engineering Tools documentation build configuration file, created by
5 # sphinx-quickstart on Sat Mar  4 12:20:05 2017.
6 #
7 # This file is execfile()d with the current directory set to its
8 # containing dir.
9 #
10 # Note that not all possible configuration values are present in this
11 # autogenerated file.
12 #
13 # All configuration values have a default; values that are commented out
14 # serve to show the default.
15
16 # If extensions (or modules to document with autodoc) are in another directory,
17 # add these directories to sys.path here. If the directory is relative to the
18 # documentation root, use os.path.abspath to make it absolute, like shown here.
19 #
20 import os
21 import subprocess
22 import sys
23 import sphinx_bootstrap_theme
24
25 sys.path.insert(0, os.path.abspath('..'))
26
27
28 def format_version(version):
29     fmt = '{tag}.dev{commitcount}+{gitsha}'
30     parts = version.split('-')
31     assert len(parts) in (3, 4)
32     dirty = len(parts) == 4
33     tag, count, sha = parts[:3]
34     if count == '0' and not dirty:
35         return tag
36     return fmt.format(tag=tag, commitcount=count, gitsha=sha.lstrip('g'))
37
38
39 # -- General configuration ------------------------------------------------
40
41 # If your documentation needs a minimal Sphinx version, state it here.
42 #
43 # needs_sphinx = '1.0'
44
45 # Add any Sphinx extension module names here, as strings. They can be
46 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
47 # ones.
48 extensions = [
49     'reno.sphinxext',
50     'sphinx.ext.autodoc',
51     'sphinx.ext.doctest',
52     'sphinx.ext.intersphinx',
53     'sphinx.ext.todo',
54     'sphinx.ext.coverage',
55     'sphinx.ext.viewcode',
56     'sphinxcontrib.programoutput',
57 ]
58
59 # Add any paths that contain templates here, relative to this directory.
60 templates_path = ['_templates']
61
62 # The suffix(es) of source filenames.
63 # You can specify multiple suffix as a list of string:
64 #
65 # source_suffix = ['.rst', '.md']
66 source_suffix = '.rst'
67
68 # The encoding of source files.
69 #
70 # source_encoding = 'utf-8-sig'
71
72 # The master toctree document.
73 master_doc = 'index'
74
75 # General information about the project.
76 project = 'lf-releng-global-jjb'
77 copyright = '2019, The Linux Foundation'
78 author = 'Linux Foundation Releng'
79
80 # The version info for the project you're documenting, acts as replacement for
81 # |version| and |release|, also used in various other places throughout the
82 # built documents.
83 #
84 # The short X.Y version.
85 command = 'git describe --tags --long --dirty'
86 try:
87     git_version = format_version(
88         subprocess.check_output(command.split()).decode('utf-8').strip())
89 except subprocess.CalledProcessError:  # Handle docs builds from tarball
90     git_version = "v0.0.9999-local"
91 version = git_version
92 # The full version, including alpha/beta/rc tags.
93 release = version
94
95 # The language for content autogenerated by Sphinx. Refer to documentation
96 # for a list of supported languages.
97 #
98 # This is also used if you do content translation via gettext catalogs.
99 # Usually you set "language" from the command line for these cases.
100 language = "en"
101
102 # There are two options for replacing |today|: either, you set today to some
103 # non-false value, then it is used:
104 #
105 # today = ''
106 #
107 # Else, today_fmt is used as the format for a strftime call.
108 #
109 # today_fmt = '%B %d, %Y'
110
111 # List of patterns, relative to source directory, that match files and
112 # directories to ignore when looking for source files.
113 # This patterns also effect to html_static_path and html_extra_path
114 exclude_patterns = []
115
116 # The reST default role (used for this markup: `text`) to use for all
117 # documents.
118 #
119 # default_role = None
120
121 # If true, '()' will be appended to :func: etc. cross-reference text.
122 #
123 # add_function_parentheses = True
124
125 # If true, the current module name will be prepended to all description
126 # unit titles (such as .. function::).
127 #
128 # add_module_names = True
129
130 # If true, sectionauthor and moduleauthor directives will be shown in the
131 # output. They are ignored by default.
132 #
133 # show_authors = False
134
135 # The name of the Pygments (syntax highlighting) style to use.
136 pygments_style = 'sphinx'
137
138 # A list of ignored prefixes for module index sorting.
139 # modindex_common_prefix = []
140
141 # If true, keep warnings as "system message" paragraphs in the built documents.
142 # keep_warnings = False
143
144 # If true, `todo` and `todoList` produce output, else they produce nothing.
145 todo_include_todos = True
146
147
148 # -- Options for HTML output ----------------------------------------------
149
150 # The theme to use for HTML and HTML Help pages.  See the documentation for
151 # a list of builtin themes.
152 #
153 html_theme = 'bootstrap'
154
155 # Theme options are theme-specific and customize the look and feel of a theme
156 # further.  For a list of options available for each theme, see the
157 # documentation.
158 #
159 # html_theme_options = {}
160 html_theme_options = {
161     'bootswatch_theme': "cerulean",
162     'navbar_sidebarrel': False,
163     'source_link_position': "footer",
164 }
165
166 # Add any paths that contain custom themes here, relative to this directory.
167 # html_theme_path = []
168 html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()
169
170 # The name for this set of Sphinx documents.
171 # "<project> v<release> documentation" by default.
172 #
173 # html_title = 'Linux Foundation Release Engineering Tools v0.0.1'
174
175 # A shorter title for the navigation bar.  Default is the same as html_title.
176 #
177 # html_short_title = None
178
179 # The name of an image file (relative to this directory) to place at the top
180 # of the sidebar.
181 #
182 html_logo = '_static/lf-logo-small.png'
183
184 # The name of an image file (relative to this directory) to use as a favicon of
185 # the docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
186 # pixels large.
187 #
188 html_favicon = 'favicon.ico'
189
190 # Add any paths that contain custom static files (such as style sheets) here,
191 # relative to this directory. They are copied after the builtin static files,
192 # so a file named "default.css" will overwrite the builtin "default.css".
193 html_static_path = ['_static']
194
195 # Add any extra paths that contain custom files (such as robots.txt or
196 # .htaccess) here, relative to this directory. These files are copied
197 # directly to the root of the documentation.
198 #
199 # html_extra_path = []
200
201 # If not None, a 'Last updated on:' timestamp is inserted at every page
202 # bottom, using the given strftime format.
203 # The empty string is equivalent to '%b %d, %Y'.
204 #
205 # html_last_updated_fmt = None
206
207 # If true, SmartyPants will be used to convert quotes and dashes to
208 # typographically correct entities.
209 #
210 # html_use_smartypants = True
211
212 # Custom sidebar templates, maps document names to template names.
213 #
214 html_sidebars = {
215     '**': ['localtoc.html', 'relations.html'],
216 }
217
218 # Additional templates that should be rendered to pages, maps page names to
219 # template names.
220 #
221 # html_additional_pages = {}
222
223 # If false, no module index is generated.
224 #
225 # html_domain_indices = True
226
227 # If false, no index is generated.
228 #
229 # html_use_index = True
230
231 # If true, the index is split into individual pages for each letter.
232 #
233 # html_split_index = False
234
235 # If true, links to the reST sources are added to the pages.
236 #
237 # html_show_sourcelink = True
238
239 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
240 #
241 # html_show_sphinx = True
242
243 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
244 #
245 # html_show_copyright = True
246
247 # If true, an OpenSearch description file will be output, and all pages will
248 # contain a <link> tag referring to it.  The value of this option must be the
249 # base URL from which the finished HTML is served.
250 #
251 # html_use_opensearch = ''
252
253 # This is the file name suffix for HTML files (e.g. ".xhtml").
254 # html_file_suffix = None
255
256 # Language to be used for generating the HTML full-text search index.
257 # Sphinx supports the following languages:
258 #   'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
259 #   'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr', 'zh'
260 #
261 # html_search_language = 'en'
262
263 # A dictionary with options for the search language support, empty by default.
264 # 'ja' uses this config value.
265 # 'zh' user can custom change `jieba` dictionary path.
266 #
267 # html_search_options = {'type': 'default'}
268
269 # The name of a javascript file (relative to the configuration directory) that
270 # implements a search results scorer. If empty, the default will be used.
271 #
272 # html_search_scorer = 'scorer.js'
273
274 # Output file base name for HTML help builder.
275 htmlhelp_basename = 'LinuxFoundationReleaseEngineeringGJJBdoc'
276
277 # Example configuration for intersphinx: refer to the Python standard library.
278 intersphinx_mapping = {
279     'jjb': ('https://jenkins-job-builder.readthedocs.io/en/latest/', None),
280     'lfdocs': ('http://docs.releng.linuxfoundation.org/en/latest/', None),
281     'lftools': ('http://lftools.releng.linuxfoundation.org/en/latest/', None),
282     'python': ('https://docs.python.org/', None),
283 }