Skip to content

Commit 7740f9d

Browse files
mchehabJonathan Corbet
authored andcommitted
docs: kernel-doc: emit warnings for ancient versions of Python
Kernel-doc requires at least version 3.6 to run, as it uses f-string. Yet, Kernel build currently calls kernel-doc with -none on some places. Better not to bail out when older versions are found. Versions of Python prior to 3.7 do not guarantee to remember the insertion order of dicts; since kernel-doc depends on that guarantee, running with such older versions could result in output with reordered sections. Check Python version when called via command line. Signed-off-by: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Jonathan Corbet <[email protected]> Link: https://lore.kernel.org/r/7d7fa3a3aa1fafa0cc9ea29c889de4c7d377dca6.1752218291.git.mchehab+huawei@kernel.org
1 parent 2d48d3e commit 7740f9d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

scripts/kernel-doc.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,16 @@ def main():
271271

272272
logger.addHandler(handler)
273273

274+
python_ver = sys.version_info[:2]
275+
if python_ver < (3,6):
276+
logger.warning("Python 3.6 or later is required by kernel-doc")
277+
278+
# Return 0 here to avoid breaking compilation
279+
sys.exit(0)
280+
281+
if python_ver < (3,7):
282+
logger.warning("Python 3.7 or later is required for correct results")
283+
274284
if args.man:
275285
out_style = ManFormat(modulename=args.modulename)
276286
elif args.none:

0 commit comments

Comments
 (0)