From 78e2b85c1b215f85c2ca7a1d6e4fc29c5f2b2b46 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Fri, 6 Nov 2026 04:05:20 +0100 Subject: [PATCH] refactor: pick the install box setup from guides The default setup named RetroArch in page code, which a test forbids. It is now the setup whose guide runs under the most of the box's OS tabs, then on the most systems, then one with a release ZIP. --- scripts/generate_site.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/generate_site.py b/scripts/generate_site.py index 7a1787e76..1cfdfa100 100644 --- a/scripts/generate_site.py +++ b/scripts/generate_site.py @@ -9118,15 +9118,15 @@ def _default_setup(declared: list[tuple[str, str]]) -> tuple[str, str]: """The setup an install box shows before the reader picks one. The first in alphabetical order was AmberELEC on 17 system pages, a - handheld system under a Windows tab. RetroArch runs on every OS the box - has a tab for. Without it, a setup the release publishes a ZIP for, - the ones most people download (`release_pack`). + handheld system under a Windows tab. The box shows the setup whose + command runs under the most of its tabs (the guide's `run`), then on the + most systems overall, then one the release publishes a ZIP for. """ - for wanted in (lambda p: p == "retroarch", has_release_pack): - chosen = next((pair for pair in declared if wanted(pair[0])), None) - if chosen: - return chosen - return declared[0] + def reach(pair: tuple[str, str]) -> tuple[int, int, bool]: + runs = GUIDES[pair[0]].run if pair[0] in GUIDES else () + return (len(set(runs) & set(INSTALL_PICKER_OSES)), len(runs), has_release_pack(pair[0])) + + return max(declared, key=reach) def _install_picker(declared: list[tuple[str, str]]) -> list[str]: