fix: skip hash merge backups in every loader

This commit is contained in:
Abdessamad Derraz committed 2026-10-16 18:09:45 +02:00
1 parent 866f214e20
commit d4e2e5ac8a
7 files changed
+51 -20

No files matched your search

+3 -3
View File
@@ -14,7 +14,7 @@ from pathlib import Path
from typing import Any
from common import write_text_atomic, yaml_load
from common import PROFILE_BACKUP_SUFFIX, write_text_atomic, yaml_load
_MAME_RELEASE_RE = re.compile(r"^0\.\d+")
@@ -381,7 +381,7 @@ def _backup_and_write(path: str, data: dict) -> None:
(core_version, contents, source_ref), and appends new entries.
"""
p = Path(path)
backup = p.with_suffix(".old.yml")
backup = p.with_suffix(PROFILE_BACKUP_SUFFIX)
shutil.copy2(p, backup)
original = p.read_text(encoding="utf-8")
@@ -572,7 +572,7 @@ def _backup_and_write_fbneo(path: str, data: dict, hashes: dict) -> None:
Existing entries are left untouched (CRC32 changes are rare).
"""
p = Path(path)
backup = p.with_suffix(".old.yml")
backup = p.with_suffix(PROFILE_BACKUP_SUFFIX)
shutil.copy2(p, backup)
original = p.read_text(encoding="utf-8")
+2 -4
View File
@@ -20,7 +20,7 @@ from typing import Any
import yaml
from common import write_text_atomic, yaml_load
from common import source_yaml_paths, write_text_atomic, yaml_load
from scripts.scraper._hash_merge import compute_diff, merge_fbneo_profile
from scripts.scraper.fbneo_parser import parse_fbneo_source_tree
@@ -200,9 +200,7 @@ def fetch_and_cache(force: bool = False) -> dict[str, Any]:
def _find_fbneo_profiles() -> list[Path]:
"""Find emulator profiles whose upstream references finalburnneo/FBNeo."""
profiles: list[Path] = []
for path in sorted(EMULATORS_DIR.glob("*.yml")):
if path.name.endswith(".old.yml"):
continue
for path in source_yaml_paths(EMULATORS_DIR):
try:
data = yaml_load(path.read_text(encoding="utf-8"))
except (yaml.YAMLError, OSError):
+2 -4
View File
@@ -22,7 +22,7 @@ from typing import Any
import yaml
from common import write_text_atomic, yaml_load
from common import source_yaml_paths, write_text_atomic, yaml_load
from ._hash_merge import compute_diff, merge_mame_profile
from .mame_parser import parse_mame_source_tree
@@ -181,9 +181,7 @@ _MAME_TREES = frozenset({
def _find_mame_profiles() -> list[Path]:
profiles: list[Path] = []
for path in sorted(_EMULATORS_DIR.glob("*.yml")):
if path.name.endswith(".old.yml"):
continue
for path in source_yaml_paths(_EMULATORS_DIR):
try:
with open(path, encoding="utf-8") as f:
data = yaml_load(f)