From 049cdc90b1f65c342e9e571290743f2a6e70ee9b Mon Sep 17 00:00:00 2001 From: AG <98327736+ggold7046@users.noreply.github.com> Date: Wed, 26 Jul 2023 16:06:55 +0530 Subject: [PATCH 01/14] Modified doc/make.py to run sphinx-build -b linkcheck --- doc/make.py | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/doc/make.py b/doc/make.py index 937b2638fb098..90ea7f7f088f9 100755 --- a/doc/make.py +++ b/doc/make.py @@ -13,6 +13,8 @@ """ import argparse import csv +import docutils.frontend +import docutils.nodes import importlib import os import shutil @@ -21,6 +23,7 @@ import webbrowser import docutils +import docutils.utils import docutils.parsers.rst DOC_PATH = os.path.dirname(os.path.abspath(__file__)) @@ -288,9 +291,27 @@ 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. + """ + cmd = ["sphinx-build", "-b", "linkcheck"] + if self.num_jobs: + cmd += ["-j", self.num_jobs] + if self.verbosity: + cmd.append(f"-{'v' * self.verbosity}") + cmd += [ + "-d", + os.path.join(BUILD_PATH, "doctrees"), + SOURCE_PATH, + os.path.join(BUILD_PATH, "linkcheck"), + ] + subprocess.call(cmd) + def main(): cmds = [method for method in dir(DocBuilder) if not method.startswith("_")] + cmds.append("linkcheck") # Add linkcheck to the available commands joined = ",".join(cmds) argparser = argparse.ArgumentParser( @@ -349,6 +370,7 @@ def main(): joined = ", ".join(cmds) raise ValueError(f"Unknown command {args.command}. Available options: {joined}") + # Below we update both os.environ and sys.path. The former is used by # external libraries (namely Sphinx) to compile this module and resolve # the import of `python_path` correctly. The latter is used to resolve @@ -369,8 +391,11 @@ def main(): args.verbosity, args.warnings_are_errors, ) - return getattr(builder, args.command)() - + if args.command == "linkcheck": + builder._linkcheck() # Call the linkcheck method + else: + return getattr(builder, args.command)() + if __name__ == "__main__": sys.exit(main()) From 893497f9b5717b129d19404c6693f8d9b6e8fd22 Mon Sep 17 00:00:00 2001 From: AG <98327736+ggold7046@users.noreply.github.com> Date: Wed, 26 Jul 2023 19:36:02 +0530 Subject: [PATCH 02/14] Update make.py --- doc/make.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/doc/make.py b/doc/make.py index 90ea7f7f088f9..83e0aa1617517 100755 --- a/doc/make.py +++ b/doc/make.py @@ -13,8 +13,6 @@ """ import argparse import csv -import docutils.frontend -import docutils.nodes import importlib import os import shutil @@ -23,7 +21,6 @@ import webbrowser import docutils -import docutils.utils import docutils.parsers.rst DOC_PATH = os.path.dirname(os.path.abspath(__file__)) @@ -291,7 +288,7 @@ def zip_html(self): os.chdir(dirname) self._run_os("zip", zip_fname, "-r", "-q", *fnames) - def _linkcheck(self): + def _linkcheck(self): """ Check for broken links in the documentation. """ From bef34335aab0b79c59a61cd6403b63239c21e333 Mon Sep 17 00:00:00 2001 From: AG <98327736+ggold7046@users.noreply.github.com> Date: Sat, 29 Jul 2023 19:30:38 +0530 Subject: [PATCH 03/14] Update make.py --- doc/make.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/make.py b/doc/make.py index 83e0aa1617517..f722b0af8952d 100755 --- a/doc/make.py +++ b/doc/make.py @@ -288,7 +288,7 @@ def zip_html(self): os.chdir(dirname) self._run_os("zip", zip_fname, "-r", "-q", *fnames) - def _linkcheck(self): + def linkcheck(self): """ Check for broken links in the documentation. """ @@ -308,7 +308,6 @@ def _linkcheck(self): def main(): cmds = [method for method in dir(DocBuilder) if not method.startswith("_")] - cmds.append("linkcheck") # Add linkcheck to the available commands joined = ",".join(cmds) argparser = argparse.ArgumentParser( @@ -390,7 +389,7 @@ def main(): ) if args.command == "linkcheck": - builder._linkcheck() # Call the linkcheck method + builder.linkcheck() # Call the linkcheck method else: return getattr(builder, args.command)() From a6895caf91d8e0863ff6c05dffe38b1cc7750bdf Mon Sep 17 00:00:00 2001 From: AG <98327736+ggold7046@users.noreply.github.com> Date: Wed, 9 Aug 2023 19:35:13 +0530 Subject: [PATCH 04/14] Update make.py --- doc/make.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/doc/make.py b/doc/make.py index f722b0af8952d..ec70e6422ece3 100755 --- a/doc/make.py +++ b/doc/make.py @@ -288,21 +288,11 @@ def zip_html(self): os.chdir(dirname) self._run_os("zip", zip_fname, "-r", "-q", *fnames) - def linkcheck(self): + def linkcheck(self): """ Check for broken links in the documentation. """ cmd = ["sphinx-build", "-b", "linkcheck"] - if self.num_jobs: - cmd += ["-j", self.num_jobs] - if self.verbosity: - cmd.append(f"-{'v' * self.verbosity}") - cmd += [ - "-d", - os.path.join(BUILD_PATH, "doctrees"), - SOURCE_PATH, - os.path.join(BUILD_PATH, "linkcheck"), - ] subprocess.call(cmd) From d36b9bcd2760c6ebfbb95bae385537704b508285 Mon Sep 17 00:00:00 2001 From: AG <98327736+ggold7046@users.noreply.github.com> Date: Wed, 9 Aug 2023 21:07:43 +0530 Subject: [PATCH 05/14] Update make.py --- doc/make.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/make.py b/doc/make.py index ec70e6422ece3..969992c16e542 100755 --- a/doc/make.py +++ b/doc/make.py @@ -293,6 +293,12 @@ def linkcheck(self): Check for broken links in the documentation. """ cmd = ["sphinx-build", "-b", "linkcheck"] + cmd += [ + "-d", + os.path.join(BUILD_PATH, "doctrees"), + SOURCE_PATH, + os.path.join(BUILD_PATH, "linkcheck"), + ] subprocess.call(cmd) From 1f53da9d76e8388d0c491cae065bbaa19bf0d39b Mon Sep 17 00:00:00 2001 From: AG <98327736+ggold7046@users.noreply.github.com> Date: Thu, 10 Aug 2023 00:22:58 +0530 Subject: [PATCH 06/14] Update make.py --- doc/make.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/make.py b/doc/make.py index 969992c16e542..07813358630aa 100755 --- a/doc/make.py +++ b/doc/make.py @@ -362,7 +362,7 @@ def main(): joined = ", ".join(cmds) raise ValueError(f"Unknown command {args.command}. Available options: {joined}") - + # Below we update both os.environ and sys.path. The former is used by # external libraries (namely Sphinx) to compile this module and resolve # the import of `python_path` correctly. The latter is used to resolve @@ -388,6 +388,6 @@ def main(): builder.linkcheck() # Call the linkcheck method else: return getattr(builder, args.command)() - + if __name__ == "__main__": sys.exit(main()) From 97dd93675ad50d86b011b3d2283119ce546945e0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 9 Aug 2023 20:13:23 +0000 Subject: [PATCH 07/14] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- doc/make.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/make.py b/doc/make.py index 07813358630aa..6ef396606a9c0 100755 --- a/doc/make.py +++ b/doc/make.py @@ -362,7 +362,6 @@ def main(): joined = ", ".join(cmds) raise ValueError(f"Unknown command {args.command}. Available options: {joined}") - # Below we update both os.environ and sys.path. The former is used by # external libraries (namely Sphinx) to compile this module and resolve # the import of `python_path` correctly. The latter is used to resolve @@ -389,5 +388,6 @@ def main(): else: return getattr(builder, args.command)() + if __name__ == "__main__": sys.exit(main()) From 87075907d725392b4ec1f503897fdfc8c1386d2b Mon Sep 17 00:00:00 2001 From: AG <98327736+ggold7046@users.noreply.github.com> Date: Fri, 11 Aug 2023 01:04:45 +0530 Subject: [PATCH 08/14] Update doc/make.py Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> --- doc/make.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/make.py b/doc/make.py index 6ef396606a9c0..3e92540cb4486 100755 --- a/doc/make.py +++ b/doc/make.py @@ -384,7 +384,7 @@ def main(): ) if args.command == "linkcheck": - builder.linkcheck() # Call the linkcheck method + builder.linkcheck() else: return getattr(builder, args.command)() From 92100df860864bb9eb4b08ba8d554a279dfbf98b Mon Sep 17 00:00:00 2001 From: AG <98327736+ggold7046@users.noreply.github.com> Date: Wed, 16 Aug 2023 16:22:57 +0530 Subject: [PATCH 09/14] Update make.py --- doc/make.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/doc/make.py b/doc/make.py index 3e92540cb4486..8e27271588ae0 100755 --- a/doc/make.py +++ b/doc/make.py @@ -292,7 +292,7 @@ def linkcheck(self): """ Check for broken links in the documentation. """ - cmd = ["sphinx-build", "-b", "linkcheck"] + cmd = ["_sphinx_build", "-b", "linkcheck"] cmd += [ "-d", os.path.join(BUILD_PATH, "doctrees"), @@ -385,9 +385,6 @@ def main(): if args.command == "linkcheck": builder.linkcheck() - else: - return getattr(builder, args.command)() - if __name__ == "__main__": sys.exit(main()) From 93fdea0a081a7fb063e4c12ed01465275cb9e1c3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 16 Aug 2023 11:02:46 +0000 Subject: [PATCH 10/14] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- doc/make.py | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/make.py b/doc/make.py index 8e27271588ae0..abd5531373a33 100755 --- a/doc/make.py +++ b/doc/make.py @@ -386,5 +386,6 @@ def main(): if args.command == "linkcheck": builder.linkcheck() + if __name__ == "__main__": sys.exit(main()) From f11e59be3a6bd002d01fddbf2eb35ad7353218a9 Mon Sep 17 00:00:00 2001 From: AG <98327736+ggold7046@users.noreply.github.com> Date: Tue, 19 Sep 2023 00:18:08 +0530 Subject: [PATCH 11/14] Update make.py --- doc/make.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/doc/make.py b/doc/make.py index 4d95c1e3f47f0..abc31af14cfbe 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 or latex or linkcheck, not {kind}") cmd = ["sphinx-build", "-b", kind] if self.num_jobs: @@ -292,14 +292,8 @@ def linkcheck(self): """ Check for broken links in the documentation. """ - cmd = ["_sphinx_build", "-b", "linkcheck"] - cmd += [ - "-d", - os.path.join(BUILD_PATH, "doctrees"), - SOURCE_PATH, - os.path.join(BUILD_PATH, "linkcheck"), - ] - subprocess.call(cmd) + ret_code = self._sphinx_build("linkcheck") + return ret_code def main(): @@ -383,8 +377,6 @@ def main(): args.warnings_are_errors, ) - if args.command == "linkcheck": - builder.linkcheck() if __name__ == "__main__": From 8d715002f58f88d9f385bcc25d56f93e4eb52747 Mon Sep 17 00:00:00 2001 From: AG <98327736+ggold7046@users.noreply.github.com> Date: Tue, 19 Sep 2023 11:55:22 +0530 Subject: [PATCH 12/14] Update doc/make.py Co-authored-by: Philip Meier --- doc/make.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/make.py b/doc/make.py index abc31af14cfbe..3919b4d4c7f3c 100755 --- a/doc/make.py +++ b/doc/make.py @@ -130,7 +130,7 @@ def _sphinx_build(self, kind: str): >>> DocBuilder(num_jobs=4)._sphinx_build('html') """ if kind not in ("html", "latex", "linkcheck"): - raise ValueError(f"kind must be html or latex or linkcheck, not {kind}") + raise ValueError(f"kind must be html, latex or linkcheck, not {kind}") cmd = ["sphinx-build", "-b", kind] if self.num_jobs: From 9f6dd4ed4e9ab87e8f6395163a30557cc0e0d409 Mon Sep 17 00:00:00 2001 From: AG <98327736+ggold7046@users.noreply.github.com> Date: Tue, 19 Sep 2023 11:56:01 +0530 Subject: [PATCH 13/14] Update doc/make.py Co-authored-by: Philip Meier --- doc/make.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/make.py b/doc/make.py index 3919b4d4c7f3c..78c521f2dc834 100755 --- a/doc/make.py +++ b/doc/make.py @@ -292,8 +292,7 @@ def linkcheck(self): """ Check for broken links in the documentation. """ - ret_code = self._sphinx_build("linkcheck") - return ret_code + return self._sphinx_build("linkcheck") def main(): From 77a1d3954c9f1d4c4a531ebc4e956ade812dfcc4 Mon Sep 17 00:00:00 2001 From: AG <98327736+ggold7046@users.noreply.github.com> Date: Tue, 19 Sep 2023 12:05:34 +0530 Subject: [PATCH 14/14] Update make.py --- doc/make.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/make.py b/doc/make.py index 78c521f2dc834..23b18d69acc04 100755 --- a/doc/make.py +++ b/doc/make.py @@ -375,7 +375,7 @@ def main(): args.verbosity, args.warnings_are_errors, ) - + return getattr(builder, args.command)() if __name__ == "__main__":