mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-22 17:47:48 -06:00
refactor: move coverage and release out of readme
This commit is contained in:
1 parent
9521dd040a
commit
416299b6e0
19 files changed
+417
-384
No files matched your search
@@ -139,6 +139,7 @@ on:
|
||||
- "scripts/sitegen/cards.py"
|
||||
- "scripts/sitegen/config.py"
|
||||
- "scripts/sitegen/consolecards.py"
|
||||
- "scripts/sitegen/coverage.py"
|
||||
- "scripts/sitegen/crossref.py"
|
||||
- "scripts/sitegen/dataexports.py"
|
||||
- "scripts/sitegen/datapage.py"
|
||||
@@ -150,6 +151,7 @@ on:
|
||||
- "scripts/sitegen/emulatorsindex.py"
|
||||
- "scripts/sitegen/entries.py"
|
||||
- "scripts/sitegen/exports.py"
|
||||
- "scripts/sitegen/extraction.py"
|
||||
- "scripts/sitegen/fields.py"
|
||||
- "scripts/sitegen/gaps.py"
|
||||
- "scripts/sitegen/getpages.py"
|
||||
@@ -173,6 +175,7 @@ on:
|
||||
- "scripts/sitegen/publish.py"
|
||||
- "scripts/sitegen/readme.py"
|
||||
- "scripts/sitegen/reference.py"
|
||||
- "scripts/sitegen/releasepacks.py"
|
||||
- "scripts/sitegen/render.py"
|
||||
- "scripts/sitegen/sources.py"
|
||||
- "scripts/sitegen/starlight.py"
|
||||
|
||||
@@ -92,7 +92,7 @@ from sitegen.platformindex import SETUP_TABLE_PAGE, generate_platform_index, wit
|
||||
from sitegen.platformpage import own_list_only, generate_platform_page
|
||||
from sitegen.provenance import WantedDumps, generate_provenance_page, load_derivable, wanted_dumps
|
||||
from sitegen.publish import write_release_advertised
|
||||
from sitegen.readme import platform_coverages
|
||||
from sitegen.coverage import platform_coverages
|
||||
from sitegen.reference import (
|
||||
generate_contributing,
|
||||
generate_not_found,
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
"""Coverage of each platform as verify counts it, cached between the site and README builds."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
from collections.abc import Callable
|
||||
from pathlib import Path
|
||||
|
||||
from core.cli import InputMissing
|
||||
from core.paths import DB_FILE, EMULATORS_DIR, REPO_ROOT
|
||||
from model.largefiles import LARGE_FILES_CACHE
|
||||
from model.platforms import load_platform_config
|
||||
from model.profiles import load_emulator_profiles
|
||||
from model.registry import VERSIONS_FILE
|
||||
from packs.coverage import verify_platform
|
||||
from packs.verdicts import blocking_missing
|
||||
from resolve.cores import resolve_platform_cores
|
||||
from sitegen.install import display_name
|
||||
|
||||
|
||||
# The repository's profiles wherever the script is run from: a bare
|
||||
# "emulators" read the working directory, and a run elsewhere counted 0 cores.
|
||||
_EMULATORS_DIR = str(REPO_ROOT / EMULATORS_DIR)
|
||||
|
||||
|
||||
def compute_coverage(
|
||||
platform_name: str,
|
||||
platforms_dir: str,
|
||||
db: dict,
|
||||
data_registry: dict | None = None,
|
||||
emulators_dir: str = _EMULATORS_DIR,
|
||||
) -> dict:
|
||||
config = load_platform_config(platform_name, platforms_dir)
|
||||
result = verify_platform(
|
||||
config,
|
||||
db,
|
||||
emulators_dir,
|
||||
data_dir_registry=data_registry,
|
||||
)
|
||||
sc = result.get("status_counts", {})
|
||||
ok = sc.get("ok", 0)
|
||||
untested = sc.get("untested", 0)
|
||||
missing = sc.get("missing", 0)
|
||||
total = result["total_files"]
|
||||
# An UNTESTED file the builder refuses (its declared hash contradicted on
|
||||
# a hash platform) is held, not packed.
|
||||
present = ok + untested - len(result.get("excluded_files", []))
|
||||
pct = (present / total * 100) if total > 0 else 0
|
||||
undeclared = result.get("undeclared_files", [])
|
||||
# Held is not packed: a file the platform has no folder for, or one below
|
||||
# a folder it lists flat, stays out of the pack the fraction describes.
|
||||
core_present = sum(
|
||||
1 for u in undeclared if u.get("in_repo") and u.get("in_pack", True)
|
||||
)
|
||||
core_missing = len(undeclared) - core_present
|
||||
# Files a profile marks unsourceable never reach the undeclared list, so
|
||||
# the gap they represent has to be counted back in.
|
||||
profiles = load_emulator_profiles(emulators_dir)
|
||||
unsourceable_names = {
|
||||
f.get("name", "")
|
||||
for emu in resolve_platform_cores(config, profiles)
|
||||
for f in (profiles.get(emu) or {}).get("files", []) or []
|
||||
if f.get("unsourceable")
|
||||
}
|
||||
core_unsourceable = len(unsourceable_names)
|
||||
missing_names = unsourceable_names | {
|
||||
u.get("name", "") for u in undeclared if not u.get("in_repo")
|
||||
}
|
||||
return {
|
||||
"platform": display_name(config, platform_name),
|
||||
"total": total,
|
||||
"verified": ok,
|
||||
"untested": untested,
|
||||
"missing": missing,
|
||||
"missing_not_firmware": {
|
||||
category: len(dests)
|
||||
for category, dests in (result.get("missing_not_firmware") or {}).items()
|
||||
},
|
||||
"present": present,
|
||||
"percentage": pct,
|
||||
"core_present": core_present,
|
||||
"core_missing": core_missing,
|
||||
"core_unsourceable": core_unsourceable,
|
||||
"missing_names": missing_names,
|
||||
"unsourceable_names": unsourceable_names,
|
||||
"pack_files": present + core_present,
|
||||
"total_missing": missing + core_missing,
|
||||
"mode": config.get("verification_mode", "existence"),
|
||||
# The gaps page badge: verify's count, never refiltered from details.
|
||||
"required_missing": blocking_missing(
|
||||
result["severity_counts"], result["verification_mode"]),
|
||||
"details": result["details"],
|
||||
"config": config,
|
||||
"ground_truth": result.get(
|
||||
"ground_truth_coverage",
|
||||
{"with_validation": 0, "platform_only": total, "total": total},
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
# The site and the README read the same coverage: the first generator to run
|
||||
# stores it here and the second reads it back, instead of verifying every
|
||||
# platform twice (about a minute of the site build).
|
||||
COVERAGE_CACHE_DIR = REPO_ROOT / "tmp" / "coverage-cache"
|
||||
_COVERAGE_CACHE_FORMAT = "4"
|
||||
|
||||
|
||||
def _coverage_inputs(db_path: Path, platforms_dir: str, emulators_dir: str) -> str:
|
||||
"""A digest of everything coverage is computed from.
|
||||
|
||||
The database, the platform and emulator files, the code, the install
|
||||
manifests, the data directory revisions, the state of bios/ on disk, and
|
||||
what a release asset resolves to: the large-file cache and whether this
|
||||
run may download. A test run is offline with its own cache, and its
|
||||
result was read back by the next normal run (Lakka 534/535 for 535/535).
|
||||
A change to any of them computes the coverage again.
|
||||
"""
|
||||
import hashlib
|
||||
|
||||
digest = hashlib.sha256(_COVERAGE_CACHE_FORMAT.encode())
|
||||
|
||||
def add_file(path: Path) -> None:
|
||||
digest.update(str(path).encode() + b"\0")
|
||||
digest.update(path.read_bytes() if path.is_file() else b"<absent>")
|
||||
|
||||
add_file(db_path.resolve())
|
||||
for root, pattern in ((Path(platforms_dir), "*"), (Path(emulators_dir), "*.yml"),
|
||||
(REPO_ROOT / "scripts", "*.py"), (REPO_ROOT / "install", "*.json"),
|
||||
(REPO_ROOT / "recipes", "*.json")):
|
||||
for path in sorted(p for p in root.resolve().rglob(pattern) if p.is_file()):
|
||||
add_file(path)
|
||||
for path in (REPO_ROOT / ".gitignore", REPO_ROOT / "_mame_clones.json",
|
||||
REPO_ROOT / VERSIONS_FILE):
|
||||
add_file(path)
|
||||
digest.update(b"offline\0" + (b"1" if os.environ.get("RETROBIOS_OFFLINE") else b"0") + b"\n")
|
||||
large = Path(LARGE_FILES_CACHE).resolve()
|
||||
digest.update(str(large).encode() + b"\0")
|
||||
for path in sorted(large.glob("*")) if large.is_dir() else ():
|
||||
if path.is_file():
|
||||
stat = path.stat()
|
||||
digest.update(f"{path.name}\0{stat.st_size}\0{stat.st_mtime_ns}\n".encode())
|
||||
bios = REPO_ROOT / "bios"
|
||||
for path in sorted(bios.rglob("*")):
|
||||
if path.is_file():
|
||||
stat = path.stat()
|
||||
digest.update(f"{path.relative_to(bios)}\0{stat.st_size}\0{stat.st_mtime_ns}\n".encode())
|
||||
return digest.hexdigest()
|
||||
|
||||
|
||||
def platform_coverages(
|
||||
platform_names: list[str],
|
||||
platforms_dir: str,
|
||||
db: dict,
|
||||
data_registry: dict | None = None,
|
||||
emulators_dir: str = _EMULATORS_DIR,
|
||||
db_path: str = DB_FILE,
|
||||
report: Callable[[str, dict], None] | None = None,
|
||||
) -> dict[str, dict]:
|
||||
"""compute_coverage for each platform, read from the cache when its
|
||||
inputs have not changed since a generator last stored it.
|
||||
|
||||
A platform with no YAML is left out, as compute_coverage raises for it.
|
||||
``report`` is called with each platform and its coverage.
|
||||
"""
|
||||
# pickle, not JSON: the coverage holds sets and enums that JSON would
|
||||
# turn into lists and strings. The file is written by this function into
|
||||
# the repository's own tmp/, never downloaded.
|
||||
import pickle
|
||||
|
||||
key = _coverage_inputs(Path(db_path), platforms_dir, emulators_dir)
|
||||
names = sorted(platform_names)
|
||||
cache = COVERAGE_CACHE_DIR / f"{key}.pickle"
|
||||
coverages: dict[str, dict] | None = None
|
||||
if cache.is_file():
|
||||
try:
|
||||
with cache.open("rb") as handle:
|
||||
stored = pickle.load(handle)
|
||||
except (OSError, EOFError, pickle.UnpicklingError) as exc:
|
||||
print(f" coverage cache unreadable, computing again: {exc}", file=sys.stderr)
|
||||
else:
|
||||
if stored.get("platforms") == names:
|
||||
coverages = stored["coverages"]
|
||||
print(f" coverage read from {cache.relative_to(REPO_ROOT)}")
|
||||
if coverages is None:
|
||||
coverages = {}
|
||||
for name in names:
|
||||
try:
|
||||
coverages[name] = compute_coverage(
|
||||
name, platforms_dir, db, data_registry, emulators_dir=emulators_dir,
|
||||
)
|
||||
except InputMissing:
|
||||
# A missing profile or platform directory is no platform
|
||||
# left out: it emptied every one and cached the result.
|
||||
raise
|
||||
except FileNotFoundError as exc:
|
||||
print(f" {name}: skipped ({exc})", file=sys.stderr)
|
||||
COVERAGE_CACHE_DIR.mkdir(parents=True, exist_ok=True)
|
||||
scratch = cache.with_suffix(f".{os.getpid()}.tmp")
|
||||
with scratch.open("wb") as handle:
|
||||
pickle.dump({"platforms": names, "coverages": coverages}, handle,
|
||||
protocol=pickle.HIGHEST_PROTOCOL)
|
||||
scratch.replace(cache)
|
||||
# generate_site and generate_readme both purge here. One unlinking
|
||||
# what the other had just listed ended it on FileNotFoundError.
|
||||
for stale in COVERAGE_CACHE_DIR.glob("*.pickle"):
|
||||
if stale != cache:
|
||||
stale.unlink(missing_ok=True)
|
||||
ordered = {name: coverages[name] for name in platform_names if name in coverages}
|
||||
if report:
|
||||
for name in names:
|
||||
if name in ordered:
|
||||
report(name, ordered[name])
|
||||
return ordered
|
||||
@@ -0,0 +1,56 @@
|
||||
"""Where each platform's pack extracts, and the packs that carry their own root folder."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from model.declarations import declared_root
|
||||
from model.platforms import load_platform_config
|
||||
from model.registry import load_platform_registry
|
||||
from sitegen.install import display_name, platform_display
|
||||
|
||||
|
||||
def extract_targets(platforms_dir: str) -> list[tuple[str, str]]:
|
||||
"""(display name, folder) per registered platform, where its pack extracts.
|
||||
|
||||
Read from the registry so the README, the site and the pack guide answer
|
||||
from one place. Sorted by display name.
|
||||
"""
|
||||
rows = [
|
||||
(platform_display(key, platforms_dir), entry["extract_to"])
|
||||
for key, entry in load_platform_registry(platforms_dir).items()
|
||||
if entry.get("extract_to")
|
||||
]
|
||||
return sorted(rows, key=lambda row: row[0].casefold())
|
||||
|
||||
|
||||
def own_root(config: dict) -> str:
|
||||
"""The folder a pack written from an empty base_destination starts with.
|
||||
|
||||
RetroDECK writes bios/ in front of its files, the MinUI family hands its
|
||||
cores folders below Bios/.
|
||||
"""
|
||||
root = declared_root(config)
|
||||
if root:
|
||||
return root
|
||||
tops = {directory.split("/", 1)[0] for directory in config.get("core_system_dirs") or {}}
|
||||
return tops.pop() if len(tops) == 1 else "bios"
|
||||
|
||||
|
||||
def extract_notes(platforms_dir: str, released_only: bool = False) -> list[str]:
|
||||
"""A pack whose entries carry their own root extracts above the BIOS folder.
|
||||
|
||||
*released_only* keeps the platforms a release publishes a pack for.
|
||||
"""
|
||||
folders = dict(extract_targets(platforms_dir))
|
||||
registry = load_platform_registry(platforms_dir)
|
||||
notes = []
|
||||
for key in sorted(registry):
|
||||
if released_only and registry[key].get("release_pack") is not True:
|
||||
continue
|
||||
config = load_platform_config(key, platforms_dir)
|
||||
display = display_name(config, key)
|
||||
if config.get("base_destination") == "" and display in folders:
|
||||
notes.append(
|
||||
f"The {display} pack holds its own `{own_root(config)}/` folder."
|
||||
f" Unzip it into `{folders[display]}`."
|
||||
)
|
||||
return notes
|
||||
@@ -27,7 +27,7 @@ from sitegen.guidepage import (
|
||||
from sitegen.home import next_block
|
||||
from sitegen.install import display_name, has_release_pack, platform_display
|
||||
from sitegen.parts import parent_front_matter
|
||||
from sitegen.readme import asset_links
|
||||
from sitegen.releasepacks import asset_links
|
||||
from sitegen.versions import release_line, version_line
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,8 @@ from core.sizes import size_text
|
||||
from sitegen.guides import platform_args, terminal_tabs
|
||||
from sitegen.home import next_block
|
||||
from sitegen.install import installer_module, has_release_pack, platform_display
|
||||
from sitegen.readme import download_links, extract_notes
|
||||
from sitegen.extraction import extract_notes
|
||||
from sitegen.releasepacks import download_links
|
||||
from sitegen.versions import release_line, setup_version, version_line
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from resolve.nativemode import check_label
|
||||
from sitegen import markup
|
||||
from sitegen.guidepage import NO_ZIP_FAQ
|
||||
from sitegen.home import group_members
|
||||
from sitegen.readme import release_state, release_totals
|
||||
from sitegen.releasepacks import release_state, release_totals
|
||||
|
||||
|
||||
# Platform pages
|
||||
|
||||
+5
-347
@@ -8,369 +8,27 @@ import re
|
||||
import sys
|
||||
from collections.abc import Callable
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
|
||||
from core.text import series
|
||||
from romrecipes import ledger
|
||||
from devtools import prchecks
|
||||
from model import releaserecord
|
||||
from core.artifacts import write_if_changed
|
||||
from core.cli import InputMissing
|
||||
from core.paths import DB_FILE, REPO_ROOT
|
||||
from core.sizes import size_text
|
||||
from core import upstream
|
||||
from installer_build.module import installer_module
|
||||
from model.composition import compute_composition, count_catalog_matched
|
||||
from model.declarations import declared_root
|
||||
from model.guides import PACKAGE_COMMAND, install_command
|
||||
from model.largefiles import LARGE_FILES_CACHE, load_registered_paths
|
||||
from model.platforms import load_platform_config
|
||||
from model.largefiles import load_registered_paths
|
||||
from model.profiles import load_emulator_profiles, unique_emulator_profiles
|
||||
from model.registry import VERSIONS_FILE, list_registered_platforms, load_platform_registry
|
||||
from model.registry import list_registered_platforms
|
||||
from model.systems import system_index
|
||||
from packs.coverage import verify_platform
|
||||
from packs.verdicts import blocking_missing
|
||||
from resolve.cores import resolve_platform_cores
|
||||
from resolve.review import LARGE_FILE_ISSUE_URL
|
||||
from sitegen.config import REPO_SLUG, REPO_URL, SITE_URL, UPLOAD_ROOT
|
||||
from sitegen.install import display_name, has_release_pack, platform_display
|
||||
|
||||
|
||||
# The repository's profiles wherever the script is run from: a bare
|
||||
# "emulators" read the working directory, and a run elsewhere counted 0 cores.
|
||||
_EMULATORS_DIR = str(REPO_ROOT / "emulators")
|
||||
|
||||
|
||||
def compute_coverage(
|
||||
platform_name: str,
|
||||
platforms_dir: str,
|
||||
db: dict,
|
||||
data_registry: dict | None = None,
|
||||
emulators_dir: str = _EMULATORS_DIR,
|
||||
) -> dict:
|
||||
config = load_platform_config(platform_name, platforms_dir)
|
||||
result = verify_platform(
|
||||
config,
|
||||
db,
|
||||
emulators_dir,
|
||||
data_dir_registry=data_registry,
|
||||
)
|
||||
sc = result.get("status_counts", {})
|
||||
ok = sc.get("ok", 0)
|
||||
untested = sc.get("untested", 0)
|
||||
missing = sc.get("missing", 0)
|
||||
total = result["total_files"]
|
||||
# An UNTESTED file the builder refuses (its declared hash contradicted on
|
||||
# a hash platform) is held, not packed.
|
||||
present = ok + untested - len(result.get("excluded_files", []))
|
||||
pct = (present / total * 100) if total > 0 else 0
|
||||
undeclared = result.get("undeclared_files", [])
|
||||
# Held is not packed: a file the platform has no folder for, or one below
|
||||
# a folder it lists flat, stays out of the pack the fraction describes.
|
||||
core_present = sum(
|
||||
1 for u in undeclared if u.get("in_repo") and u.get("in_pack", True)
|
||||
)
|
||||
core_missing = len(undeclared) - core_present
|
||||
# Files a profile marks unsourceable never reach the undeclared list, so
|
||||
# the gap they represent has to be counted back in.
|
||||
profiles = load_emulator_profiles(emulators_dir)
|
||||
unsourceable_names = {
|
||||
f.get("name", "")
|
||||
for emu in resolve_platform_cores(config, profiles)
|
||||
for f in (profiles.get(emu) or {}).get("files", []) or []
|
||||
if f.get("unsourceable")
|
||||
}
|
||||
core_unsourceable = len(unsourceable_names)
|
||||
missing_names = unsourceable_names | {
|
||||
u.get("name", "") for u in undeclared if not u.get("in_repo")
|
||||
}
|
||||
return {
|
||||
"platform": display_name(config, platform_name),
|
||||
"total": total,
|
||||
"verified": ok,
|
||||
"untested": untested,
|
||||
"missing": missing,
|
||||
"missing_not_firmware": {
|
||||
category: len(dests)
|
||||
for category, dests in (result.get("missing_not_firmware") or {}).items()
|
||||
},
|
||||
"present": present,
|
||||
"percentage": pct,
|
||||
"core_present": core_present,
|
||||
"core_missing": core_missing,
|
||||
"core_unsourceable": core_unsourceable,
|
||||
"missing_names": missing_names,
|
||||
"unsourceable_names": unsourceable_names,
|
||||
"pack_files": present + core_present,
|
||||
"total_missing": missing + core_missing,
|
||||
"mode": config.get("verification_mode", "existence"),
|
||||
# The gaps page badge: verify's count, never refiltered from details.
|
||||
"required_missing": blocking_missing(
|
||||
result["severity_counts"], result["verification_mode"]),
|
||||
"details": result["details"],
|
||||
"config": config,
|
||||
"ground_truth": result.get(
|
||||
"ground_truth_coverage",
|
||||
{"with_validation": 0, "platform_only": total, "total": total},
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
# The site and the README read the same coverage: the first generator to run
|
||||
# stores it here and the second reads it back, instead of verifying every
|
||||
# platform twice (about a minute of the site build).
|
||||
COVERAGE_CACHE_DIR = REPO_ROOT / "tmp" / "coverage-cache"
|
||||
_COVERAGE_CACHE_FORMAT = "4"
|
||||
|
||||
|
||||
def _coverage_inputs(db_path: Path, platforms_dir: str, emulators_dir: str) -> str:
|
||||
"""A digest of everything coverage is computed from.
|
||||
|
||||
The database, the platform and emulator files, the code, the install
|
||||
manifests, the data directory revisions, the state of bios/ on disk, and
|
||||
what a release asset resolves to: the large-file cache and whether this
|
||||
run may download. A test run is offline with its own cache, and its
|
||||
result was read back by the next normal run (Lakka 534/535 for 535/535).
|
||||
A change to any of them computes the coverage again.
|
||||
"""
|
||||
import hashlib
|
||||
|
||||
digest = hashlib.sha256(_COVERAGE_CACHE_FORMAT.encode())
|
||||
|
||||
def add_file(path: Path) -> None:
|
||||
digest.update(str(path).encode() + b"\0")
|
||||
digest.update(path.read_bytes() if path.is_file() else b"<absent>")
|
||||
|
||||
add_file(db_path.resolve())
|
||||
for root, pattern in ((Path(platforms_dir), "*"), (Path(emulators_dir), "*.yml"),
|
||||
(REPO_ROOT / "scripts", "*.py"), (REPO_ROOT / "install", "*.json"),
|
||||
(REPO_ROOT / "recipes", "*.json")):
|
||||
for path in sorted(p for p in root.resolve().rglob(pattern) if p.is_file()):
|
||||
add_file(path)
|
||||
for path in (REPO_ROOT / ".gitignore", REPO_ROOT / "_mame_clones.json",
|
||||
REPO_ROOT / VERSIONS_FILE):
|
||||
add_file(path)
|
||||
digest.update(b"offline\0" + (b"1" if os.environ.get("RETROBIOS_OFFLINE") else b"0") + b"\n")
|
||||
large = Path(LARGE_FILES_CACHE).resolve()
|
||||
digest.update(str(large).encode() + b"\0")
|
||||
for path in sorted(large.glob("*")) if large.is_dir() else ():
|
||||
if path.is_file():
|
||||
stat = path.stat()
|
||||
digest.update(f"{path.name}\0{stat.st_size}\0{stat.st_mtime_ns}\n".encode())
|
||||
bios = REPO_ROOT / "bios"
|
||||
for path in sorted(bios.rglob("*")):
|
||||
if path.is_file():
|
||||
stat = path.stat()
|
||||
digest.update(f"{path.relative_to(bios)}\0{stat.st_size}\0{stat.st_mtime_ns}\n".encode())
|
||||
return digest.hexdigest()
|
||||
|
||||
|
||||
def platform_coverages(
|
||||
platform_names: list[str],
|
||||
platforms_dir: str,
|
||||
db: dict,
|
||||
data_registry: dict | None = None,
|
||||
emulators_dir: str = _EMULATORS_DIR,
|
||||
db_path: str = DB_FILE,
|
||||
report: Callable[[str, dict], None] | None = None,
|
||||
) -> dict[str, dict]:
|
||||
"""compute_coverage for each platform, read from the cache when its
|
||||
inputs have not changed since a generator last stored it.
|
||||
|
||||
A platform with no YAML is left out, as compute_coverage raises for it.
|
||||
``report`` is called with each platform and its coverage.
|
||||
"""
|
||||
# pickle, not JSON: the coverage holds sets and enums that JSON would
|
||||
# turn into lists and strings. The file is written by this function into
|
||||
# the repository's own tmp/, never downloaded.
|
||||
import pickle
|
||||
|
||||
key = _coverage_inputs(Path(db_path), platforms_dir, emulators_dir)
|
||||
names = sorted(platform_names)
|
||||
cache = COVERAGE_CACHE_DIR / f"{key}.pickle"
|
||||
coverages: dict[str, dict] | None = None
|
||||
if cache.is_file():
|
||||
try:
|
||||
with cache.open("rb") as handle:
|
||||
stored = pickle.load(handle)
|
||||
except (OSError, EOFError, pickle.UnpicklingError) as exc:
|
||||
print(f" coverage cache unreadable, computing again: {exc}", file=sys.stderr)
|
||||
else:
|
||||
if stored.get("platforms") == names:
|
||||
coverages = stored["coverages"]
|
||||
print(f" coverage read from {cache.relative_to(REPO_ROOT)}")
|
||||
if coverages is None:
|
||||
coverages = {}
|
||||
for name in names:
|
||||
try:
|
||||
coverages[name] = compute_coverage(
|
||||
name, platforms_dir, db, data_registry, emulators_dir=emulators_dir,
|
||||
)
|
||||
except InputMissing:
|
||||
# A missing profile or platform directory is no platform
|
||||
# left out: it emptied every one and cached the result.
|
||||
raise
|
||||
except FileNotFoundError as exc:
|
||||
print(f" {name}: skipped ({exc})", file=sys.stderr)
|
||||
COVERAGE_CACHE_DIR.mkdir(parents=True, exist_ok=True)
|
||||
scratch = cache.with_suffix(f".{os.getpid()}.tmp")
|
||||
with scratch.open("wb") as handle:
|
||||
pickle.dump({"platforms": names, "coverages": coverages}, handle,
|
||||
protocol=pickle.HIGHEST_PROTOCOL)
|
||||
scratch.replace(cache)
|
||||
# generate_site and generate_readme both purge here. One unlinking
|
||||
# what the other had just listed ended it on FileNotFoundError.
|
||||
for stale in COVERAGE_CACHE_DIR.glob("*.pickle"):
|
||||
if stale != cache:
|
||||
stale.unlink(missing_ok=True)
|
||||
ordered = {name: coverages[name] for name in platform_names if name in coverages}
|
||||
if report:
|
||||
for name in names:
|
||||
if name in ordered:
|
||||
report(name, ordered[name])
|
||||
return ordered
|
||||
|
||||
|
||||
def release_totals(platform_name: str, record: dict) -> tuple[int | None, int | None]:
|
||||
"""Files and bytes of the pack the latest release serves for a platform.
|
||||
|
||||
The Download link gives that release, so these are the figures a reader
|
||||
can check against an extraction. The install manifests describe what
|
||||
main would build today, which is a different pack as soon as a commit
|
||||
lands after the release. Returns (None, None) for a platform the release
|
||||
carries no pack for.
|
||||
"""
|
||||
pack = releaserecord.pack_for(platform_name, record)
|
||||
if not pack:
|
||||
return None, None
|
||||
return pack["files"], pack["extracted_size"]
|
||||
|
||||
|
||||
def release_state(platform_name: str, record: dict) -> str:
|
||||
""""none" for a setup no release publishes a ZIP for (`release_pack`),
|
||||
"pending" for one the recorded release carries no pack for, added since,
|
||||
else "released". No recorded tag, no release to be missing from."""
|
||||
if not has_release_pack(platform_name):
|
||||
return "none"
|
||||
pack = releaserecord.pack_for(platform_name, record)
|
||||
if record.get("tag") and not (pack and pack.get("assets")):
|
||||
return "pending"
|
||||
return "released"
|
||||
|
||||
|
||||
NO_PACK = "Use the command"
|
||||
|
||||
|
||||
def asset_links(
|
||||
platform_name: str, record: dict, repo: str, label: str, attrs: str = "",
|
||||
button: Callable[[str, str], str] | None = None,
|
||||
) -> str:
|
||||
"""Markdown links to the files of a platform's pack in the recorded release.
|
||||
|
||||
Written on the platform's get/ page only: every other surface links that
|
||||
page, whose address does not change with the release. A pack published
|
||||
whole gets one link labelled *label*. A pack in parts gets one link per
|
||||
part, since every part is needed, after the number of files to download:
|
||||
a reader who took one link for the pack extracted half of it. *repo* is
|
||||
the repository URL, *attrs* an attribute list put after each link, or
|
||||
*button* the function that draws each link as a button. Without a
|
||||
recorded release the link is the latest release page.
|
||||
"""
|
||||
pack = releaserecord.pack_for(platform_name, record)
|
||||
tag = record.get("tag")
|
||||
assets = pack.get("assets") if pack else None
|
||||
def link(text: str, url: str) -> str:
|
||||
return button(text, url) if button else f"[{text}]({url}){attrs}"
|
||||
|
||||
if not tag or not assets:
|
||||
return link(label, f"{repo}/releases/latest")
|
||||
urls = [f"{repo}/releases/download/{tag}/{asset}" for asset in assets]
|
||||
if len(urls) == 1:
|
||||
return link(label, urls[0])
|
||||
styled = bool(attrs or button)
|
||||
parts = [
|
||||
link(f"{'P' if styled else 'p'}art {number} of {len(urls)}", url)
|
||||
for number, url in enumerate(urls, 1)
|
||||
]
|
||||
if styled:
|
||||
return f"{len(urls)} files to download, all needed: " + " ".join(parts)
|
||||
return f"{label}, {len(urls)} files, all needed: " + ", ".join(parts)
|
||||
|
||||
|
||||
def download_links(
|
||||
platform_name: str, record: dict, label: str, attrs: str = "",
|
||||
button: Callable[[str, str], str] | None = None,
|
||||
site: str = "", page: str | None = None,
|
||||
) -> str:
|
||||
"""The download cell of a platform: its permanent get/ page.
|
||||
|
||||
*record* is the release record reduced to the release_pack platforms
|
||||
(release_record.advertised). A platform with a pack in it gets *label*
|
||||
linked to its page, which lists the files of the current release. A
|
||||
platform marked release_pack but missing from the release, added since,
|
||||
gets "No ZIP yet". Any other platform is served by the installer, and
|
||||
the cell says so instead of staying empty. *site* is the site root the
|
||||
get/ address hangs from, or *page* the address itself as the site links
|
||||
it, and *attrs* and *button* style the link.
|
||||
"""
|
||||
page = page or releaserecord.get_page(platform_name, site)
|
||||
def link(text: str) -> str:
|
||||
return button(text, page) if button else f"[{text}]({page}){attrs}"
|
||||
|
||||
state = release_state(platform_name, record)
|
||||
if state == "none":
|
||||
return link(NO_PACK)
|
||||
if state == "pending":
|
||||
return f"No ZIP yet: {link(NO_PACK.lower())}"
|
||||
return link(label)
|
||||
|
||||
|
||||
def extract_targets(platforms_dir: str) -> list[tuple[str, str]]:
|
||||
"""(display name, folder) per registered platform, where its pack extracts.
|
||||
|
||||
Read from the registry so the README, the site and the pack guide answer
|
||||
from one place. Sorted by display name.
|
||||
"""
|
||||
rows = [
|
||||
(platform_display(key, platforms_dir), entry["extract_to"])
|
||||
for key, entry in load_platform_registry(platforms_dir).items()
|
||||
if entry.get("extract_to")
|
||||
]
|
||||
return sorted(rows, key=lambda row: row[0].casefold())
|
||||
|
||||
|
||||
def own_root(config: dict) -> str:
|
||||
"""The folder a pack written from an empty base_destination starts with.
|
||||
|
||||
RetroDECK writes bios/ in front of its files, the MinUI family hands its
|
||||
cores folders below Bios/.
|
||||
"""
|
||||
root = declared_root(config)
|
||||
if root:
|
||||
return root
|
||||
tops = {directory.split("/", 1)[0] for directory in config.get("core_system_dirs") or {}}
|
||||
return tops.pop() if len(tops) == 1 else "bios"
|
||||
|
||||
|
||||
def extract_notes(platforms_dir: str, released_only: bool = False) -> list[str]:
|
||||
"""A pack whose entries carry their own root extracts above the BIOS folder.
|
||||
|
||||
*released_only* keeps the platforms a release publishes a pack for.
|
||||
"""
|
||||
folders = dict(extract_targets(platforms_dir))
|
||||
registry = load_platform_registry(platforms_dir)
|
||||
notes = []
|
||||
for key in sorted(registry):
|
||||
if released_only and registry[key].get("release_pack") is not True:
|
||||
continue
|
||||
config = load_platform_config(key, platforms_dir)
|
||||
display = display_name(config, key)
|
||||
if config.get("base_destination") == "" and display in folders:
|
||||
notes.append(
|
||||
f"The {display} pack holds its own `{own_root(config)}/` folder."
|
||||
f" Unzip it into `{folders[display]}`."
|
||||
)
|
||||
return notes
|
||||
from sitegen.coverage import platform_coverages
|
||||
from sitegen.extraction import extract_targets
|
||||
from sitegen.releasepacks import download_links, release_totals
|
||||
|
||||
|
||||
def _extract_cells(platforms_dir: str) -> dict[str, str]:
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
"""What the recorded release serves for each platform: pack totals, state and download links."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable
|
||||
|
||||
from model import releaserecord
|
||||
from sitegen.install import has_release_pack
|
||||
|
||||
|
||||
def release_totals(platform_name: str, record: dict) -> tuple[int | None, int | None]:
|
||||
"""Files and bytes of the pack the latest release serves for a platform.
|
||||
|
||||
The Download link gives that release, so these are the figures a reader
|
||||
can check against an extraction. The install manifests describe what
|
||||
main would build today, which is a different pack as soon as a commit
|
||||
lands after the release. Returns (None, None) for a platform the release
|
||||
carries no pack for.
|
||||
"""
|
||||
pack = releaserecord.pack_for(platform_name, record)
|
||||
if not pack:
|
||||
return None, None
|
||||
return pack["files"], pack["extracted_size"]
|
||||
|
||||
|
||||
def release_state(platform_name: str, record: dict) -> str:
|
||||
""""none" for a setup no release publishes a ZIP for (`release_pack`),
|
||||
"pending" for one the recorded release carries no pack for, added since,
|
||||
else "released". No recorded tag, no release to be missing from."""
|
||||
if not has_release_pack(platform_name):
|
||||
return "none"
|
||||
pack = releaserecord.pack_for(platform_name, record)
|
||||
if record.get("tag") and not (pack and pack.get("assets")):
|
||||
return "pending"
|
||||
return "released"
|
||||
|
||||
|
||||
NO_PACK = "Use the command"
|
||||
|
||||
|
||||
def asset_links(
|
||||
platform_name: str, record: dict, repo: str, label: str, attrs: str = "",
|
||||
button: Callable[[str, str], str] | None = None,
|
||||
) -> str:
|
||||
"""Markdown links to the files of a platform's pack in the recorded release.
|
||||
|
||||
Written on the platform's get/ page only: every other surface links that
|
||||
page, whose address does not change with the release. A pack published
|
||||
whole gets one link labelled *label*. A pack in parts gets one link per
|
||||
part, since every part is needed, after the number of files to download:
|
||||
a reader who took one link for the pack extracted half of it. *repo* is
|
||||
the repository URL, *attrs* an attribute list put after each link, or
|
||||
*button* the function that draws each link as a button. Without a
|
||||
recorded release the link is the latest release page.
|
||||
"""
|
||||
pack = releaserecord.pack_for(platform_name, record)
|
||||
tag = record.get("tag")
|
||||
assets = pack.get("assets") if pack else None
|
||||
def link(text: str, url: str) -> str:
|
||||
return button(text, url) if button else f"[{text}]({url}){attrs}"
|
||||
|
||||
if not tag or not assets:
|
||||
return link(label, f"{repo}/releases/latest")
|
||||
urls = [f"{repo}/releases/download/{tag}/{asset}" for asset in assets]
|
||||
if len(urls) == 1:
|
||||
return link(label, urls[0])
|
||||
styled = bool(attrs or button)
|
||||
parts = [
|
||||
link(f"{'P' if styled else 'p'}art {number} of {len(urls)}", url)
|
||||
for number, url in enumerate(urls, 1)
|
||||
]
|
||||
if styled:
|
||||
return f"{len(urls)} files to download, all needed: " + " ".join(parts)
|
||||
return f"{label}, {len(urls)} files, all needed: " + ", ".join(parts)
|
||||
|
||||
|
||||
def download_links(
|
||||
platform_name: str, record: dict, label: str, attrs: str = "",
|
||||
button: Callable[[str, str], str] | None = None,
|
||||
site: str = "", page: str | None = None,
|
||||
) -> str:
|
||||
"""The download cell of a platform: its permanent get/ page.
|
||||
|
||||
*record* is the release record reduced to the release_pack platforms
|
||||
(release_record.advertised). A platform with a pack in it gets *label*
|
||||
linked to its page, which lists the files of the current release. A
|
||||
platform marked release_pack but missing from the release, added since,
|
||||
gets "No ZIP yet". Any other platform is served by the installer, and
|
||||
the cell says so instead of staying empty. *site* is the site root the
|
||||
get/ address hangs from, or *page* the address itself as the site links
|
||||
it, and *attrs* and *button* style the link.
|
||||
"""
|
||||
page = page or releaserecord.get_page(platform_name, site)
|
||||
def link(text: str) -> str:
|
||||
return button(text, page) if button else f"[{text}]({page}){attrs}"
|
||||
|
||||
state = release_state(platform_name, record)
|
||||
if state == "none":
|
||||
return link(NO_PACK)
|
||||
if state == "pending":
|
||||
return f"No ZIP yet: {link(NO_PACK.lower())}"
|
||||
return link(label)
|
||||
@@ -26,7 +26,7 @@ from sitegen.guidepage import NO_ZIP_FAQ, devices_meta, first_screen_words, get_
|
||||
from sitegen.guides import fence, terminal_tabs, trust_box
|
||||
from sitegen.home import group_keys, next_block, runs_on_text, setup_picker
|
||||
from sitegen.install import installer_module, platform_display
|
||||
from sitegen.readme import NO_PACK, download_links, release_state
|
||||
from sitegen.releasepacks import NO_PACK, download_links, release_state
|
||||
|
||||
|
||||
# Build cross-reference indexes
|
||||
|
||||
+6
-2
@@ -72,14 +72,18 @@ COMMANDS = {
|
||||
"sitegen/provenance.py", "sitegen/fields.py", "sitegen/consolecards.py",
|
||||
"sitegen/startwith.py", "sitegen/systempages.py", "sitegen/emulatorcards.py",
|
||||
"sitegen/emulatorpage.py", "sitegen/gaps.py", "sitegen/crossref.py", "sitegen/reference.py",
|
||||
"sitegen/whichpack.py", "sitegen/nav.py", "sitegen/build.py",
|
||||
"sitegen/whichpack.py", "sitegen/nav.py", "sitegen/build.py", "sitegen/coverage.py",
|
||||
"sitegen/extraction.py", "sitegen/releasepacks.py",
|
||||
),
|
||||
"sitediagrams.py": ("sitegen/diagrams.py",),
|
||||
"sitesources.py": ("sitegen/sources.py",),
|
||||
"site_markdown.py": ("sitegen/pagemarkdown.py",),
|
||||
"validate_site.py": ("sitegen/validate.py",),
|
||||
"site_insights.py": ("sitegen/insights.py",),
|
||||
"generate_readme.py": ("sitegen/readme.py",),
|
||||
"generate_readme.py": (
|
||||
"sitegen/readme.py", "sitegen/coverage.py", "sitegen/extraction.py",
|
||||
"sitegen/releasepacks.py",
|
||||
),
|
||||
"indexnow.py": ("sitegen/indexnow.py",),
|
||||
"generate_report_excerpt.py": ("sitegen/reportexcerpt.py",),
|
||||
"romset_recipes.py": (
|
||||
|
||||
@@ -13,6 +13,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
from unittest import mock
|
||||
|
||||
from sitegen import coverage as sitecoverage
|
||||
from sitegen import readme
|
||||
from sitegen import reference
|
||||
|
||||
@@ -47,9 +48,9 @@ class CoverageReadsTheGivenProfiles(unittest.TestCase):
|
||||
return {"status_counts": {}, "severity_counts": {}, "verification_mode": "existence",
|
||||
"total_files": 0, "undeclared_files": [], "details": []}
|
||||
|
||||
with mock.patch.object(readme, "verify_platform", fake_verify), \
|
||||
mock.patch.object(readme, "load_emulator_profiles", return_value={}):
|
||||
readme.compute_coverage(
|
||||
with mock.patch.object(sitecoverage, "verify_platform", fake_verify), \
|
||||
mock.patch.object(sitecoverage, "load_emulator_profiles", return_value={}):
|
||||
sitecoverage.compute_coverage(
|
||||
"retroarch", str(REPO_ROOT / "platforms"), {"files": {}}, emulators_dir="elsewhere"
|
||||
)
|
||||
self.assertEqual(seen, ["elsewhere"])
|
||||
|
||||
@@ -17,7 +17,7 @@ from pathlib import Path
|
||||
from unittest import mock
|
||||
|
||||
from core import cli
|
||||
from sitegen import readme
|
||||
from sitegen import coverage
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
@@ -34,8 +34,8 @@ class CoverageCache(unittest.TestCase):
|
||||
self.db.write_text("{}")
|
||||
self.calls: list[str] = []
|
||||
patches = [
|
||||
mock.patch.object(readme, "COVERAGE_CACHE_DIR", self.work / "cache"),
|
||||
mock.patch.object(readme, "compute_coverage", self._compute),
|
||||
mock.patch.object(coverage, "COVERAGE_CACHE_DIR", self.work / "cache"),
|
||||
mock.patch.object(coverage, "compute_coverage", self._compute),
|
||||
]
|
||||
for patch in patches:
|
||||
patch.start()
|
||||
@@ -53,7 +53,7 @@ class CoverageCache(unittest.TestCase):
|
||||
return {"platform": name.title(), "missing_names": {"a.bin"}}
|
||||
|
||||
def _run(self, names=("beta", "alpha")) -> dict:
|
||||
return readme.platform_coverages(
|
||||
return coverage.platform_coverages(
|
||||
list(names), str(self.platforms), {}, {},
|
||||
emulators_dir=str(self.emulators), db_path=str(self.db),
|
||||
)
|
||||
@@ -122,8 +122,8 @@ class CoverageCache(unittest.TestCase):
|
||||
def missing(*_args, **_kwargs):
|
||||
raise cli.InputMissing("no emulator profile directory at nosuch")
|
||||
|
||||
with mock.patch.object(readme, "compute_coverage", missing), \
|
||||
mock.patch.object(readme, "_coverage_inputs", return_value="other"), \
|
||||
with mock.patch.object(coverage, "compute_coverage", missing), \
|
||||
mock.patch.object(coverage, "_coverage_inputs", return_value="other"), \
|
||||
self.assertRaises(cli.InputMissing):
|
||||
self._run()
|
||||
self.assertEqual(sorted((self.work / "cache").glob("*.pickle")), kept)
|
||||
|
||||
@@ -21,14 +21,8 @@ from pathlib import Path
|
||||
|
||||
from core.sizes import size_text
|
||||
from model import releaserecord
|
||||
from sitegen.readme import (
|
||||
SITE_URL,
|
||||
asset_links,
|
||||
contributing_text,
|
||||
download_links,
|
||||
download_table,
|
||||
release_state,
|
||||
)
|
||||
from sitegen.readme import SITE_URL, contributing_text, download_table
|
||||
from sitegen.releasepacks import asset_links, download_links, release_state
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ from pathlib import Path
|
||||
|
||||
from model.platforms import load_platform_config
|
||||
from model.registry import load_platform_registry
|
||||
from sitegen.readme import extract_notes, extract_targets
|
||||
from sitegen.extraction import extract_notes, extract_targets
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
@@ -421,7 +421,7 @@ class TheSitePageOfACardPlatform(unittest.TestCase):
|
||||
from sitegen import platformpage
|
||||
from model.database import load_database
|
||||
from model.registry import load_platform_registry
|
||||
from sitegen.readme import compute_coverage
|
||||
from sitegen.coverage import compute_coverage
|
||||
|
||||
if not (REPO_ROOT / "database.json").is_file():
|
||||
self.skipTest("database.json absent")
|
||||
|
||||
@@ -37,7 +37,7 @@ from packs import datatrees
|
||||
from packs import manifest as packs_manifest
|
||||
from packs import platformpack
|
||||
from sitegen import readme as sitegen_readme
|
||||
from sitegen import home
|
||||
from sitegen import home, releasepacks
|
||||
import release_notes
|
||||
from release import notes
|
||||
from release import record as release_record
|
||||
@@ -382,18 +382,18 @@ class TheTableDescribesTheRelease(unittest.TestCase):
|
||||
def test_a_platform_reads_the_pack_that_serves_it(self):
|
||||
for platform in ("retroarch", "lakka"):
|
||||
self.assertEqual(
|
||||
sitegen_readme.release_totals(platform, RECORD),
|
||||
releasepacks.release_totals(platform, RECORD),
|
||||
(4525, 5882727352),
|
||||
)
|
||||
self.assertEqual(
|
||||
sitegen_readme.release_totals("misterfpga", RECORD), (74, 17000000)
|
||||
releasepacks.release_totals("misterfpga", RECORD), (74, 17000000)
|
||||
)
|
||||
|
||||
def test_a_platform_the_release_does_not_carry_has_no_figure(self):
|
||||
self.assertEqual(
|
||||
sitegen_readme.release_totals("vita3k", RECORD), (None, None)
|
||||
releasepacks.release_totals("vita3k", RECORD), (None, None)
|
||||
)
|
||||
self.assertEqual(sitegen_readme.release_totals("retroarch", {}), (None, None))
|
||||
self.assertEqual(releasepacks.release_totals("retroarch", {}), (None, None))
|
||||
|
||||
def test_the_download_table_gives_the_file_count_of_each_pack(self):
|
||||
rows = sitegen_readme.download_table(
|
||||
@@ -412,7 +412,7 @@ class TheTableDescribesTheRelease(unittest.TestCase):
|
||||
self.skipTest("no release.json")
|
||||
record = json.loads(record_path.read_text(encoding="utf-8"))
|
||||
readme = (REPO_ROOT / "README.md").read_text(encoding="utf-8")
|
||||
files, _size = sitegen_readme.release_totals("retroarch", record)
|
||||
files, _size = releasepacks.release_totals("retroarch", record)
|
||||
self.assertTrue(f"| RetroArch | {files:,} |" in readme)
|
||||
|
||||
|
||||
@@ -549,7 +549,7 @@ class RefusedFilesAreNotPresent(unittest.TestCase):
|
||||
|
||||
from model.platforms import _platform_config_cache
|
||||
from collection.indexes import build_indexes
|
||||
from sitegen import readme as sitegen_readme
|
||||
from sitegen.coverage import compute_coverage
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
previous = os.getcwd()
|
||||
@@ -582,7 +582,7 @@ class RefusedFilesAreNotPresent(unittest.TestCase):
|
||||
)
|
||||
_platform_config_cache.clear()
|
||||
self.addCleanup(_platform_config_cache.clear)
|
||||
coverage = sitegen_readme.compute_coverage(
|
||||
coverage = compute_coverage(
|
||||
"hashy", "platforms", db, emulators_dir="emulators"
|
||||
)
|
||||
self.assertEqual((coverage["present"], coverage["total"]), (1, 2))
|
||||
|
||||
@@ -190,7 +190,7 @@ class NothingIsLost(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None:
|
||||
from model.database import load_database
|
||||
from sitegen.readme import compute_coverage
|
||||
from sitegen.coverage import compute_coverage
|
||||
|
||||
db = load_database(str(REPO_ROOT / "database.json"))
|
||||
cls.pages = {}
|
||||
|
||||
@@ -97,9 +97,9 @@ class SlugPlatform(unittest.TestCase):
|
||||
def test_the_readme_fraction_does_not_count_it(self):
|
||||
# The README's second column is what the pack has: a held file the
|
||||
# platform has no folder for was counted there.
|
||||
from sitegen import readme
|
||||
from sitegen.coverage import compute_coverage
|
||||
|
||||
coverage = readme.compute_coverage(
|
||||
coverage = compute_coverage(
|
||||
"slugs", "platforms", self.db, emulators_dir="emulators"
|
||||
)
|
||||
self.assertEqual(coverage["core_present"], 0)
|
||||
|
||||
Reference in new issue
Block a user