mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-06 01:53:56 -06:00
feat: link the change reports and the wanted CSV
This commit is contained in:
1 parent
ef477036d6
commit
398246b064
4 files changed
+36
-2
No files matched your search
@@ -1847,6 +1847,15 @@ def _publish_manifests(api: Path) -> list[tuple]:
|
||||
_record(targets / source.name)
|
||||
assets.append((targets / source.name, f"Target list: {source.stem}",
|
||||
"application/json", "schemas/target-manifest.schema.json"))
|
||||
# Every change each updated platform file carries, for a maintainer who
|
||||
# reviews them by script: the Exports page linked only the files.
|
||||
exports = api / "exports"
|
||||
exports.mkdir(parents=True, exist_ok=True)
|
||||
for source in sorted((_REPO_ROOT / "exports").glob("*.json")):
|
||||
shutil.copy2(source, exports / source.name)
|
||||
_record(exports / source.name)
|
||||
assets.append((exports / source.name, f"Updated platform file, its changes: {source.stem}",
|
||||
"application/json", None))
|
||||
release = _REPO_ROOT / "release.json"
|
||||
if release.is_file():
|
||||
shutil.copy2(release, api / "release.json")
|
||||
@@ -5344,6 +5353,8 @@ def generate_provenance_page(
|
||||
"matching one of these hashes is welcome: see "
|
||||
"[Contributing](contributing.md).",
|
||||
"",
|
||||
markup.button("Download the list (CSV)", "downloads/provenance-wanted.csv"),
|
||||
"",
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ EXPORTS_DIR = "exports"
|
||||
REPO_BLOB = "https://github.com/Abdess/retrobios/blob/main"
|
||||
REPO_TREE = "https://github.com/Abdess/retrobios/tree/main"
|
||||
REPO_RAW = "https://raw.githubusercontent.com/Abdess/retrobios/main"
|
||||
# Where the site publishes each report, beside the API (generate_site).
|
||||
API_EXPORTS = "api/v1/exports"
|
||||
|
||||
# Report key, then how a line of it reads on the page.
|
||||
CHANGE_KINDS = (
|
||||
@@ -318,16 +320,20 @@ def generate_exports_page(reports: list[dict], names: dict[str, str]) -> str:
|
||||
originals = report.get("originals") or {}
|
||||
files = report["files"]
|
||||
raw = [f"{REPO_RAW}/{EXPORTS_DIR}/{platform}/{name}" for name in files]
|
||||
# Every change as JSON, the report the page is written from.
|
||||
changes = markup.button("Every change (JSON)", f"{API_EXPORTS}/{platform}.json")
|
||||
if len(files) == 1:
|
||||
lines.extend([
|
||||
markup.button("Download the updated file", raw[0], primary=True) + " "
|
||||
+ markup.button("See it on GitHub", f"{REPO_BLOB}/{EXPORTS_DIR}/{platform}/{files[0]}"),
|
||||
+ markup.button("See it on GitHub", f"{REPO_BLOB}/{EXPORTS_DIR}/{platform}/{files[0]}")
|
||||
+ " " + changes,
|
||||
"",
|
||||
])
|
||||
else:
|
||||
lines.extend([
|
||||
markup.button(f"Browse the {len(files)} updated files",
|
||||
f"{REPO_TREE}/{EXPORTS_DIR}/{platform}", primary=True),
|
||||
f"{REPO_TREE}/{EXPORTS_DIR}/{platform}", primary=True)
|
||||
+ " " + changes,
|
||||
"",
|
||||
])
|
||||
if len(originals) > 1:
|
||||
|
||||
@@ -89,6 +89,17 @@ class CorrectedFilesPage(unittest.TestCase):
|
||||
self.page,
|
||||
)
|
||||
|
||||
def test_every_section_links_its_changes_as_json(self):
|
||||
"""exports/batocera.json listed 141 changes and no page or catalog
|
||||
entry named it: a maintainer had to scrape the HTML."""
|
||||
for platform in ("recalbox", "retropie"):
|
||||
self.assertIn(f'href="api/v1/exports/{platform}.json"', self.page)
|
||||
source = (ROOT / "scripts" / "generate_site.py").read_text(encoding="utf-8")
|
||||
publish = source[source.index("def _publish_manifests("):]
|
||||
publish = publish[:publish.index("\ndef ")]
|
||||
self.assertIn('(_REPO_ROOT / "exports").glob("*.json")', publish)
|
||||
self.assertIn('exports = api / "exports"', publish)
|
||||
|
||||
def test_several_files_link_to_their_directory(self):
|
||||
self.assertIn("tree/main/exports/retropie", self.page)
|
||||
self.assertIn("<summary>The 2 original files it is based on</summary>", self.page)
|
||||
|
||||
@@ -470,6 +470,12 @@ class TestProvenancePage(unittest.TestCase):
|
||||
self.assertIn("14df4f6c1e367ce097c11deae21566b4fe5647a9", page)
|
||||
self.assertIn("### Redump", page)
|
||||
|
||||
def test_the_wanted_list_links_its_csv(self):
|
||||
"""provenance-wanted.csv was linked from the data page alone."""
|
||||
page = self._page()
|
||||
wanted = page[page.index("## Wanted: catalogued dumps"):]
|
||||
self.assertIn('href="downloads/provenance-wanted.csv"', wanted[:wanted.index("###")])
|
||||
|
||||
def test_page_has_anchor_targets_for_badges(self):
|
||||
"""System-page badges link to ../provenance.md#<source>."""
|
||||
page = self._page()
|
||||
|
||||
Reference in new issue
Block a user