From nobody Thu Oct 9 02:55:50 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48AFC270ECF; Sat, 21 Jun 2025 19:56:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750535761; cv=none; b=aVXagkPlMz4ih6My4lMahW6gmMcKb/eezK47U5eIHSLGaQ5jV+ZKkZBhpMbNE3NqIOYD0nqwNtRWntdtTUguUy40QF+IGVq6RgIBVo1DZ27Qo2nv27gINmwTdOmpj0/wBaaNEdsqYBKjqEmMlemlDMqESWBW4rxtmkBHgh+mzPk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750535761; c=relaxed/simple; bh=y8LZ0fXrmuwyAMvRo91pI8wsN2CZiBu2VRksVUBmRVg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=s/RwP9ShywsyRDX7TdPTy7u7+QqSKrw/FUb6nwGNTXMwqOv6lIUNk1FvhouZS+NiUj7V+nXh0XoZD213vRCXR+04aODZkTQSkKSMcREw7tpI0hVoud01SwPHqeYric2G3is/s6bgZYjHN15dXTeBMLViSn7p3Vwh3NqD9yq7IX0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kLqUlr1n; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kLqUlr1n" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEB92C4CEF7; Sat, 21 Jun 2025 19:56:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750535760; bh=y8LZ0fXrmuwyAMvRo91pI8wsN2CZiBu2VRksVUBmRVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kLqUlr1n+TfBEGpK4FBNaNDec7oYi3DJOT/Ci9PnXtyvKNJKtZQ6dPdM9toVihJWF h6MjWsRNQJWJSPzItbaZhhqKEVmiSFP07FcNMxsgmZUWxy7u0RVoUZWovCiwgvaSTr qQYL7Y0i6kFISQ80CI4sU3C4gFcdOl6FqLUzuMnpTd1fxOBCIki5a+r/+i8LJgKFma emCV8JI8R3lRlbO1K9vawhW6ROHSk2Snej2JjAGK/Ejk2bgiNJsROwCUgFHTXlfumk GFyySLO1nNQtG/gvU0OzvkJC9brw15trnPvIqOSXBvgOVA3N+tMD28uxp/P1ULKLCR vd4O8S7MPlXpA== Received: from mchehab by mail.kernel.org with local (Exim 4.98.2) (envelope-from ) id 1uT4Ji-00000000e4K-3bGK; Sat, 21 Jun 2025 21:55:58 +0200 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Jonathan Corbet Cc: Mauro Carvalho Chehab , "Akira Yokosawa" , "Mauro Carvalho Chehab" , linux-kernel@vger.kernel.org Subject: [PATCH v2 12/15] scripts: test_doc_build.py: regroup and rename arguments Date: Sat, 21 Jun 2025 21:55:51 +0200 Message-ID: <0a9b4666029d7ceea73a4f922043bc334bb62d9a.1750535171.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" 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 --- scripts/test_doc_build.py | 95 +++++++++++++++++++++++++-------------- 1 file changed, 61 insertions(+), 34 deletions(-) diff --git a/scripts/test_doc_build.py b/scripts/test_doc_build.py index 5e905a350bd0..47b4606569f9 100755 --- a/scripts/test_doc_build.py +++ b/scripts/test_doc_build.py @@ -269,7 +269,7 @@ class SphinxVenv: =20 ver =3D ".".join(map(str, cur_ver)) =20 - if not self.first_run and args.wait_input and args.make: + if not self.first_run and args.wait_input and args.build: ret =3D input("Press Enter to continue or 'a' to abort: ").str= ip().lower() if ret =3D=3D "a": print("Aborted.") @@ -300,11 +300,11 @@ class SphinxVenv: result =3D await cmd.run([pip, "freeze"], verbose=3DFalse, check= =3DTrue) =20 # Pip install succeeded. Write requirements file - if args.write: + if args.req_file: with open(req_file, "w", encoding=3D"utf-8") as fp: fp.write(result.stdout) =20 - if args.make: + if args.build: start_time =3D time.time() =20 # Prepare a venv environment @@ -317,7 +317,16 @@ class SphinxVenv: =20 # Test doc build await cmd.run(["make", "cleandocs"], env=3Denv, check=3DTrue) - make =3D ["make"] + args.make_args + ["htmldocs"] + make =3D ["make"] + + if args.output: + sphinx_build =3D os.path.realpath(f"{bin_dir}/sphinx-build= ") + make +=3D [f"O=3D{args.output}", f"SPHINXBUILD=3D{sphinx_b= uild}"] + + if args.make_args: + make +=3D args.make_args + + make +=3D args.targets =20 if args.verbose: cmd.log(f". {bin_dir}/activate", verbose=3DTrue) @@ -380,7 +389,7 @@ class SphinxVenv: await self._handle_version(args, fp, cur_ver, cur_requirements, python_bin) =20 - if args.make: + if args.build: cmd =3D AsyncCommands(fp) cmd.log("\nSummary:", verbose=3DTrue) for ver, elapsed_time in sorted(self.built_time.items()): @@ -407,7 +416,7 @@ This tool allows creating Python virtual environments f= or different Sphinx versions that are supported by the Linux Kernel build system. =20 Besides creating the virtual environment, it can also test building -the documentation using "make htmldocs". +the documentation using "make htmldocs" (and/or other doc targets). =20 If called without "--versions" argument, it covers the versions shipped on major distros, plus the lowest supported version: @@ -418,8 +427,8 @@ A typical usage is to run: =20 {SCRIPT} -m -l sphinx_builds.log =20 -This will create one virtual env for the default version set and do a -full htmldocs build for each version, creating a log file with the +This will create one virtual env for the default version set and run +"make htmldocs" for each version, creating a log file with the excecuted commands on it. =20 NOTE: The build time can be very long, specially on old versions. Also, th= ere @@ -433,6 +442,15 @@ reduce the number of threads from "-jauto" to, for ins= tance, "-j4": =20 """ =20 +MAKE_TARGETS =3D [ + "htmldocs", + "texinfodocs", + "infodocs", + "latexdocs", + "pdfdocs", + "epubdocs", + "xmldocs", +] =20 async def main(): """Main program""" @@ -440,32 +458,41 @@ async def main(): parser =3D argparse.ArgumentParser(description=3DDESCRIPTION, formatter_class=3Dargparse.RawDescrip= tionHelpFormatter) =20 - parser.add_argument('-V', '--versions', help=3D'Sphinx versions to tes= t', - nargs=3D"*", default=3DDEFAULT_VERSIONS_TO_TEST, - type=3Dparse_version) - parser.add_argument('--min-version', "--min", help=3D'Sphinx minimal v= ersion', - type=3Dparse_version) - parser.add_argument('--max-version', "--max", help=3D'Sphinx maximum v= ersion', - type=3Dparse_version) - parser.add_argument('-a', '--make_args', - help=3D'extra arguments for make htmldocs, like SP= HINXDIRS=3Dnetlink/specs', - nargs=3D"*") - parser.add_argument('-w', '--write', help=3D'write a requirements.txt = file', - action=3D'store_true') - parser.add_argument('-m', '--make', - help=3D'Make documentation', - action=3D'store_true') - parser.add_argument('-f', '--full', - help=3D'Add all (major,minor,latest_patch) version= to the version list', - action=3D'store_true') - parser.add_argument('-i', '--wait-input', - help=3D'Wait for an enter before going to the next= version', - action=3D'store_true') - parser.add_argument('-v', '--verbose', - help=3D'Verbose all commands', - action=3D'store_true') - parser.add_argument('-l', '--log', - help=3D'Log command output on a file') + ver_group =3D parser.add_argument_group("Version range options") + + ver_group.add_argument('-V', '--versions', nargs=3D"*", + default=3DDEFAULT_VERSIONS_TO_TEST,type=3Dparse= _version, + help=3D'Sphinx versions to test') + ver_group.add_argument('--min-version', "--min", type=3Dparse_version, + help=3D'Sphinx minimal version') + ver_group.add_argument('--max-version', "--max", type=3Dparse_version, + help=3D'Sphinx maximum version') + ver_group.add_argument('-f', '--full', action=3D'store_true', + help=3D'Add all Sphinx (major,minor) supported = versions to the version range') + + build_group =3D parser.add_argument_group("Build options") + + build_group.add_argument('-b', '--build', action=3D'store_true', + help=3D'Build documentation') + build_group.add_argument('-a', '--make-args', nargs=3D"*", + help=3D'extra arguments for make, like SPHINX= DIRS=3Dnetlink/specs', + ) + build_group.add_argument('-t', '--targets', nargs=3D"+", choices=3DMAK= E_TARGETS, + default=3D[MAKE_TARGETS[0]], + help=3D"make build targets. Default: htmldocs= .") + build_group.add_argument("-o", '--output', + help=3D"output directory for the make O=3DOUT= PUT") + + other_group =3D parser.add_argument_group("Other options") + + other_group.add_argument('-r', '--req-file', action=3D'store_true', + help=3D'write a requirements.txt file') + other_group.add_argument('-l', '--log', + help=3D'Log command output on a file') + other_group.add_argument('-v', '--verbose', action=3D'store_true', + help=3D'Verbose all commands') + other_group.add_argument('-i', '--wait-input', action=3D'store_true', + help=3D'Wait for an enter before going to the next= version') =20 args =3D parser.parse_args() =20 --=20 2.49.0