mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-12-02 06:18:51 -06:00
refactor: one whole-tree gap report for both
This commit is contained in:
1 parent
5d8320f735
commit
82cb80d554
6 files changed
+48
-38
No files matched your search
@@ -11,6 +11,7 @@ from model.alternatives import set_keys, set_requirements, settle_sets
|
||||
from model.database import get_mame_clone_map
|
||||
from model.declarations import OUTER_ROOTS
|
||||
from model.platforms import load_platform_config
|
||||
from model.profilekinds import is_emulator
|
||||
from model.registry import list_registered_platforms
|
||||
from model.systems import norm_system_id
|
||||
from packs.gaps import gap_destination
|
||||
@@ -87,6 +88,30 @@ def global_report_scope(
|
||||
}
|
||||
|
||||
|
||||
def emulator_profiles(profiles: dict[str, dict]) -> dict[str, dict]:
|
||||
"""The profiles a gap report compares: neither aliases nor test cores."""
|
||||
return {key: profile for key, profile in profiles.items() if is_emulator(profile)}
|
||||
|
||||
|
||||
def whole_tree_gaps(
|
||||
configs: list[dict], db: dict, profiles: dict[str, dict],
|
||||
data_names: SupplementalIndex | None = None,
|
||||
compared: dict[str, dict] | None = None,
|
||||
) -> dict:
|
||||
"""Each emulator of *compared* (every one of *profiles* by default) with
|
||||
the files no platform of *configs* declares.
|
||||
|
||||
The command line without --platform, the site's gap page and the gaps
|
||||
export read this one report. *profiles* is every profile of the run: the
|
||||
standalone layout is proven against them.
|
||||
"""
|
||||
declared, scope = global_report_scope(configs, db, profiles)
|
||||
return cross_reference(
|
||||
emulator_profiles(profiles if compared is None else compared),
|
||||
declared, db, data_names, **scope,
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
def _resolve_source(
|
||||
|
||||
@@ -2,7 +2,13 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from packs.crossref import cross_reference, global_report_scope, platform_configs
|
||||
from packs.crossref import (
|
||||
cross_reference,
|
||||
emulator_profiles,
|
||||
global_report_scope,
|
||||
platform_configs,
|
||||
whole_tree_gaps,
|
||||
)
|
||||
from packs.crossrefscope import TreeScope
|
||||
from packs.supplemental import build_supplemental_index
|
||||
from resolve.launchers import LauncherLayer, declared_destinations
|
||||
@@ -14,18 +20,19 @@ def scope_gaps(
|
||||
) -> dict:
|
||||
"""Each profile of the scope with the files its platforms leave undeclared."""
|
||||
platform_scope = tree.platform
|
||||
declared, global_scope = global_report_scope(
|
||||
platform_configs(platforms_dir, tree.selected), db, all_profiles)
|
||||
global_scope["standalone_cores"] = tree.standalone_cores
|
||||
configs = platform_configs(platforms_dir, tree.selected)
|
||||
data_names = build_supplemental_index()
|
||||
if platform_scope is None:
|
||||
return whole_tree_gaps(configs, db, all_profiles, data_names, tree.profiles)
|
||||
declared, global_scope = global_report_scope(configs, db, all_profiles)
|
||||
# The platform's own layout, its per-core directory markers kept.
|
||||
global_scope["standalone_cores"] = tree.standalone_cores
|
||||
return cross_reference(
|
||||
tree.profiles, declared, db, data_names, **global_scope,
|
||||
platform=(
|
||||
platform_scope.config.get("_key", platform) if platform_scope else ""
|
||||
),
|
||||
emulator_profiles(tree.profiles), declared, db, data_names, **global_scope,
|
||||
platform=platform_scope.config.get("_key", platform),
|
||||
# What the platform's launchers open, as verify and the builder read it.
|
||||
launcher_layer=LauncherLayer(
|
||||
platform_scope.config, tree.profiles, platform_scope.relevant, db,
|
||||
declared_destinations(platform_scope.config),
|
||||
) if platform_scope else None,
|
||||
),
|
||||
)
|
||||
@@ -24,6 +24,7 @@ from model.profiles import is_emulator, lists_files, load_emulator_profiles
|
||||
from model.registry import list_registered_platforms, load_platform_registry
|
||||
from model.systemnames import program_names, set_console_sections, system_name
|
||||
from packs.consumers import FileConsumers
|
||||
from packs.crossref import whole_tree_gaps
|
||||
from packs.supplemental import SupplementalIndex
|
||||
from acquire.provenance import build_report, profile_needs
|
||||
from resolve.cores import resolve_platform_cores
|
||||
@@ -46,7 +47,6 @@ from core.paths import REPO_ROOT
|
||||
from sitegen.crossref import generate_cross_reference
|
||||
from sitegen.dataexports import (
|
||||
source_commit,
|
||||
build_emulator_gap_report,
|
||||
generate_data_exports,
|
||||
generate_stats,
|
||||
system_export_item,
|
||||
@@ -663,7 +663,8 @@ def generate_site(args: argparse.Namespace) -> None:
|
||||
|
||||
# Computed once: the gap analysis page and the published gaps export must
|
||||
# report the same files.
|
||||
run.gap_report = build_emulator_gap_report(profiles, coverages, db, run.suppl_names)
|
||||
run.gap_report = whole_tree_gaps(
|
||||
[cov["config"] for cov in coverages.values()], db, profiles, run.suppl_names)
|
||||
# Built once, the derivable dumps taken out once: the provenance page and
|
||||
# the CSV it links to must list the same dumps.
|
||||
dumps = wanted_dumps(
|
||||
|
||||
@@ -21,7 +21,6 @@ from model.database import sha1_at
|
||||
from model.platforms import PLATFORMS_DIR_KEY
|
||||
from model.profiles import is_emulator
|
||||
from packs.consumers import FileConsumers
|
||||
from packs.supplemental import SupplementalIndex
|
||||
from sitegen.apiitems import core_index_items, system_index_items
|
||||
from sitegen.config import DATA_LICENSE, REPO_URL, build_commit
|
||||
from core.paths import REPO_ROOT
|
||||
@@ -237,29 +236,6 @@ def _emulator_export_items(profiles: dict) -> list[dict]:
|
||||
]
|
||||
|
||||
|
||||
def build_emulator_gap_report(
|
||||
profiles: dict,
|
||||
coverages: dict,
|
||||
db: dict,
|
||||
data_names: SupplementalIndex | None = None,
|
||||
) -> dict:
|
||||
"""Files a core loads that no platform declares, per emulator profile.
|
||||
|
||||
The gap analysis page and the published gaps export must not compute this
|
||||
twice and drift. Both read this one report.
|
||||
"""
|
||||
from packs.crossref import cross_reference as run_cross_reference, global_report_scope
|
||||
|
||||
declared, scope = global_report_scope(
|
||||
[cov["config"] for cov in coverages.values()], db, profiles)
|
||||
unique_profiles = {
|
||||
k: v
|
||||
for k, v in profiles.items()
|
||||
if is_emulator(v)
|
||||
}
|
||||
return run_cross_reference(unique_profiles, declared, db, data_names=data_names, **scope)
|
||||
|
||||
|
||||
def _gap_export_rows(
|
||||
coverages: dict, gap_report: dict | None = None, db: dict | None = None,
|
||||
profiles: dict | None = None,
|
||||
|
||||
@@ -12,14 +12,13 @@ from core.text import series
|
||||
from model.database import sha1_at
|
||||
from model.platforms import native_layer
|
||||
from model.profiles import is_emulator
|
||||
from packs.crossref import gap_source_counts
|
||||
from packs.crossref import gap_source_counts, whole_tree_gaps
|
||||
from resolve.cores import resolve_platform_cores
|
||||
from resolve.nativemode import check_label
|
||||
from resolve.sendable import sendable
|
||||
from sitegen import markup, wanted as sitewanted
|
||||
from sitegen.cards import PROVENANCE_LABELS, fetch_url
|
||||
from sitegen.config import date_line
|
||||
from sitegen.dataexports import build_emulator_gap_report
|
||||
from sitegen.emulatorsindex import content_check_ceiling
|
||||
from sitegen.parts import list_pages
|
||||
from sitegen.render import code_span, count_text, escape_tags
|
||||
@@ -996,7 +995,8 @@ def generate_gap_analysis(
|
||||
# ---- Section 3: Core complement (cross-reference provenance) ----
|
||||
|
||||
if gap_report is None:
|
||||
gap_report = build_emulator_gap_report(profiles, coverages, db, data_names)
|
||||
gap_report = whole_tree_gaps(
|
||||
[cov["config"] for cov in coverages.values()], db, profiles, data_names)
|
||||
report_all = gap_report
|
||||
src_totals, total_undeclared, emulator_gaps = _undeclared_gaps(report_all)
|
||||
|
||||
|
||||
Reference in new issue
Block a user