mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-12-02 14:28:54 -06:00
fix: read the release record through siteinputs
This commit is contained in:
1 parent
1988551739
commit
3abe6862e2
6 files changed
+28
-12
No files matched your search
@@ -12,6 +12,7 @@ from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
from core.paths import REPO_ROOT
|
||||
from model import releaserecord
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -54,3 +55,18 @@ def manifests_dir() -> Path:
|
||||
"""The install manifests built from the collection the inputs name."""
|
||||
inputs = current()
|
||||
return inputs.manifests or inputs.db.parent / "install"
|
||||
|
||||
|
||||
def release_record_path() -> Path:
|
||||
"""release.json, beside the database the inputs name."""
|
||||
return current().db.parent / releaserecord.RECORD
|
||||
|
||||
|
||||
def advertised() -> dict:
|
||||
"""The release record reduced to the release_pack platforms of the inputs' registry.
|
||||
|
||||
The tiles read the registry from --platforms-dir while the ZIP column
|
||||
read ./platforms and ./release.json: a run from another folder gave
|
||||
every setup "No ZIP", and a run on another collection mixed two registries.
|
||||
"""
|
||||
return releaserecord.load_advertised(release_record_path(), str(current().platforms))
|
||||
@@ -88,7 +88,7 @@ def get_page_data(platform_name: str) -> dict:
|
||||
"""The structured data of get/<platform>/: the page changes with the
|
||||
release it lists, so its tag is its date, the one the sitemap gives
|
||||
(vYYYY.MM.DD). Empty when no release publishes the platform's pack."""
|
||||
record = releaserecord.load_advertised()
|
||||
record = siteinputs.advertised()
|
||||
tag_date = re.fullmatch(r"v(\d{4})\.(\d{2})\.(\d{2})", str(record.get("tag", "")))
|
||||
if has_release_pack(platform_name) and releaserecord.pack_for(platform_name, record) and tag_date:
|
||||
return {"dateModified": "-".join(tag_date.groups())}
|
||||
@@ -105,7 +105,7 @@ def generate_get_page(platform_name: str) -> str:
|
||||
never touches it: committing release.json rebuilds it."""
|
||||
config = load_platform_config(platform_name, str(siteinputs.current().platforms))
|
||||
display = display_name(config, platform_name)
|
||||
record = releaserecord.load_advertised()
|
||||
record = siteinputs.advertised()
|
||||
pack = releaserecord.pack_for(platform_name, record)
|
||||
released = has_release_pack(platform_name)
|
||||
title = get_page_title(platform_name, display)
|
||||
|
||||
@@ -84,7 +84,7 @@ def pack_buttons(platform_name: str, label: str = "Pack", prefix: str = "../",
|
||||
if not has_release_pack(platform_name):
|
||||
display = display or platform_display(platform_name)
|
||||
return f"{no_zip_line(display)} [Why no ZIP?]({prefix}{NO_ZIP_FAQ})"
|
||||
record = releaserecord.load_advertised()
|
||||
record = siteinputs.advertised()
|
||||
buttons = download_links(
|
||||
platform_name,
|
||||
record,
|
||||
@@ -203,7 +203,7 @@ def _share_tabs(name: str, share: str) -> tuple[dict[str, str], dict[str, str]]:
|
||||
def _offline_line(name: str) -> list[str]:
|
||||
"""The offline line, on a setup whose ZIP a release publishes: the
|
||||
installer reads that ZIP with no network (`--from-pack`)."""
|
||||
pack = releaserecord.pack_for(name, releaserecord.load_advertised())
|
||||
pack = releaserecord.pack_for(name, siteinputs.advertised())
|
||||
return [OFFLINE_LINE, ""] if pack and pack.get("assets") else []
|
||||
|
||||
|
||||
@@ -290,7 +290,7 @@ def _computer_first(name: str, guide: Guide) -> bool:
|
||||
"""A system that runs only on its own device, with a ZIP to download: a
|
||||
beginner fills its folder from a computer more easily than from a
|
||||
terminal on the TV. Without a ZIP the command is the only route."""
|
||||
pack = releaserecord.pack_for(name, releaserecord.load_advertised())
|
||||
pack = releaserecord.pack_for(name, siteinputs.advertised())
|
||||
return guide.run == ("device",) and bool(pack and pack.get("assets"))
|
||||
|
||||
|
||||
@@ -308,7 +308,7 @@ def _guide_download(name: str, display: str, guide: Guide, extract_to: str | Non
|
||||
heading: str) -> list[str]:
|
||||
"""The pack: its buttons, its size, and where it is unzipped."""
|
||||
lines = [heading, ""]
|
||||
record = releaserecord.load_advertised()
|
||||
record = siteinputs.advertised()
|
||||
pack = releaserecord.pack_for(name, record)
|
||||
network = any(label.startswith("From ") for label, _path in guide.folders)
|
||||
if pack and pack.get("assets"):
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from model import releaserecord
|
||||
from model import siteinputs
|
||||
from sitegen.guidedata import device_groups, group_tiles, platform_guides
|
||||
from resolve.nativemode import check_label
|
||||
from sitegen import markup
|
||||
@@ -63,9 +63,9 @@ def setup_table(coverages: dict) -> list[str]:
|
||||
"| Setup | Files on its own list | Files in the ZIP | How it checks |",
|
||||
"|-------|------:|------:|---------------|",
|
||||
]
|
||||
record = siteinputs.advertised()
|
||||
for name, cov in sorted(coverages.items(), key=lambda item: item[1]["platform"].casefold()):
|
||||
listed = f"{cov['total']:,}" if cov["total"] else "No list of its own"
|
||||
record = releaserecord.load_advertised()
|
||||
state = release_state(name, record)
|
||||
files, _size = release_totals(name, record)
|
||||
zipped = ("No ZIP" if state == "none" else "No ZIP yet" if state == "pending"
|
||||
|
||||
@@ -6,7 +6,7 @@ import json
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
from model import releaserecord, siteinputs
|
||||
from model import siteinputs
|
||||
from core.paths import REPO_ROOT
|
||||
from sitegen.write import record_written, write_if_changed
|
||||
|
||||
@@ -21,7 +21,7 @@ def write_release_advertised(generated: Path) -> None:
|
||||
generated.mkdir(parents=True, exist_ok=True)
|
||||
write_if_changed(
|
||||
str(generated / "release-advertised.json"),
|
||||
json.dumps(releaserecord.load_advertised(), ensure_ascii=False, indent=1,
|
||||
json.dumps(siteinputs.advertised(), ensure_ascii=False, indent=1,
|
||||
sort_keys=True) + "\n",
|
||||
)
|
||||
|
||||
@@ -65,7 +65,7 @@ def publish_manifests(api: Path) -> list[tuple]:
|
||||
record_written(exports / source.name)
|
||||
assets.append((exports / source.name, f"Updated platform file, its changes: {source.stem}",
|
||||
"application/json", None))
|
||||
release = REPO_ROOT / "release.json"
|
||||
release = siteinputs.release_record_path()
|
||||
if release.is_file():
|
||||
shutil.copy2(release, api / "release.json")
|
||||
record_written(api / "release.json")
|
||||
|
||||
@@ -188,7 +188,7 @@ def generate_which_pack() -> str:
|
||||
The tiles are the choice. Open tables under them listed every setup a
|
||||
second time and made the page 11,800 px tall on a phone."""
|
||||
registry = load_platform_registry(str(siteinputs.current().platforms))
|
||||
record = releaserecord.load_advertised()
|
||||
record = siteinputs.advertised()
|
||||
display = {key: platform_display(key) for key in registry}
|
||||
all_tabs = ("windows", "macos", "linux", "steamdeck", "android")
|
||||
# The quick install box also runs on a game system: its tab shows the
|
||||
|
||||
Reference in new issue
Block a user