From 896dbc866061befa5b1f1bc6b09637073955d842 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Thu, 5 Nov 2026 11:54:53 +0100 Subject: [PATCH] fix: say a platform has no hardware targets --- install.ps1 | 2 +- install.py | 13 +++++++------ install.sh | 2 +- install/launchers/index.json | 16 ++++++++-------- tests/test_install_cores.py | 14 +++++++++++++- 5 files changed, 30 insertions(+), 17 deletions(-) diff --git a/install.ps1 b/install.ps1 index f44c7a75c..d41b5047b 100644 --- a/install.ps1 +++ b/install.ps1 @@ -16,7 +16,7 @@ # and Invoke-WebRequest throws on a cut transfer before the hash is read: # the site's build rewrites this line there (scripts/sitebootstrap.py). $mismatchAdvice = "The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that." - $defaultInstallSha256 = "40647ef424033dd7bb5707f3a7c217ad0c746cad4f37f1029670045d34dac0b6" + $defaultInstallSha256 = "97857d0ba16eaa8be16a4c8832bf04b6ee6da1bcdbc0d747d1934cc3eb5ff909" $maximumInstallerBytes = 2MB $installerExit = 0 $installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null } diff --git a/install.py b/install.py index 4fa6d0d7a..ee9ba411e 100644 --- a/install.py +++ b/install.py @@ -14388,12 +14388,13 @@ def _several_found(platforms: list[tuple[str, Path]], setups: list) -> None: def _unknown_target(target: str, plat: str, targets: dict) -> None: - print(f"Error: unknown target '{target}' for {plat}.", file=sys.stderr) - if targets: - print(" " + did_you_mean([target], sorted(targets), "--list-targets"), - file=sys.stderr) - else: - print(f" {plat} publishes no target list", file=sys.stderr) + if not targets: + # No value can work: "unknown target" read as a typo of the board. + print(f"Error: {display_name(plat)} has no hardware targets: run again " + "without --target.", file=sys.stderr) + return + print(f"Error: unknown target '{target}' for {display_name(plat)}.", file=sys.stderr) + print(" " + did_you_mean([target], sorted(targets), "--list-targets"), file=sys.stderr) def _is_terminal(stream: TextIO) -> bool: diff --git a/install.sh b/install.sh index 9594bc91d..6de052330 100755 --- a/install.sh +++ b/install.sh @@ -23,7 +23,7 @@ DEFAULT_INSTALL_URL="https://raw.githubusercontent.com/Abdess/retrobios/main/ins # curl or wget stop on a cut transfer before the hash is read: the site's # build rewrites this line there (scripts/sitebootstrap.py). MISMATCH_ADVICE="The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that." -DEFAULT_INSTALL_SHA256="40647ef424033dd7bb5707f3a7c217ad0c746cad4f37f1029670045d34dac0b6" +DEFAULT_INSTALL_SHA256="97857d0ba16eaa8be16a4c8832bf04b6ee6da1bcdbc0d747d1934cc3eb5ff909" MAX_INSTALLER_BYTES=2097152 cleanup() { diff --git a/install/launchers/index.json b/install/launchers/index.json index dc01820d9..9001e7fae 100644 --- a/install/launchers/index.json +++ b/install/launchers/index.json @@ -27,8 +27,8 @@ { "dest": "roms/ports/retrobios/install.py", "repo_path": "install.py", - "size": 1080968, - "sha256": "40647ef424033dd7bb5707f3a7c217ad0c746cad4f37f1029670045d34dac0b6", + "size": 1081112, + "sha256": "97857d0ba16eaa8be16a4c8832bf04b6ee6da1bcdbc0d747d1934cc3eb5ff909", "executable": false }, { @@ -71,8 +71,8 @@ "muos": { "archive": { "dest": "ARCHIVE/RetroBIOS.muxapp", - "size": 1134595, - "sha256": "72ef1c1054aaff03491127694455e27d25edcc5565ace9e490bb5623c2a62840" + "size": 1134739, + "sha256": "c0bdf23698273f62236ff5928d035086625532995322b453107cc1b81c365972" }, "members": [ { @@ -92,8 +92,8 @@ { "name": "RetroBIOS/install.py", "repo_path": "install.py", - "size": 1080968, - "sha256": "40647ef424033dd7bb5707f3a7c217ad0c746cad4f37f1029670045d34dac0b6", + "size": 1081112, + "sha256": "97857d0ba16eaa8be16a4c8832bf04b6ee6da1bcdbc0d747d1934cc3eb5ff909", "executable": false }, { @@ -166,8 +166,8 @@ { "dest": ".config/modules/retrobios/install.py", "repo_path": "install.py", - "size": 1080968, - "sha256": "40647ef424033dd7bb5707f3a7c217ad0c746cad4f37f1029670045d34dac0b6", + "size": 1081112, + "sha256": "97857d0ba16eaa8be16a4c8832bf04b6ee6da1bcdbc0d747d1934cc3eb5ff909", "executable": false }, { diff --git a/tests/test_install_cores.py b/tests/test_install_cores.py index beb738b11..26a71a6cb 100644 --- a/tests/test_install_cores.py +++ b/tests/test_install_cores.py @@ -416,11 +416,23 @@ class AnUnknownTargetStopsTheRunFirst(unittest.TestCase): with self.assertRaises(SystemExit) as stop: install.main() self.assertEqual(stop.exception.code, 1) - self.assertIn("unknown target 'steamos' for retroarch", err.getvalue()) + self.assertIn("unknown target 'steamos' for RetroArch", err.getvalue()) self.assertIn("Nothing was installed", err.getvalue()) fetch.assert_not_called() +class APlatformWithoutTargetsSaysSo(unittest.TestCase): + """`--target switch` on MiSTer FPGA read "unknown target", a typo to the + user, when no value can work there.""" + + def test_the_way_forward_is_named(self): + with contextlib.redirect_stderr(io.StringIO()) as err: + install._unknown_target("switch", "misterfpga", {}) + said = err.getvalue() + self.assertIn("MiSTer FPGA has no hardware targets: run again without --target.", said) + self.assertNotIn("unknown target", said) + + class _CoreRepository(FakeRepository): """The fake repository with the two maps and a portable RetroArch."""