Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion scripts/import_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,14 @@ def fetch_manifest(url: str, *, missing_ok: bool = False) -> dict | None:

def check_publication(upstream: str, current: str) -> tuple[dict, bool]:
manifest = fetch_manifest(upstream)
deployed = fetch_manifest(current, missing_ok=True)
try:
deployed = fetch_manifest(current, missing_ok=True)
except (ValueError, OSError) as error:
# The verified upstream can repair a missing or corrupt deployed marker.
print(
f"Deployed publication is unreadable; importing verified upstream: {error}"
)
deployed = None
return manifest, manifest != deployed


Expand Down
3 changes: 3 additions & 0 deletions scripts/test_import_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ def test_actual_http_checks_skip_unchanged_and_detect_same_tag_rebuild(self):
_, changed = check_publication(base + "/upstream.json", base + "/current.json")
self.assertTrue(changed)
(self.root / "current.json").write_text("not JSON")
_, changed = check_publication(base + "/upstream.json", base + "/current.json")
self.assertTrue(changed)
(self.root / "upstream.json").write_text("not JSON")
with self.assertRaises(ValueError):
check_publication(base + "/upstream.json", base + "/current.json")

Expand Down
Loading