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.

scripts: test_doc_build.py: regroup and rename arguments

The script now have lots or arguments. Better organize and
name them, for it to be a little bit more intuitive.

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

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
bb4c5c50 61aeda1e

+61 -34
+61 -34
scripts/test_doc_build.py
··· 269 269 270 270 ver = ".".join(map(str, cur_ver)) 271 271 272 - if not self.first_run and args.wait_input and args.make: 272 + if not self.first_run and args.wait_input and args.build: 273 273 ret = input("Press Enter to continue or 'a' to abort: ").strip().lower() 274 274 if ret == "a": 275 275 print("Aborted.") ··· 300 300 result = await cmd.run([pip, "freeze"], verbose=False, check=True) 301 301 302 302 # Pip install succeeded. Write requirements file 303 - if args.write: 303 + if args.req_file: 304 304 with open(req_file, "w", encoding="utf-8") as fp: 305 305 fp.write(result.stdout) 306 306 307 - if args.make: 307 + if args.build: 308 308 start_time = time.time() 309 309 310 310 # Prepare a venv environment ··· 317 317 318 318 # Test doc build 319 319 await cmd.run(["make", "cleandocs"], env=env, check=True) 320 - make = ["make"] + args.make_args + ["htmldocs"] 320 + make = ["make"] 321 + 322 + if args.output: 323 + sphinx_build = os.path.realpath(f"{bin_dir}/sphinx-build") 324 + make += [f"O={args.output}", f"SPHINXBUILD={sphinx_build}"] 325 + 326 + if args.make_args: 327 + make += args.make_args 328 + 329 + make += args.targets 321 330 322 331 if args.verbose: 323 332 cmd.log(f". {bin_dir}/activate", verbose=True) ··· 389 380 await self._handle_version(args, fp, cur_ver, cur_requirements, 390 381 python_bin) 391 382 392 - if args.make: 383 + if args.build: 393 384 cmd = AsyncCommands(fp) 394 385 cmd.log("\nSummary:", verbose=True) 395 386 for ver, elapsed_time in sorted(self.built_time.items()): ··· 416 407 Sphinx versions that are supported by the Linux Kernel build system. 417 408 418 409 Besides creating the virtual environment, it can also test building 419 - the documentation using "make htmldocs". 410 + the documentation using "make htmldocs" (and/or other doc targets). 420 411 421 412 If called without "--versions" argument, it covers the versions shipped 422 413 on major distros, plus the lowest supported version: ··· 427 418 428 419 {SCRIPT} -m -l sphinx_builds.log 429 420 430 - This will create one virtual env for the default version set and do a 431 - full htmldocs build for each version, creating a log file with the 421 + This will create one virtual env for the default version set and run 422 + "make htmldocs" for each version, creating a log file with the 432 423 excecuted commands on it. 433 424 434 425 NOTE: The build time can be very long, specially on old versions. Also, there ··· 442 433 443 434 """ 444 435 436 + MAKE_TARGETS = [ 437 + "htmldocs", 438 + "texinfodocs", 439 + "infodocs", 440 + "latexdocs", 441 + "pdfdocs", 442 + "epubdocs", 443 + "xmldocs", 444 + ] 445 445 446 446 async def main(): 447 447 """Main program""" ··· 458 440 parser = argparse.ArgumentParser(description=DESCRIPTION, 459 441 formatter_class=argparse.RawDescriptionHelpFormatter) 460 442 461 - parser.add_argument('-V', '--versions', help='Sphinx versions to test', 462 - nargs="*", default=DEFAULT_VERSIONS_TO_TEST, 463 - type=parse_version) 464 - parser.add_argument('--min-version', "--min", help='Sphinx minimal version', 465 - type=parse_version) 466 - parser.add_argument('--max-version', "--max", help='Sphinx maximum version', 467 - type=parse_version) 468 - parser.add_argument('-a', '--make_args', 469 - help='extra arguments for make htmldocs, like SPHINXDIRS=netlink/specs', 470 - nargs="*") 471 - parser.add_argument('-w', '--write', help='write a requirements.txt file', 472 - action='store_true') 473 - parser.add_argument('-m', '--make', 474 - help='Make documentation', 475 - action='store_true') 476 - parser.add_argument('-f', '--full', 477 - help='Add all (major,minor,latest_patch) version to the version list', 478 - action='store_true') 479 - parser.add_argument('-i', '--wait-input', 480 - help='Wait for an enter before going to the next version', 481 - action='store_true') 482 - parser.add_argument('-v', '--verbose', 483 - help='Verbose all commands', 484 - action='store_true') 485 - parser.add_argument('-l', '--log', 486 - help='Log command output on a file') 443 + ver_group = parser.add_argument_group("Version range options") 444 + 445 + ver_group.add_argument('-V', '--versions', nargs="*", 446 + default=DEFAULT_VERSIONS_TO_TEST,type=parse_version, 447 + help='Sphinx versions to test') 448 + ver_group.add_argument('--min-version', "--min", type=parse_version, 449 + help='Sphinx minimal version') 450 + ver_group.add_argument('--max-version', "--max", type=parse_version, 451 + help='Sphinx maximum version') 452 + ver_group.add_argument('-f', '--full', action='store_true', 453 + help='Add all Sphinx (major,minor) supported versions to the version range') 454 + 455 + build_group = parser.add_argument_group("Build options") 456 + 457 + build_group.add_argument('-b', '--build', action='store_true', 458 + help='Build documentation') 459 + build_group.add_argument('-a', '--make-args', nargs="*", 460 + help='extra arguments for make, like SPHINXDIRS=netlink/specs', 461 + ) 462 + build_group.add_argument('-t', '--targets', nargs="+", choices=MAKE_TARGETS, 463 + default=[MAKE_TARGETS[0]], 464 + help="make build targets. Default: htmldocs.") 465 + build_group.add_argument("-o", '--output', 466 + help="output directory for the make O=OUTPUT") 467 + 468 + other_group = parser.add_argument_group("Other options") 469 + 470 + other_group.add_argument('-r', '--req-file', action='store_true', 471 + help='write a requirements.txt file') 472 + other_group.add_argument('-l', '--log', 473 + help='Log command output on a file') 474 + other_group.add_argument('-v', '--verbose', action='store_true', 475 + help='Verbose all commands') 476 + other_group.add_argument('-i', '--wait-input', action='store_true', 477 + help='Wait for an enter before going to the next version') 487 478 488 479 args = parser.parse_args() 489 480