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: improve cmd.log logic

Simplify the logic which handles with new lines.

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

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
0e93f124 792bf019

+11 -8
+11 -8
scripts/test_doc_build.py
··· 157 157 self.fp = fp 158 158 159 159 def log(self, out, verbose, is_info=True): 160 + out = out.removesuffix('\n') 161 + 160 162 if verbose: 161 163 if is_info: 162 - print(out.rstrip("\n")) 164 + print(out) 163 165 else: 164 - print(out.rstrip("\n"), file=sys.stderr) 166 + print(out, file=sys.stderr) 165 167 166 168 if self.fp: 167 - self.fp.write(out.rstrip("\n") + "\n") 169 + self.fp.write(out + "\n") 168 170 169 171 async def _read(self, stream, verbose, is_info): 170 172 """Ancillary routine to capture while displaying""" ··· 303 301 make = ["make"] + args.make_args + ["htmldocs"] 304 302 305 303 if args.verbose: 306 - print(f". {bin_dir}/activate") 304 + cmd.log(f". {bin_dir}/activate", verbose=True) 307 305 await cmd.run(make, env=env, check=True, verbose=True) 308 306 if args.verbose: 309 - print("deactivate") 307 + cmd.log("deactivate", verbose=True) 310 308 311 309 end_time = time.time() 312 310 elapsed_time = end_time - start_time ··· 358 356 python_bin) 359 357 360 358 if args.make: 361 - print() 362 - print("Summary:") 359 + cmd = AsyncCommands(fp) 360 + cmd.log("\nSummary:", verbose=True) 363 361 for ver, elapsed_time in sorted(self.built_time.items()): 364 - print(f"\tSphinx {ver} elapsed time: {elapsed_time}") 362 + cmd.log(f"\tSphinx {ver} elapsed time: {elapsed_time}", 363 + verbose=True) 365 364 366 365 if fp: 367 366 fp.close()