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.6',
91 '{exc_repo_leap}': 'https://download.opensuse.org/distribution/leap/16.0/repo/oss',
92 '{exc_repo_tumbleweed}': 'https://download.opensuse.org/tumbleweed/repo/oss',
93 '{exc_repo_rawhide}': 'https://mirrors.fedoraproject.org/metalink?repo=rawhide&arch=x86_64',
94 '{exc_kiwi_repo}':
95 'obs://Virtualization:Appliances:Builder/openSUSE_Leap_16.0',
96 '{exc_repo_obs}': 'obs://openSUSE:Leap:16.0/standard',
97 '{schema_version}': '8.5',
98 '{kiwi}': 'KIWI NG',
99 '{kiwi-product}': 'KIWI Next Generation (KIWI NG)',
100 '{kiwi-legacy}': 'KIWI Legacy'
101 }
102
103 latex_documents = [
104 ('index', 'kiwi.tex', 'KIWI NG Documentation', 'Marcus Schäfer', 'manual')
105 ]
106 latex_elements = {
107 'papersize': 'a4paper',
108 'pointsize':'12pt',
109 'classoptions': ',openany',
110 'babel': '\\usepackage[english]{babel}',
111 'preamble': r'''
112 \makeatletter
113 \fancypagestyle{normal}{
114 \fancyhf{}
115 \fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
116 \fancyfoot[LO]{{\py@HeaderFamily\nouppercase{\rightmark}}}
117 \fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}}
118 \fancyhead[LE,RO]{{\py@HeaderFamily \@title, \py@release}}
119 \renewcommand{\headrulewidth}{0.4pt}
120 \renewcommand{\footrulewidth}{0.4pt}
121 }
122 \makeatother
123 '''
124 }
125
126 # Add any paths that contain templates here, relative to this directory.
127 templates_path = ['.templates']
128
129 # The suffix(es) of source filenames.
130 # You can specify multiple suffix as a list of string:
131 # source_suffix = ['.rst', '.md']
132 source_suffix = '.rst'
133
134 # The encoding of source files.
135 source_encoding = 'utf-8-sig'
136
137 # The master toctree document.
138 master_doc = 'index'
139
140 default_role="py:obj"
141
142 # General information about the project.
143 project = 'KIWI NG'
144 author = 'Marcus Schäfer'
145 copyright = f'2020-{datetime.now().year}, {author}'
146
147 # The version info for the project you're documenting, acts as replacement for
148 # |version| and |release|, also used in various other places throughout the
149 # built documents.
150 #
151 # The short X.Y version.
152 version = '11.0.3'
153 # The full version, including alpha/beta/rc tags.
154 release = version
155
156 # The language for content autogenerated by Sphinx. Refer to documentation
157 # for a list of supported languages.
158 #
159 # This is also used if you do content translation via gettext catalogs.
160 # Usually you set "language" from the command line for these cases.
161 language = 'en'
162
163 # List of patterns, relative to source directory, that match files and
164 # directories to ignore when looking for source files.
165 exclude_patterns = []
166
167 # If true, '()' will be appended to :func: etc. cross-reference text.
168 #add_function_parentheses = True
169
170 # If true, the current module name will be prepended to all description
171 # unit titles (such as .. function::).
172 #add_module_names = True
173
174 # If true, sectionauthor and moduleauthor directives will be shown in the
175 # output. They are ignored by default.
176 #show_authors = False
177
178 # The name of the Pygments (syntax highlighting) style to use.
179 pygments_style = 'sphinx'
180
181 # A list of ignored prefixes for module index sorting.
182 #modindex_common_prefix = []
183
184 # If true, keep warnings as "system message" paragraphs in the built documents.
185 #keep_warnings = False
186
187 # If true, `todo` and `todoList` produce output, else they produce nothing.
188 todo_include_todos = True
189
190 autosummary_generate = True
191
192 #spelling_lang = 'en_US'
193 #spelling_show_suggestions = True
194 #spelling_word_list_filename = ['spelling_wordlist.txt']
195
196 # -- Options for HTML output ----------------------------------------------
197
198 #html_short_title = '%s-%s' % (project, version)
199 #html_last_updated_fmt = '%b %d, %Y'
200 #html_split_index = True
201 html_logo = '.images/kiwi-logo.png'
202
203 html_sidebars = {
204 '**': [
205 'localtoc.html', 'relations.html',
206 'about.html', 'searchbox.html',
207 ]
208 }
209
210 html_theme = "sphinx_rtd_theme"
211
212 html_theme_options = {
213 'collapse_navigation': False,
214 'sticky_navigation': True,
215 'navigation_depth': 4,
216 'includehidden': True,
217 'titles_only': False
218 }
219
220 # -- Options for manual page output ---------------------------------------
221
222 # The man page toctree documents.
223 kiwi_doc = 'commands/kiwi'
224 result_list_doc = 'commands/result_list'
225 result_bundle_doc = 'commands/result_bundle'
226 system_prepare_doc = 'commands/system_prepare'
227 system_update_doc = 'commands/system_update'
228 system_build_doc = 'commands/system_build'
229 system_create_doc = 'commands/system_create'
230 image_resize_doc = 'commands/image_resize'
231 image_info_doc = 'commands/image_info'
232
233 # One entry per manual page. List of tuples
234 # (source start file, name, description, authors, manual section).
235 man_pages = [
236 (
237 kiwi_doc,
238 'kiwi', 'Creating Operating System Images',
239 [author],
240 8
241 ),
242 (
243 result_list_doc,
244 'kiwi::result::list',
245 'List build results',
246 [author],
247 8
248 ),
249 (
250 result_bundle_doc,
251 'kiwi::result::bundle',
252 'Bundle build results',
253 [author],
254 8
255 ),
256 (
257 system_prepare_doc,
258 'kiwi::system::prepare',
259 'Prepare image root system',
260 [author],
261 8
262 ),
263 (
264 system_create_doc,
265 'kiwi::system::create',
266 'Create image from prepared root system',
267 [author],
268 8
269 ),
270 (
271 system_update_doc,
272 'kiwi::system::update',
273 'Update/Upgrade image root system',
274 [author],
275 8
276 ),
277 (
278 system_build_doc,
279 'kiwi::system::build',
280 'Build image in combined prepare and create step',
281 [author],
282 8
283 ),
284 (
285 image_resize_doc,
286 'kiwi::image::resize',
287 'Resize disk images to new geometry',
288 [author],
289 8
290 ),
291 (
292 image_info_doc,
293 'kiwi::image::info',
294 'Provide detailed information about an image description',
295 [author],
296 8
297 )
298 ]
299
300 # If true, show URL addresses after external links.
301 #man_show_urls = False