mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
tools/docs: sphinx-build-wrapper: Fix output for duplicated names
When SPHINXDIRS is used, basename may be identical for different
files. If this happens, the summary and error detection won't be
accurate.
Fix it by using relative names from builddir.
While here, don't duplicate names. Report, instead:
- SUCCESS
output PDF file was built
- FAILED
latexmk/xelatex didn't build any PDF output
- FAILED: no .tex files were generated
Sphinx didn't build any tex file for SPHINXDIRS directories
- FAILED ({python exception})
When a concurrent.futures is catched. Usually indicates an
internal error at the build logic.
With that, building multiple dirs with the same name is reported
properly:
$ make V=1 SPHINXDIRS="admin-guide/media driver-api/media userspace-api/media" pdfdocs
Summary
=======
admin-guide/media/pdf/media.pdf : SUCCESS
driver-api/media/pdf/media.pdf : SUCCESS
userspace-api/media/pdf/media.pdf: SUCCESS
And if at least one of them fails, return code will be 1.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Message-ID: <d4a4f16f6c0c423ad38531a490888be3bf01e574.1758196090.git.mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
This commit is contained in:
committed by
Jonathan Corbet
parent
82c294d453
commit
0d9abc7627
@@ -329,9 +329,6 @@ class SphinxBuilder:
|
||||
continue
|
||||
|
||||
name = name[:-len(tex_suffix)]
|
||||
|
||||
max_len = max(max_len, len(name))
|
||||
|
||||
has_tex = True
|
||||
|
||||
future = executor.submit(self.build_pdf_file, latex_cmd,
|
||||
@@ -343,34 +340,35 @@ class SphinxBuilder:
|
||||
|
||||
pdf_name = name + ".pdf"
|
||||
pdf_from = os.path.join(from_dir, pdf_name)
|
||||
pdf_to = os.path.join(pdf_dir, pdf_name)
|
||||
out_name = os.path.relpath(pdf_to, self.builddir)
|
||||
max_len = max(max_len, len(out_name))
|
||||
|
||||
try:
|
||||
success = future.result()
|
||||
|
||||
if success and os.path.exists(pdf_from):
|
||||
pdf_to = os.path.join(pdf_dir, pdf_name)
|
||||
|
||||
os.rename(pdf_from, pdf_to)
|
||||
|
||||
#
|
||||
# if verbose, get the name of built PDF file
|
||||
#
|
||||
if self.verbose:
|
||||
builds[name] = os.path.relpath(pdf_to, self.builddir)
|
||||
builds[out_name] = "SUCCESS"
|
||||
else:
|
||||
builds[name] = "FAILED"
|
||||
builds[out_name] = "FAILED"
|
||||
build_failed = True
|
||||
except futures.Error as e:
|
||||
builds[name] = f"FAILED ({repr(e)})"
|
||||
builds[out_name] = f"FAILED ({repr(e)})"
|
||||
build_failed = True
|
||||
|
||||
#
|
||||
# Handle case where no .tex files were found
|
||||
#
|
||||
if not has_tex:
|
||||
name = "Sphinx LaTeX builder"
|
||||
max_len = max(max_len, len(name))
|
||||
builds[name] = "FAILED (no .tex file was generated)"
|
||||
out_name = "LaTeX files"
|
||||
max_len = max(max_len, len(out_name))
|
||||
builds[out_name] = "FAILED: no .tex files were generated"
|
||||
build_failed = True
|
||||
|
||||
return builds, build_failed, max_len
|
||||
|
||||
Reference in New Issue
Block a user