From bd0082aaa555ab9c2bf46bee2817ca97f5578ce3 Mon Sep 17 00:00:00 2001 From: AG <98327736+ggold7046@users.noreply.github.com> Date: Wed, 20 Sep 2023 00:18:49 +0530 Subject: [PATCH] Modified doc/make.py to run sphinx-build -b linkcheck (#54265) * Modified doc/make.py to run sphinx-build -b linkcheck * Update make.py * Update make.py * Update make.py * Update make.py * Update make.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update doc/make.py Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> * Update make.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update make.py * Update doc/make.py Co-authored-by: Philip Meier * Update doc/make.py Co-authored-by: Philip Meier * Update make.py --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Co-authored-by: Philip Meier --- doc/make.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/make.py b/doc/make.py index 9db4ea406bc1f1..23b18d69acc04b 100755 --- a/doc/make.py +++ b/doc/make.py @@ -123,14 +123,14 @@ def _sphinx_build(self, kind: str): Parameters ---------- - kind : {'html', 'latex'} + kind : {'html', 'latex', 'linkcheck'} Examples -------- >>> DocBuilder(num_jobs=4)._sphinx_build('html') """ - if kind not in ("html", "latex"): - raise ValueError(f"kind must be html or latex, not {kind}") + if kind not in ("html", "latex", "linkcheck"): + raise ValueError(f"kind must be html, latex or linkcheck, not {kind}") cmd = ["sphinx-build", "-b", kind] if self.num_jobs: @@ -288,6 +288,12 @@ def zip_html(self): os.chdir(dirname) self._run_os("zip", zip_fname, "-r", "-q", *fnames) + def linkcheck(self): + """ + Check for broken links in the documentation. + """ + return self._sphinx_build("linkcheck") + def main(): cmds = [method for method in dir(DocBuilder) if not method.startswith("_")]