Skip to content

Commit b267178

Browse files
mchehabJonathan Corbet
authored andcommitted
docs: conf.py: drop backward support for old Sphinx versions
Since commit 5e25b97 ("docs: changes: update Python minimal version"), the minimal Sphinx version is 3.4.3. Drop support for older versions from the config file. Signed-off-by: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Jonathan Corbet <[email protected]> Message-ID: <[email protected]>
1 parent 1884847 commit b267178

File tree

1 file changed

+65
-97
lines changed

1 file changed

+65
-97
lines changed

Documentation/conf.py

Lines changed: 65 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,6 @@ def have_command(cmd):
2828
"""
2929
return shutil.which(cmd) is not None
3030

31-
# Get Sphinx version
32-
major, minor, patch = sphinx.version_info[:3]
33-
34-
#
35-
# Warn about older versions that we don't want to support for much
36-
# longer.
37-
#
38-
if (major < 2) or (major == 2 and minor < 4):
39-
print('WARNING: support for Sphinx < 2.4 will be removed soon.')
40-
4131
# If extensions (or modules to document with autodoc) are in another directory,
4232
# add these directories to sys.path here. If the directory is relative to the
4333
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -57,76 +47,71 @@ def have_command(cmd):
5747
'maintainers_include', 'sphinx.ext.autosectionlabel',
5848
'kernel_abi', 'kernel_feat', 'translations']
5949

60-
if major >= 3:
61-
if (major > 3) or (minor > 0 or patch >= 2):
62-
# Sphinx c function parser is more pedantic with regards to type
63-
# checking. Due to that, having macros at c:function cause problems.
64-
# Those needed to be scaped by using c_id_attributes[] array
65-
c_id_attributes = [
66-
# GCC Compiler types not parsed by Sphinx:
67-
"__restrict__",
68-
69-
# include/linux/compiler_types.h:
70-
"__iomem",
71-
"__kernel",
72-
"noinstr",
73-
"notrace",
74-
"__percpu",
75-
"__rcu",
76-
"__user",
77-
"__force",
78-
"__counted_by_le",
79-
"__counted_by_be",
80-
81-
# include/linux/compiler_attributes.h:
82-
"__alias",
83-
"__aligned",
84-
"__aligned_largest",
85-
"__always_inline",
86-
"__assume_aligned",
87-
"__cold",
88-
"__attribute_const__",
89-
"__copy",
90-
"__pure",
91-
"__designated_init",
92-
"__visible",
93-
"__printf",
94-
"__scanf",
95-
"__gnu_inline",
96-
"__malloc",
97-
"__mode",
98-
"__no_caller_saved_registers",
99-
"__noclone",
100-
"__nonstring",
101-
"__noreturn",
102-
"__packed",
103-
"__pure",
104-
"__section",
105-
"__always_unused",
106-
"__maybe_unused",
107-
"__used",
108-
"__weak",
109-
"noinline",
110-
"__fix_address",
111-
"__counted_by",
112-
113-
# include/linux/memblock.h:
114-
"__init_memblock",
115-
"__meminit",
116-
117-
# include/linux/init.h:
118-
"__init",
119-
"__ref",
120-
121-
# include/linux/linkage.h:
122-
"asmlinkage",
123-
124-
# include/linux/btf.h
125-
"__bpf_kfunc",
126-
]
127-
128-
else:
129-
extensions.append('cdomain')
50+
# Since Sphinx version 3, the C function parser is more pedantic with regards
51+
# to type checking. Due to that, having macros at c:function cause problems.
52+
# Those needed to be escaped by using c_id_attributes[] array
53+
c_id_attributes = [
54+
# GCC Compiler types not parsed by Sphinx:
55+
"__restrict__",
56+
57+
# include/linux/compiler_types.h:
58+
"__iomem",
59+
"__kernel",
60+
"noinstr",
61+
"notrace",
62+
"__percpu",
63+
"__rcu",
64+
"__user",
65+
"__force",
66+
"__counted_by_le",
67+
"__counted_by_be",
68+
69+
# include/linux/compiler_attributes.h:
70+
"__alias",
71+
"__aligned",
72+
"__aligned_largest",
73+
"__always_inline",
74+
"__assume_aligned",
75+
"__cold",
76+
"__attribute_const__",
77+
"__copy",
78+
"__pure",
79+
"__designated_init",
80+
"__visible",
81+
"__printf",
82+
"__scanf",
83+
"__gnu_inline",
84+
"__malloc",
85+
"__mode",
86+
"__no_caller_saved_registers",
87+
"__noclone",
88+
"__nonstring",
89+
"__noreturn",
90+
"__packed",
91+
"__pure",
92+
"__section",
93+
"__always_unused",
94+
"__maybe_unused",
95+
"__used",
96+
"__weak",
97+
"noinline",
98+
"__fix_address",
99+
"__counted_by",
100+
101+
# include/linux/memblock.h:
102+
"__init_memblock",
103+
"__meminit",
104+
105+
# include/linux/init.h:
106+
"__init",
107+
"__ref",
108+
109+
# include/linux/linkage.h:
110+
"asmlinkage",
111+
112+
# include/linux/btf.h
113+
"__bpf_kfunc",
114+
]
130115

131116
# Ensure that autosectionlabel will produce unique names
132117
autosectionlabel_prefix_document = True
@@ -149,10 +134,6 @@ def have_command(cmd):
149134
else:
150135
sys.stderr.write("Unknown env SPHINX_IMGMATH=%s ignored.\n" % env_sphinx_imgmath)
151136

152-
# Always load imgmath for Sphinx <1.8 or for epub docs
153-
load_imgmath = (load_imgmath or (major == 1 and minor < 8)
154-
or 'epub' in sys.argv)
155-
156137
if load_imgmath:
157138
extensions.append("sphinx.ext.imgmath")
158139
math_renderer = 'imgmath'
@@ -322,14 +303,6 @@ def get_cline_version():
322303
for l in css:
323304
html_css_files.append(l)
324305

325-
if major <= 1 and minor < 8:
326-
html_context = {
327-
'css_files': [],
328-
}
329-
330-
for l in html_css_files:
331-
html_context['css_files'].append('_static/' + l)
332-
333306
if html_theme == 'alabaster':
334307
html_theme_options = {
335308
'description': get_cline_version(),
@@ -409,11 +382,6 @@ def get_cline_version():
409382
''',
410383
}
411384

412-
# Fix reference escape troubles with Sphinx 1.4.x
413-
if major == 1:
414-
latex_elements['preamble'] += '\\renewcommand*{\\DUrole}[2]{ #2 }\n'
415-
416-
417385
# Load kerneldoc specific LaTeX settings
418386
latex_elements['preamble'] += '''
419387
% Load kerneldoc specific LaTeX settings

0 commit comments

Comments
 (0)