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:
Abdessamad Derraz committed 2026-11-21 10:31:29 +01:00
1 parent 32a4ca1fa1
commit 036a6ebf29
35 files changed
+141 -170

No files matched your search

+3 -3
View File
@@ -9,6 +9,7 @@ import urllib.error
import urllib.parse
from core.upstream import remote_etag as get_remote_etag
from core.paths import DATA_DIRS_FILE
from model.registry import data_dir_registry_at, load_versions
from .base_scraper import fetch_text
@@ -18,7 +19,6 @@ log = logging.getLogger(__name__)
BUILDBOT_SYSTEM_URL = "https://buildbot.libretro.com/assets/system/"
INDEX_URL = BUILDBOT_SYSTEM_URL + ".index"
DEFAULT_REGISTRY = "platforms/_data_dirs.yml"
def fetch_index() -> set[str]:
@@ -27,7 +27,7 @@ def fetch_index() -> set[str]:
def load_tracked_entries(
registry_path: str = DEFAULT_REGISTRY,
registry_path: str = DATA_DIRS_FILE,
) -> dict[str, tuple[str, str]]:
"""Load buildbot entries from _data_dirs.yml.
@@ -43,7 +43,7 @@ def load_tracked_entries(
return entries
def check(registry_path: str = DEFAULT_REGISTRY) -> dict:
def check(registry_path: str = DATA_DIRS_FILE) -> dict:
"""Run the buildbot check. Returns structured report."""
try:
index_zips = fetch_index()