fix: clone resolution in common.py, move clone map to root

moved _mame_clones.json out of bios/ (was indexed by generate_db.py
as BIOS file). clone resolution now in common.py resolve_local_file
so all tools (verify, pack, cross_reference) resolve clones
transparently. removed duplicate clone code from generate_pack.py.
added error handling on os.remove in dedup.py. consistency check
now passes for Batocera/EmuDeck/Lakka/RetroArch (4/6 platforms).
This commit is contained in:
Abdessamad Derraz
2026-03-24 21:57:49 +01:00
parent 85308edd73
commit ae4846550f
5 changed files with 39 additions and 55 deletions

View File

@@ -170,7 +170,11 @@ def deduplicate(bios_dir: str, dry_run: bool = False) -> dict:
if dry_run:
print(f" WOULD REMOVE: {dup}")
else:
os.remove(dup)
try:
os.remove(dup)
except OSError as e:
print(f" WARNING: cannot remove {dup}: {e}")
continue
# Clean up empty .variants/ directories
parent = os.path.dirname(dup)
if os.path.basename(parent) == ".variants" and not os.listdir(parent):
@@ -204,7 +208,7 @@ def deduplicate(bios_dir: str, dry_run: bool = False) -> dict:
# Write MAME clone mapping
if mame_clones:
clone_path = os.path.join(bios_dir, "_mame_clones.json")
clone_path = "_mame_clones.json"
if dry_run:
print(f"\nWould write MAME clone map: {clone_path}")
print(f" {len(mame_clones)} canonical ZIPs with "