[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2436f37ab7945673f26bcfc94c10e6e76b93c2d8.1750571906.git.mchehab+huawei@kernel.org>
Date: Sun, 22 Jun 2025 08:02:37 +0200
From: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
To: Linux Doc Mailing List <linux-doc@...r.kernel.org>,
Jonathan Corbet <corbet@....net>
Cc: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
"Akira Yokosawa" <akiyks@...il.com>,
"Mauro Carvalho Chehab" <mchehab+huawei@...nel.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH v3 08/15] scripts: test_doc_build.py: improve cmd.log logic
Simplify the logic which handles with new lines.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
---
scripts/test_doc_build.py | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/scripts/test_doc_build.py b/scripts/test_doc_build.py
index 087b8c476f05..7ea6add48f9a 100755
--- a/scripts/test_doc_build.py
+++ b/scripts/test_doc_build.py
@@ -157,14 +157,16 @@ class AsyncCommands:
self.fp = fp
def log(self, out, verbose, is_info=True):
+ out = out.removesuffix('\n')
+
if verbose:
if is_info:
- print(out.rstrip("\n"))
+ print(out)
else:
- print(out.rstrip("\n"), file=sys.stderr)
+ print(out, file=sys.stderr)
if self.fp:
- self.fp.write(out.rstrip("\n") + "\n")
+ self.fp.write(out + "\n")
async def _read(self, stream, verbose, is_info):
"""Ancillary routine to capture while displaying"""
@@ -301,10 +303,10 @@ class SphinxVenv:
make = ["make"] + args.make_args + ["htmldocs"]
if args.verbose:
- print(f". {bin_dir}/activate")
+ cmd.log(f". {bin_dir}/activate", verbose=True)
await cmd.run(make, env=env, check=True, verbose=True)
if args.verbose:
- print("deactivate")
+ cmd.log("deactivate", verbose=True)
end_time = time.time()
elapsed_time = end_time - start_time
@@ -356,10 +358,11 @@ class SphinxVenv:
python_bin)
if args.make:
- print()
- print("Summary:")
+ cmd = AsyncCommands(fp)
+ cmd.log("\nSummary:", verbose=True)
for ver, elapsed_time in sorted(self.built_time.items()):
- print(f"\tSphinx {ver} elapsed time: {elapsed_time}")
+ cmd.log(f"\tSphinx {ver} elapsed time: {elapsed_time}",
+ verbose=True)
if fp:
fp.close()
--
2.49.0
Powered by blists - more mailing lists