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

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 <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/7d7fa3a3aa1fafa0cc9ea29c889de4c7d377dca6.1752218291.git.mchehab+huawei@kernel.org

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
7740f9db 2d48d3e4

+10
+10
scripts/kernel-doc.py
··· 271 271 272 272 logger.addHandler(handler) 273 273 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 + 274 284 if args.man: 275 285 out_style = ManFormat(modulename=args.modulename) 276 286 elif args.none: