diff --git a/install.ps1 b/install.ps1 index 8321df15e..3c579f68a 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 = "f85ee09109492b6586240c75acd179916f570a663bf02ff8b303c019f88d1050" + $defaultInstallSha256 = "08be74d479990f072bd16033f258108a583b34baddfd75d9d9be11f23ae77dac" $maximumInstallerBytes = 2MB $installerExit = 0 $installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null } diff --git a/install.py b/install.py index 11db59f4a..a3a6e48aa 100644 --- a/install.py +++ b/install.py @@ -3098,8 +3098,21 @@ def normalize_platform(name: str, say: bool = True) -> str: print(f" {rule.name} gets the {display_name(rule.manifest)} file list: " f"--platform {rule.manifest}.") return rule.manifest + # --list-platforms prints TrimUI with why it gets no folder, and naming + # it answered "Unknown platform". + for rule in _EMBEDDED_RULES: + if key and not rule.manifest and key == _name_key(rule.name): + refuse_name(name.strip(), f"{rule.name} is not installed to: " + f"{_NO_FOLDER.get(rule.name, 'no source names its BIOS folder')}.", + " Name that folder: --platform retroarch " + "--dest FOLDER") + # Every name --list-platforms prints, so that spruce suggests spruceOS + # and the count is the one the listing shows. + known = list(AVAILABLE_PLATFORMS) + list(dict.fromkeys( + rule.name for rule in _EMBEDDED_RULES + if _name_key(rule.name) not in {_name_key(plat) for plat in AVAILABLE_PLATFORMS})) refuse_name(name.strip(), f"Unknown platform '{name.strip()}'. " - + did_you_mean([name], list(AVAILABLE_PLATFORMS), "--list-platforms")) + + did_you_mean([name], known, "--list-platforms")) def _read_limited_json( diff --git a/install.sh b/install.sh index 251c35caa..1641ace5d 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="f85ee09109492b6586240c75acd179916f570a663bf02ff8b303c019f88d1050" +DEFAULT_INSTALL_SHA256="08be74d479990f072bd16033f258108a583b34baddfd75d9d9be11f23ae77dac" MAX_INSTALLER_BYTES=2097152 cleanup() { diff --git a/install/launchers/index.json b/install/launchers/index.json index 6e01ea755..39e53cb3d 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": 1082390, - "sha256": "f85ee09109492b6586240c75acd179916f570a663bf02ff8b303c019f88d1050", + "size": 1083185, + "sha256": "08be74d479990f072bd16033f258108a583b34baddfd75d9d9be11f23ae77dac", "executable": false }, { @@ -71,8 +71,8 @@ "muos": { "archive": { "dest": "ARCHIVE/RetroBIOS.muxapp", - "size": 1136017, - "sha256": "9c0587fc18a1402e6f86eeaa8abf7bc26f52bf201e362575adc8e417c983b7de" + "size": 1136812, + "sha256": "070626dc9a11addef163495858e5e1ad6808e46522c9570fc4aa2909398b650d" }, "members": [ { @@ -92,8 +92,8 @@ { "name": "RetroBIOS/install.py", "repo_path": "install.py", - "size": 1082390, - "sha256": "f85ee09109492b6586240c75acd179916f570a663bf02ff8b303c019f88d1050", + "size": 1083185, + "sha256": "08be74d479990f072bd16033f258108a583b34baddfd75d9d9be11f23ae77dac", "executable": false }, { @@ -166,8 +166,8 @@ { "dest": ".config/modules/retrobios/install.py", "repo_path": "install.py", - "size": 1082390, - "sha256": "f85ee09109492b6586240c75acd179916f570a663bf02ff8b303c019f88d1050", + "size": 1083185, + "sha256": "08be74d479990f072bd16033f258108a583b34baddfd75d9d9be11f23ae77dac", "executable": false }, { diff --git a/tests/test_install.py b/tests/test_install.py index a711787cd..08283b0ee 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -4012,8 +4012,25 @@ class ATypoGetsTheClosestName(unittest.TestCase): self.assertIn(f"--platform {plat}", out.getvalue()) def test_a_system_that_gets_no_list_is_still_refused(self): - with contextlib.redirect_stderr(io.StringIO()), self.assertRaises(SystemExit): + """TrimUI, which --list-platforms prints, was answered "Unknown + platform" with no way forward.""" + err = io.StringIO() + with contextlib.redirect_stderr(err), self.assertRaises(SystemExit): install.normalize_platform("TrimUI") + self.assertNotIn("Unknown platform", err.getvalue()) + self.assertIn("--platform retroarch --dest FOLDER", err.getvalue()) + + def test_a_system_name_is_suggested(self): + err = io.StringIO() + with contextlib.redirect_stderr(err), self.assertRaises(SystemExit): + install.normalize_platform("spruce") + self.assertIn("Did you mean: spruceOS?", err.getvalue()) + # The distinct names --list-platforms prints: Batocera is both a + # platform and a system it recognises. + names = [*install.AVAILABLE_PLATFORMS, + *(line.split(":")[0] for line in install._system_lines())] + listed = len({install._name_key(name) for name in names}) + self.assertIn(f"lists all {listed}.", err.getvalue()) def test_a_platform_typo_is_answered_with_one_name(self): err = io.StringIO()