History

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.

Mauro Carvalho Chehab committed 1 year ago

Commit 7740f9d1 parent 2d48d3e1 file · +10 −0Browse files

Unified · Split

scripts/kernel-doc.py+10−0
@@ -271,6 +271,16 @@ def main(): · 270 unmodified lines
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: