Bug 1660615 - Add a verbose mode for "mach doc" r=firefox-source-docs-reviewers,championshuttler

And show the sphinx arguments

Differential Revision: https://phabricator.services.mozilla.com/D87951
This commit is contained in:
Sylvestre Ledru 2020-08-23 09:04:26 +00:00
Родитель dcc2514c21
Коммит da495a5a28
1 изменённых файлов: 15 добавлений и 3 удалений

Просмотреть файл

@ -108,6 +108,9 @@ class Documentation(MachCommandBase):
@CommandArgument(
"--write-url", default=None, help="Write S3 Upload URL to text file"
)
@CommandArgument(
"--verbose", action="store_true", help="Run Sphinx in verbose mode"
)
def build_docs(
self,
path=None,
@ -120,6 +123,7 @@ class Documentation(MachCommandBase):
upload=False,
jobs=None,
write_url=None,
verbose=None,
):
if self.check_jsdoc():
return die(JSDOC_NOT_FOUND)
@ -149,7 +153,7 @@ class Documentation(MachCommandBase):
"%s: could not find docs at this location" % path
)
result = self._run_sphinx(docdir, savedir, fmt=fmt, jobs=jobs)
result = self._run_sphinx(docdir, savedir, fmt=fmt, jobs=jobs, verbose=verbose)
if result != 0:
print(self._dump_sphinx_backtrace())
return die(
@ -199,7 +203,9 @@ class Documentation(MachCommandBase):
sphinx_trees = self.manager.trees or {savedir: docdir}
for _, src in sphinx_trees.items():
run_sphinx = partial(self._run_sphinx, src, savedir, fmt=fmt, jobs=jobs)
run_sphinx = partial(
self._run_sphinx, src, savedir, fmt=fmt, jobs=jobs, verbose=verbose
)
server.watch(src, run_sphinx)
server.serve(
host=host,
@ -233,7 +239,9 @@ class Documentation(MachCommandBase):
output += f.read()
return output
def _run_sphinx(self, docdir, savedir, config=None, fmt="html", jobs=None):
def _run_sphinx(
self, docdir, savedir, config=None, fmt="html", jobs=None, verbose=None
):
import sphinx.cmd.build
config = config or self.manager.conf_py_path
@ -247,6 +255,10 @@ class Documentation(MachCommandBase):
]
if jobs:
args.extend(["-j", jobs])
if verbose:
args.extend(["-v", "-v", "-T"])
print("Run sphinx with:")
print(args)
return sphinx.cmd.build.build_main(args)
def _post_process_html(self, savedir):