From 376dbff23568b38a499a82d1f7c061ef7f6a57fd Mon Sep 17 00:00:00 2001 From: Vitor Bandeira Date: Tue, 10 Nov 2026 09:42:57 -0300 Subject: [PATCH 1/2] docs: fail the build on fetch errors in conf.py requests.get had no status check, so an HTTP error page was written into the downloaded file and the build went on. Add a timeout and raise_for_status. The two asserts that guard the splice do not run under python -O. Replace them with RuntimeError messages that name the missing heading. Signed-off-by: Vitor Bandeira --- docs/conf.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 96e0c84cf4..98ba2ce334 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -136,7 +136,9 @@ def get_file_from_url(url, fname): - r = requests.get(url) + # Fail the build on an HTTP error instead of writing an error page to fname. + r = requests.get(url, timeout=60) + r.raise_for_status() with open(fname, "wb") as f: f.write(r.content) @@ -196,7 +198,11 @@ def setup(app): match = re.search(f"{start_pattern}(.*?){end_pattern}", markdown_content, re.DOTALL) - assert match is not None, "No match found, check the OR Doc pattern on index.md" + if match is None: + raise RuntimeError( + f"SupportedOS.md: no text between '{start_pattern}' and " + f"'{end_pattern}'; check the headings in OpenROAD docs/index.md" + ) extracted_content = match.group(1) extracted_content = "\n#### Supported Operating Systems" + extracted_content print(extracted_content) @@ -205,7 +211,8 @@ def setup(app): with open("index2.md", "r") as f: existing_content = f.read() match = re.search(r"### Setup", existing_content) - assert match is not None, "Check search keyword." + if match is None: + raise RuntimeError("index2.md: heading '### Setup' not found") with open("index2.md", "w") as f: insert_position = match.end() + 1 before_insert = existing_content[:insert_position] From 9480744d8c753fee8f5a9d21394fc059e49ac4ee Mon Sep 17 00:00:00 2001 From: Vitor Bandeira Date: Sun, 15 Nov 2026 22:19:34 -0300 Subject: [PATCH 2/2] docs: check the GitGuide splice heading in conf.py If OpenROAD renames '## Creating a branch', str.replace changes nothing. The ORFS forking section then drops out of the GitGuide, and the build passes. Raise RuntimeError when the heading is missing. Also correct two error messages. The Supported Operating Systems pattern fails only when a heading is missing or out of order. The '### Setup' heading lives in docs/index.md, not in the generated index2.md copy. Signed-off-by: Vitor Bandeira --- docs/conf.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 98ba2ce334..a3fd40abf9 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -179,6 +179,11 @@ def setup(app): ) with open("contrib/GitGuideAdapter.md", "r") as f: adapter_content = f.read() + if "## Creating a branch" not in content: + raise RuntimeError( + "contrib/GitGuide.md: heading '## Creating a branch' not found; " + "check OpenROAD docs/contrib/GitGuide.md" + ) content = content.replace( "## Creating a branch", adapter_content + "\n## Creating a branch" ) @@ -200,8 +205,8 @@ def setup(app): if match is None: raise RuntimeError( - f"SupportedOS.md: no text between '{start_pattern}' and " - f"'{end_pattern}'; check the headings in OpenROAD docs/index.md" + f"SupportedOS.md: '{start_pattern}' followed by '{end_pattern}' " + "not found; check the headings in OpenROAD docs/index.md" ) extracted_content = match.group(1) extracted_content = "\n#### Supported Operating Systems" + extracted_content @@ -212,7 +217,7 @@ def setup(app): existing_content = f.read() match = re.search(r"### Setup", existing_content) if match is None: - raise RuntimeError("index2.md: heading '### Setup' not found") + raise RuntimeError("docs/index.md: heading '### Setup' not found") with open("index2.md", "w") as f: insert_position = match.end() + 1 before_insert = existing_content[:insert_position]