-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconf.py
112 lines (91 loc) · 3.35 KB
/
conf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = 'elos'
copyright = '2023, wolfgang.gehrhardt@emlix.com'
author = 'wolfgang.gehrhardt@emlix.com'
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = [
'myst_parser',
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinxcontrib.programoutput',
'sphinxcontrib.plantuml',
'sphinx_favicon',
"sphinx.ext.autosectionlabel", # better cross referencing
# copy button on code blocks in HTML doc
'sphinx_copybutton',
# for code documentation & referencing
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx_c_autodoc',
'sphinx_c_autodoc.napoleon',
'sphinx_c_autodoc.viewcode',
]
myst_enable_extensions = ["tasklist"]
autosectionlabel_prefix_document = True
autosectionlabel_maxdepth = 2
templates_path = ['doc/_templates']
exclude_patterns = ['build/deps/**', 'build/*/cmake/_deps/*', 'README.md', '.venv']
source_suffix = {
'.rst': 'restructuredtext',
'.md': 'markdown',
}
language = 'en'
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = 'alabaster'
html_static_path = ['doc/static']
html_logo = 'doc/static/elos_blue.png'
favicons = [
"favicon_16x16.png",
"favicon_32x32.png",
]
# plantuml
plantuml_output_format = 'png'
plantuml_batch_size = 100
plantuml_cache_path = 'build/_plantum'
# c-autodoc
c_autodoc_roots = []
c_autodoc_compilation_args = [
# '-DSPHINX_C_AUTODOC_USE_BROKEN_FUNC_POINTER_TYPEDEFS',
]
c_autodoc_ignore_statements = [
'__BEGIN_DECLS',
'__END_DECLS',
]
set_type_checking_flag = True
import os
def populate_c_autodoc_roots():
global c_autodoc_roots
source_directories = ['./src']
excluded_directories = [
'./src/clients',
'./src/demos',
'./src/version',
'./src/libelos/private',
'./src/plugins/clients/dummy',
'./src/plugins/storagebackends/dummy',
'./src/plugins/scanners/dummy'
]
excluded_directories = [os.path.abspath(directory) for directory in excluded_directories]
for source_dir in source_directories:
if os.path.exists(source_dir):
for current_root, subdirectories, _ in os.walk(source_dir):
normalized_root = os.path.abspath(current_root)
if not any(normalized_root.startswith(excluded_dir) for excluded_dir in excluded_directories):
c_autodoc_roots.append(current_root)
def pre_process_C_files(app, filename, contents, *args):
_, file_ext = os.path.splitext(filename)
if file_ext == '.h':
modified_contents = contents[0]
for element in c_autodoc_ignore_statements:
modified_contents = modified_contents.replace(element, '')
contents[:] = [modified_contents]
def setup(sphinx):
populate_c_autodoc_roots()
sphinx.connect("c-autodoc-pre-process", pre_process_C_files)