From 27333c154a97dfc609195c2434ea251bc86bfc6d Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Wed, 18 Nov 2026 13:02:18 +0100 Subject: [PATCH] refactor: hash the MAME pack with core.hashing --- scripts/scraper/arcade_parent_importer.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/scripts/scraper/arcade_parent_importer.py b/scripts/scraper/arcade_parent_importer.py index 3749ba359..7f63d84b5 100644 --- a/scripts/scraper/arcade_parent_importer.py +++ b/scripts/scraper/arcade_parent_importer.py @@ -53,6 +53,7 @@ from typing import IO from core.artifacts import write_if_changed from model.profiles import load_emulator_profiles from core.cli import run_cli +from core.hashing import compute_hashes from .romset_dat_importer import ( LISTXML_CHUNK, MAME_LISTXML_URL, @@ -1044,14 +1045,6 @@ def read_sets(openers: list[Callable[[], IO[bytes]]]) -> dict[str, SetEntry]: return sets -def _sha256(path: Path) -> str: - digest = hashlib.sha256() - with path.open("rb") as handle: - for block in iter(lambda: handle.read(1 << 20), b""): - digest.update(block) - return digest.hexdigest() - - def import_profile( profile: str, data: dict, cache_dir: Path, offline: bool = False, report: dict | None = None, @@ -1076,7 +1069,7 @@ def import_profile( source = { "release": f"mamedev/mame {tag}", "url": MAME_LISTXML_URL.format(tag=tag), - "sha256": _sha256(pack), + "sha256": compute_hashes(pack, frozenset({"sha256"}), cache=False)["sha256"], } index = build_index(read_sets([_listxml_opener(pack)]), spec["marker"]) elif kind == "fbneo":