mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-26 11:28:51 -06:00
refactor: reuse the shared helpers left copied
Copies of helpers the first pass created, replaced by the helper: - source_yaml_file for our YAML sources (generate_db read them in the locale's encoding, a syntax error named no file); - data_dir_registry_at in registry_bundles, platform_registry_at (new, beside load_platform_registry) in the manifest; - DATA_DIRS_FILE for the registry path five modules spelled; - load_optional_database, sha1_at, VERSIONS_FILE, installer_module; - DerivedView where a cache was keyed by id() of a dict; - count_text and series where a plural or a list was written by hand.
This commit is contained in:
1 parent
32a4ca1fa1
commit
036a6ebf29
35 files changed
+141
-170
No files matched your search
@@ -12,11 +12,10 @@ import ast
|
||||
import re
|
||||
import sys
|
||||
from collections.abc import Callable, Iterator
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
from model.database import load_database
|
||||
from core.paths import PLATFORMS_DIR, REPO_ROOT
|
||||
from core.paths import DB_FILE, PLATFORMS_DIR, REPO_ROOT
|
||||
from model.targets import load_target_config, target_overrides
|
||||
from core.hashing import cut_md5_owner
|
||||
from model.safeparse import yaml_load_upstream
|
||||
@@ -315,7 +314,7 @@ _MD5_RE = re.compile(r"^[a-fA-F0-9]+$")
|
||||
|
||||
def _load_md5_index() -> dict[str, str]:
|
||||
"""Load by_md5 index from database.json for prefix resolution."""
|
||||
db_path = Path(__file__).resolve().parents[2] / "database.json"
|
||||
db_path = REPO_ROOT / DB_FILE
|
||||
if not db_path.exists():
|
||||
return {}
|
||||
return load_database(str(db_path)).get("indexes", {}).get("by_md5", {})
|
||||
|
||||
Reference in new issue
Block a user