Debian Codegraph @

doc/source/conf.py

raw
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 #
4 # KIWI NG documentation build configuration file
5 #
6 from datetime import datetime
7 import sys
8 from os.path import abspath, dirname, join, normpath
9 import shlex
10
11 from sphinx.transforms import SphinxTransform
12
13
14 # If extensions (or modules to document with autodoc) are in another directory,
15 # add these directories to sys.path here. If the directory is relative to the
16 # documentation root, use os.path.abspath to make it absolute, like shown here.
17 _path = normpath(join(dirname(__file__), "../.."))
18 sys.path.insert(0, _path)
19
20
21 # -- General configuration ------------------------------------------------
22
23 # If your documentation needs a minimal Sphinx version, state it here.
24 #needs_sphinx = '1.0'
25
26 # Add any Sphinx extension module names here, as strings. They can be
27 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
28 # ones.
29
30 extensions = [
31 'sphinx.ext.autodoc',
32 'sphinx.ext.autosummary',
33 'sphinx.ext.extlinks',
34 'sphinx.ext.todo',
35 'sphinx.ext.ifconfig',
36 'sphinx.ext.viewcode',
37 # 'sphinxcontrib.spelling',
38 'sphinx_rtd_theme'
39 ]
40
41 def prologReplace(app, docname, source):
42 result = source[0]
43 for key in app.config.prolog_replacements:
44 result = result.replace(key, app.config.prolog_replacements[key])
45 source[0] = result
46
47 class AddRootRole(SphinxTransform):
48 # Runs after the document is parsed and the source path is set
49 default_priority = 500
50
51 def apply(self):
52 master_doc = self.config.master_doc
53
54 # Get the current document name relative to the source directory
55 # e.g., 'index', 'folder/subpage', etc.
56 docname = self.env.docname
57
58 # Only apply the attribute if this is the main entry point
59 if docname == master_doc:
60 self.document['role'] = 'main'
61
62
63 def setup(app):
64 app.add_config_value('prolog_replacements', {}, True)
65 app.add_transform(AddRootRole)
66 app.connect('source-read', prologReplace)
67
68
69 prolog_replacements = {
70 '{exc_image_base_name}': 'kiwi-test-image-some',
71 '{exc_image_base_name_pxe}': 'kiwi-test-image-pxe',
72 '{exc_image_base_name_kis}': 'kiwi-test-image-kis',
73 '{exc_image_base_name_vagrant}': 'kiwi-test-image-vagrant',
74 '{exc_image_base_name_disk}': 'kiwi-test-image-disk',
75 '{exc_image_base_name_disk_simple}': 'kiwi-test-image-disk-simple',
76 '{exc_image_base_name_live}': 'kiwi-test-image-live',
77 '{exc_image_base_name_docker}': 'kiwi-test-image-docker',
78 '{exc_image_base_name_enclave}': 'kiwi-test-image-nitro-enclave',
79 '{exc_netboot}': 'netboot/suse-tumbleweed',
80 '{exc_description_pxe}': 'x86/tumbleweed/test-image-pxe',
81 '{exc_description_kis}': 'x86/tumbleweed/test-image-kis',
82 '{exc_description_vagrant}': 'x86/leap/test-image-vagrant',
83 '{exc_description_disk}': 'x86/leap/test-image-disk',
84 '{exc_description_disk_simple}': 'x86/leap/test-image-disk-simple',
85 '{exc_description_live}': 'x86/leap/test-image-live',
86 '{exc_description_wsl}': 'x86/tumbleweed/test-image-wsl',
87 '{exc_description_docker}': 'x86/leap/test-image-docker',
88 '{exc_description_enclave}': 'x86/rawhide/test-image-nitro-enclave',
89 '{exc_os_version}': '16.0',
90 '{exc_image_version}': '1.15.3',
91 '{exc_image_version_pxe}': '1.42.1',
92 '{exc_image_version_kis}': '1.42.1',
93 '{exc_image_version_enclave}': '1.1.1',
94 '{exc_repo_leap}': 'https://download.opensuse.org/distribution/leap/16.0/repo/oss',
95 '{exc_repo_tumbleweed}': 'https://download.opensuse.org/tumbleweed/repo/oss',
96 '{exc_repo_rawhide}': 'https://mirrors.fedoraproject.org/metalink?repo=rawhide&arch=x86_64',
97 '{exc_kiwi_repo}':
98 'obs://Virtualization:Appliances:Builder/openSUSE_Leap_16.0',
99 '{exc_repo_obs}': 'obs://openSUSE:Leap:16.0/standard',
100 '{schema_version}': '8.5',
101 '{kiwi}': 'KIWI NG',
102 '{kiwi-product}': 'KIWI Next Generation (KIWI NG)',
103 '{kiwi-legacy}': 'KIWI Legacy'
104 }
105
106 latex_documents = [
107 ('index', 'kiwi.tex', 'KIWI NG Documentation', 'Marcus Schäfer', 'manual')
108 ]
109 latex_elements = {
110 'papersize': 'a4paper',
111 'pointsize':'12pt',
112 'classoptions': ',openany',
113 'babel': '\\usepackage[english]{babel}',
114 'preamble': r'''
115 \makeatletter
116 \fancypagestyle{normal}{
117 \fancyhf{}
118 \fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
119 \fancyfoot[LO]{{\py@HeaderFamily\nouppercase{\rightmark}}}
120 \fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}}
121 \fancyhead[LE,RO]{{\py@HeaderFamily \@title, \py@release}}
122 \renewcommand{\headrulewidth}{0.4pt}
123 \renewcommand{\footrulewidth}{0.4pt}
124 }
125 \makeatother
126 '''
127 }
128
129 # Add any paths that contain templates here, relative to this directory.
130 templates_path = ['.templates']
131
132 # The suffix(es) of source filenames.
133 # You can specify multiple suffix as a list of string:
134 # source_suffix = ['.rst', '.md']
135 source_suffix = '.rst'
136
137 # The encoding of source files.
138 source_encoding = 'utf-8-sig'
139
140 # The master toctree document.
141 master_doc = 'index'
142
143 default_role="py:obj"
144
145 # General information about the project.
146 project = 'KIWI NG'
147 author = 'Marcus Schäfer'
148 copyright = f'2020-{datetime.now().year}, {author}'
149
150 # The version info for the project you're documenting, acts as replacement for
151 # |version| and |release|, also used in various other places throughout the
152 # built documents.
153 #
154 # The short X.Y version.
155 version = '11.1.0'
156 # The full version, including alpha/beta/rc tags.
157 release = version
158
159 # The language for content autogenerated by Sphinx. Refer to documentation
160 # for a list of supported languages.
161 #
162 # This is also used if you do content translation via gettext catalogs.
163 # Usually you set "language" from the command line for these cases.
164 language = 'en'
165
166 # List of patterns, relative to source directory, that match files and
167 # directories to ignore when looking for source files.
168 exclude_patterns = []
169
170 # If true, '()' will be appended to :func: etc. cross-reference text.
171 #add_function_parentheses = True
172
173 # If true, the current module name will be prepended to all description
174 # unit titles (such as .. function::).
175 #add_module_names = True
176
177 # If true, sectionauthor and moduleauthor directives will be shown in the
178 # output. They are ignored by default.
179 #show_authors = False
180
181 # The name of the Pygments (syntax highlighting) style to use.
182 pygments_style = 'sphinx'
183
184 # A list of ignored prefixes for module index sorting.
185 #modindex_common_prefix = []
186
187 # If true, keep warnings as "system message" paragraphs in the built documents.
188 #keep_warnings = False
189
190 # If true, `todo` and `todoList` produce output, else they produce nothing.
191 todo_include_todos = True
192
193 autosummary_generate = True
194
195 #spelling_lang = 'en_US'
196 #spelling_show_suggestions = True
197 #spelling_word_list_filename = ['spelling_wordlist.txt']
198
199 # -- Options for HTML output ----------------------------------------------
200
201 #html_short_title = '%s-%s' % (project, version)
202 #html_last_updated_fmt = '%b %d, %Y'
203 #html_split_index = True
204 html_logo = '.images/kiwi-logo.png'
205
206 html_sidebars = {
207 '**': [
208 'localtoc.html', 'relations.html',
209 'about.html', 'searchbox.html',
210 ]
211 }
212
213 html_theme = "sphinx_rtd_theme"
214
215 html_theme_options = {
216 'collapse_navigation': False,
217 'sticky_navigation': True,
218 'navigation_depth': 3,
219 'includehidden': True,
220 'titles_only': False
221 }
222
223 # -- Options for manual page output ---------------------------------------
224
225 # The man page toctree documents.
226 kiwi_doc = 'commands/kiwi'
227 result_list_doc = 'commands/result_list'
228 result_bundle_doc = 'commands/result_bundle'
229 system_prepare_doc = 'commands/system_prepare'
230 system_update_doc = 'commands/system_update'
231 system_build_doc = 'commands/system_build'
232 system_boxbuild_doc = 'commands/system_boxbuild'
233 system_create_doc = 'commands/system_create'
234 system_stackbuild_doc = 'commands/system_stackbuild'
235 system_stash_doc = 'commands/system_stash'
236 image_resize_doc = 'commands/image_resize'
237 image_info_doc = 'commands/image_info'
238
239 # One entry per manual page. List of tuples
240 # (source start file, name, description, authors, manual section).
241 man_pages = [
242 (
243 kiwi_doc,
244 'kiwi', 'Creating Operating System Images',
245 [author],
246 8
247 ),
248 (
249 result_list_doc,
250 'kiwi::result::list',
251 'List build results',
252 [author],
253 8
254 ),
255 (
256 result_bundle_doc,
257 'kiwi::result::bundle',
258 'Bundle build results',
259 [author],
260 8
261 ),
262 (
263 system_prepare_doc,
264 'kiwi::system::prepare',
265 'Prepare image root system',
266 [author],
267 8
268 ),
269 (
270 system_create_doc,
271 'kiwi::system::create',
272 'Create image from prepared root system',
273 [author],
274 8
275 ),
276 (
277 system_update_doc,
278 'kiwi::system::update',
279 'Update/Upgrade image root system',
280 [author],
281 8
282 ),
283 (
284 system_build_doc,
285 'kiwi::system::build',
286 'Build image in combined prepare and create step',
287 [author],
288 8
289 ),
290 (
291 system_boxbuild_doc,
292 'kiwi::system::boxbuild',
293 'Build image in a self contained VM or container',
294 [author],
295 8
296 ),
297 (
298 system_stackbuild_doc,
299 'kiwi::system::stackbuild',
300 'Build image based on stash containers',
301 [author],
302 8
303 ),
304 (
305 system_stash_doc,
306 'kiwi::system::stash',
307 'Create a stash container from an image root directory',
308 [author],
309 8
310 ),
311 (
312 image_resize_doc,
313 'kiwi::image::resize',
314 'Resize disk images to new geometry',
315 [author],
316 8
317 ),
318 (
319 image_info_doc,
320 'kiwi::image::info',
321 'Provide detailed information about an image description',
322 [author],
323 8
324 )
325 ]
326
327 # If true, show URL addresses after external links.
328 #man_show_urls = False