Skip to content

Commit 64e4882

Browse files
mchehabJonathan Corbet
authored andcommitted
tools: sphinx-build-wrapper: improve its help message
Besides the parameters that are passed via command line arguments, the wrapper's behavior is affected by several environment variables. Document that. While here, use __doc__ for its description. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <e0ccee75f7e7fb499e0f59d5b84469f4b6a21627.1769500383.git.mchehab+huawei@kernel.org>
1 parent b09cc1d commit 64e4882

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

tools/docs/sphinx-build-wrapper

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -814,20 +814,42 @@ def jobs_type(value):
814814
except ValueError:
815815
raise argparse.ArgumentTypeError(f"Must be 'auto' or positive integer, got {value}") # pylint: disable=W0707
816816

817+
EPILOG="""
818+
Besides the command line arguments, several environment variables affect its
819+
default behavior, meant to be used when called via Kernel Makefile:
820+
821+
- KERNELVERSION: Kernel major version
822+
- KERNELRELEASE: Kernel release
823+
- KBUILD_VERBOSE: Contains the value of "make V=[0|1] variable.
824+
When V=0 (KBUILD_VERBOSE=0), sets verbose level to "-q".
825+
- SPHINXBUILD: Documentation build tool (default: "sphinx-build").
826+
- SPHINXOPTS: Extra options pased to SPHINXBUILD
827+
(default: "-j auto" and "-q" if KBUILD_VERBOSE=0).
828+
The "-v" flag can be used to increase verbosity.
829+
If V=0, the first "-v" will drop "-q".
830+
- PYTHON3: Python command to run SPHINXBUILD
831+
- PDFLATEX: LaTeX PDF engine. (default: "xelatex")
832+
- LATEXOPTS: Optional set of command line arguments to the LaTeX engine
833+
- srctree: Location of the Kernel root directory (default: ".").
834+
835+
"""
836+
817837
def main():
818838
"""
819839
Main function. The only mandatory argument is the target. If not
820840
specified, the other arguments will use default values if not
821841
specified at os.environ.
822842
"""
823-
parser = argparse.ArgumentParser(description="Kernel documentation builder")
843+
parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter,
844+
description=__doc__,
845+
epilog=EPILOG)
824846

825847
parser.add_argument("target", choices=list(TARGETS.keys()),
826848
help="Documentation target to build")
827849
parser.add_argument("--sphinxdirs", nargs="+",
828850
help="Specific directories to build")
829851
parser.add_argument("--builddir", default="output",
830-
help="Sphinx configuration file")
852+
help="Sphinx configuration file (default: %(default)s)")
831853

832854
parser.add_argument("--theme", help="Sphinx theme to use")
833855

@@ -843,7 +865,7 @@ def main():
843865
help="place build in verbose mode")
844866

845867
parser.add_argument('-j', '--jobs', type=jobs_type,
846-
help="Sets number of jobs to use with sphinx-build")
868+
help="Sets number of jobs to use with sphinx-build(default: auto)")
847869

848870
parser.add_argument('-i', '--interactive', action='store_true',
849871
help="Change latex default to run in interactive mode")

0 commit comments

Comments
 (0)