refactor: give common.py's parts their own modules

common.py had grown to 1833 lines by accumulation. Six coherent pieces
move out - untrusted parsing, digests, archives, generated artefacts,
release assets, dump catalogues - and common.py re-exports them, so the
sixty existing import sites keep working and migrating them stays
optional.

The site build is now reproducible, which is what made the move
checkable. It deleted its generated directories first, so every page was
new and write_if_changed had no earlier version to compare against: a
deploy republished six hundred pages for the clock alone. Directories
are swept instead, a page is removed only once nothing produces it, and
the body pass compares against the body of the file on disk rather than
against the decorated page. Two consecutive builds on the same inputs
now produce identical bytes; before, 1034 files differed.
This commit is contained in:
Abdessamad Derraz committed 2026-08-12 11:49:54 +02:00
1 parent 5e168b86c8
commit b5fd643ccf
10 files changed
+783 -589

No files matched your search

+4 -3
View File
@@ -28,6 +28,7 @@ from pathlib import Path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "scripts"))
import largefiles
import yaml
from common import (
build_zip_contents_index,
@@ -5120,8 +5121,8 @@ struct BurnDriver BurnDrvneogeo = {
raise urllib.error.HTTPError(url, 404, "Not Found", {}, None)
return FakeResponse(b"payload")
original = common.urllib.request.urlopen
common.urllib.request.urlopen = fake_urlopen
original = largefiles.urllib.request.urlopen
largefiles.urllib.request.urlopen = fake_urlopen
try:
with tempfile.TemporaryDirectory() as tmpdir:
path = common.fetch_large_file(
@@ -5131,7 +5132,7 @@ struct BurnDriver BurnDrvneogeo = {
with open(path, "rb") as fh:
self.assertEqual(fh.read(), b"payload")
finally:
common.urllib.request.urlopen = original
largefiles.urllib.request.urlopen = original
self.assertEqual(len(attempts), 2, attempts)
self.assertIn("MAME%200.174", attempts[0])