mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-23 18:17:53 -06:00
fix: read site manifests and zips from the inputs
This commit is contained in:
1 parent
8603885fda
commit
0d44254504
6 files changed
+64
-8
No files matched your search
@@ -19,6 +19,8 @@ class SiteInputs:
|
||||
db: Path = REPO_ROOT / "database.json"
|
||||
emulators: Path = REPO_ROOT / "emulators"
|
||||
platforms: Path = REPO_ROOT / "platforms"
|
||||
# The install manifests; None places them beside the database.
|
||||
manifests: Path | None = None
|
||||
|
||||
|
||||
_current = [SiteInputs()]
|
||||
@@ -41,3 +43,14 @@ def bios_dir(db: dict) -> Path:
|
||||
"""
|
||||
named = Path(str(db.get("bios_dir") or "bios"))
|
||||
return named if named.is_absolute() else current().db.parent / named
|
||||
|
||||
|
||||
def collection_path(rel: str) -> Path:
|
||||
"""A path database.json names, under the database's own folder."""
|
||||
return current().db.parent / rel
|
||||
|
||||
|
||||
def manifests_dir() -> Path:
|
||||
"""The install manifests built from the collection the inputs name."""
|
||||
inputs = current()
|
||||
return inputs.manifests or inputs.db.parent / "install"
|
||||
@@ -15,7 +15,6 @@ from model.profiles import is_emulator, upstream_profile_index
|
||||
from model.systemnames import system_name
|
||||
from sitegen import entries as siteentries, markup
|
||||
from sitegen.config import REPO_URL, date_line
|
||||
from core.paths import REPO_ROOT
|
||||
from core.sizes import size_text
|
||||
from sitegen.fields import hash_spans, search_excluded
|
||||
from sitegen.parts import (
|
||||
@@ -478,7 +477,7 @@ def platform_data_links(name: str) -> str:
|
||||
f"[YAML]({REPO_URL}/blob/main/platforms/{name}.yml)",
|
||||
f"[JSON](../api/v1/platforms/{name}.json)",
|
||||
]
|
||||
if (REPO_ROOT / "install" / f"{name}.json").is_file():
|
||||
if (siteinputs.manifests_dir() / f"{name}.json").is_file():
|
||||
# The site's own copy, byte for byte (publish_manifests).
|
||||
links.append(f"[install manifest](../api/v1/manifests/{name}.json)")
|
||||
# The installed BIOS folder for clrmamepro and RomVault.
|
||||
@@ -622,7 +621,7 @@ def core_folders_section(name: str, config: dict) -> list[str]:
|
||||
folders come from its launch scripts, the files from its install manifest.
|
||||
"""
|
||||
folders = config.get("core_system_dirs") or {}
|
||||
manifest = REPO_ROOT / "install" / f"{name}.json"
|
||||
manifest = siteinputs.manifests_dir() / f"{name}.json"
|
||||
files = json.loads(manifest.read_text())["files"] if manifest.is_file() else []
|
||||
lines = [
|
||||
"### Core folders",
|
||||
|
||||
@@ -456,7 +456,7 @@ def _entry_archives(entry: dict, files: dict, by_name: dict) -> set[str]:
|
||||
if sha1 not in files:
|
||||
continue
|
||||
if crcs:
|
||||
held = zip_member_crcs(str(REPO_ROOT / files[sha1]["path"]))
|
||||
held = zip_member_crcs(str(siteinputs.collection_path(files[sha1]["path"])))
|
||||
# An archive the build cannot read keeps its name.
|
||||
if held and not held & crcs:
|
||||
continue
|
||||
|
||||
@@ -7,12 +7,12 @@ import re
|
||||
import urllib.parse
|
||||
from pathlib import Path
|
||||
|
||||
from model import siteinputs
|
||||
from model.collection import collection_paths
|
||||
from model.systemnames import system_name
|
||||
from sitegen import starlight as sitestarlight
|
||||
from sitegen.cards import emulator_file_anchors
|
||||
from sitegen.config import REPO_URL, SITE_NAME, SITE_URL
|
||||
from core.paths import REPO_ROOT
|
||||
from sitegen.descriptions import EMULATOR_SNIPPETS, NOTHING_TO_FETCH, PAGE_DATA, TITLE_NOUNS, title_noun
|
||||
from sitegen.emulatorcards import snippet_noun
|
||||
from sitegen.install import comes_with_app
|
||||
@@ -56,7 +56,7 @@ def write_platform_dats(folder: Path, db: dict, members: dict, generated_at: str
|
||||
folder.mkdir(parents=True, exist_ok=True)
|
||||
digests = data_member_digests(members)
|
||||
written = []
|
||||
for source in sorted((REPO_ROOT / "install").glob("*.json")):
|
||||
for source in sorted(siteinputs.manifests_dir().glob("*.json")):
|
||||
manifest = json.loads(source.read_text(encoding="utf-8"))
|
||||
path = folder / f"{source.stem}.dat"
|
||||
write_if_changed(str(path), platform_dat(manifest, db, digests, generated_at))
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from model import releaserecord
|
||||
from core.paths import REPO_ROOT
|
||||
from core.sizes import size_text
|
||||
from core.ziptools import build_zip_contents_index
|
||||
from model import siteinputs
|
||||
@@ -37,7 +36,7 @@ def build_file_consumers(db: dict, coverages: dict, profiles: dict) -> FileConsu
|
||||
consumers = FileConsumers(db, build_zip_contents_index(db))
|
||||
consumers.add_platforms({name: cov["config"] for name, cov in coverages.items()})
|
||||
consumers.add_emulators(profiles)
|
||||
consumers.add_manifests(REPO_ROOT / "install")
|
||||
consumers.add_manifests(siteinputs.manifests_dir())
|
||||
return consumers
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user