From badcf9f2b80e82122cf9542c9e68b2b9c13ff02c Mon Sep 17 00:00:00 2001 From: Christoph Froehlich Date: Sun, 14 Jul 2024 22:05:19 +0000 Subject: [PATCH] codeformat --- make_help_scripts/check_links.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/make_help_scripts/check_links.py b/make_help_scripts/check_links.py index e6bfd69ea9c..0fbe18d6008 100755 --- a/make_help_scripts/check_links.py +++ b/make_help_scripts/check_links.py @@ -25,10 +25,12 @@ LOGFILE = "linkcheck.log" + def cleanup(): os.remove(LOGFILE) shutil.rmtree("doc/api/", ignore_errors=True) + def main(): if len(sys.argv) != 2: print("Usage: python check_links.py ") @@ -37,15 +39,18 @@ def main(): html_dir = sys.argv[1] # Copy API documentation to local directory - shutil.copytree(os.path.join(html_dir, "doc", "api"), "doc/api/", dirs_exist_ok=True) + shutil.copytree(os.path.join(html_dir, "doc", "api"), + "doc/api/", dirs_exist_ok=True) # Run linkcheck with open(LOGFILE, "w") as logfile: - subprocess.run(["make", "linkcheck"], stdout=logfile, stderr=subprocess.PIPE) + subprocess.run(["make", "linkcheck"], stdout=logfile, + stderr=subprocess.PIPE) # Check for broken links with open(LOGFILE, "r") as logfile: - broken_links = [line for line in logfile if "broken" in line and "github" not in line and "vimeo" not in line] + broken_links = [ + line for line in logfile if "broken" in line and "github" not in line and "vimeo" not in line] if broken_links: num_broken = len(broken_links) @@ -58,5 +63,6 @@ def main(): cleanup() sys.exit(0) + if __name__ == "__main__": main()