refactor: one predicate for the pack notes

This commit is contained in:
Abdessamad Derraz committed 2026-11-21 19:50:33 +01:00
1 parent 66c83b06b0
commit cf7e13808f
7 files changed
+30 -32

No files matched your search

+15 -1
View File
@@ -12,7 +12,7 @@ from dataclasses import dataclass, field
from core.artifacts import atomic_scratch
from core.hashing import compute_hashes
from core.paths import comparable_destination, sanitize_pack_path
from packs.paths import has_path_conflict, register_path, placement_block
from packs.paths import MEDIA_MARKER, has_path_conflict, register_path, placement_block
# The minimum ZIP timestamp, carried by every pack member so a pack is a
@@ -127,6 +127,20 @@ def writing_pack(zip_path: str) -> Iterator[zipfile.ZipFile]:
PACK_DOCUMENTS = ("README.txt", "manifest.json")
def is_pack_note(name: str) -> bool:
"""Whether a member is a note the builder composes, not a collected file."""
# The builder writes its notes beside the slot they explain
# (bios/INSTRUCTIONS_x.txt, games/keen6/INSTRUCTIONS_y.txt), so
# they are told by their own name, not by a root prefix. The empty
# marker an Android pack carries is written for the device.
base = name.rsplit("/", 1)[-1]
return (
base.startswith(("INSTRUCTIONS_", "RENAMED_"))
or base == MEDIA_MARKER
or name in PACK_DOCUMENTS
)
@dataclass
class Placed:
"""The destinations a build has taken, and the folders they open.