Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: automarkup: drop legacy support

Python 2 is already EOL for quite some time. Drop support for
it.

Also, the minimal Sphinx version is now 3.4.3. So, we can drop
support for Sphinx < 3.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/5cb57d158e42957d4bff06db38be141d849ac13b.1739254867.git.mchehab+huawei@kernel.org

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
174dbf0d ff7ff6eb

+7 -25
+7 -25
Documentation/sphinx/automarkup.py
··· 14 14 from kernel_abi import get_kernel_abi 15 15 16 16 # 17 - # Python 2 lacks re.ASCII... 18 - # 19 - try: 20 - ascii_p3 = re.ASCII 21 - except AttributeError: 22 - ascii_p3 = 0 23 - 24 - # 25 17 # Regex nastiness. Of course. 26 18 # Try to identify "function()" that's not already marked up some 27 19 # other way. Sphinx doesn't like a lot of stuff right after a 28 20 # :c:func: block (i.e. ":c:func:`mmap()`s" flakes out), so the last 29 21 # bit tries to restrict matches to things that won't create trouble. 30 22 # 31 - RE_function = re.compile(r'\b(([a-zA-Z_]\w+)\(\))', flags=ascii_p3) 23 + RE_function = re.compile(r'\b(([a-zA-Z_]\w+)\(\))', flags=re.ASCII) 32 24 33 25 # 34 26 # Sphinx 2 uses the same :c:type role for struct, union, enum and typedef 35 27 # 36 28 RE_generic_type = re.compile(r'\b(struct|union|enum|typedef)\s+([a-zA-Z_]\w+)', 37 - flags=ascii_p3) 29 + flags=re.ASCII) 38 30 39 31 # 40 32 # Sphinx 3 uses a different C role for each one of struct, union, enum and 41 33 # typedef 42 34 # 43 - RE_struct = re.compile(r'\b(struct)\s+([a-zA-Z_]\w+)', flags=ascii_p3) 44 - RE_union = re.compile(r'\b(union)\s+([a-zA-Z_]\w+)', flags=ascii_p3) 45 - RE_enum = re.compile(r'\b(enum)\s+([a-zA-Z_]\w+)', flags=ascii_p3) 46 - RE_typedef = re.compile(r'\b(typedef)\s+([a-zA-Z_]\w+)', flags=ascii_p3) 35 + RE_struct = re.compile(r'\b(struct)\s+([a-zA-Z_]\w+)', flags=re.ASCII) 36 + RE_union = re.compile(r'\b(union)\s+([a-zA-Z_]\w+)', flags=re.ASCII) 37 + RE_enum = re.compile(r'\b(enum)\s+([a-zA-Z_]\w+)', flags=re.ASCII) 38 + RE_typedef = re.compile(r'\b(typedef)\s+([a-zA-Z_]\w+)', flags=re.ASCII) 47 39 48 40 # 49 41 # Detects a reference to a documentation page of the form Documentation/... with ··· 79 87 # 80 88 # Associate each regex with the function that will markup its matches 81 89 # 82 - markup_func_sphinx2 = {RE_doc: markup_doc_ref, 83 - RE_abi_file: markup_abi_file_ref, 84 - RE_abi_symbol: markup_abi_ref, 85 - RE_function: markup_c_ref, 86 - RE_generic_type: markup_c_ref} 87 90 88 - markup_func_sphinx3 = {RE_doc: markup_doc_ref, 91 + markup_func = {RE_doc: markup_doc_ref, 89 92 RE_abi_file: markup_abi_file_ref, 90 93 RE_abi_symbol: markup_abi_ref, 91 94 RE_function: markup_func_ref_sphinx3, ··· 89 102 RE_enum: markup_c_ref, 90 103 RE_typedef: markup_c_ref, 91 104 RE_git: markup_git} 92 - 93 - if sphinx.version_info[0] >= 3: 94 - markup_func = markup_func_sphinx3 95 - else: 96 - markup_func = markup_func_sphinx2 97 105 98 106 match_iterators = [regex.finditer(t) for regex in markup_func] 99 107 #