fix: say a platform has no hardware targets

This commit is contained in:
Abdessamad Derraz committed 2026-11-05 11:54:53 +01:00
1 parent bcedd22a9e
commit 896dbc8660
5 files changed
+30 -17

No files matched your search

+1 -1
View File
@@ -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 }
+7 -6
View File
@@ -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:
+1 -1
View File
@@ -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() {
+8 -8
View File
@@ -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
},
{
+13 -1
View File
@@ -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."""