diff --git a/install.ps1 b/install.ps1 index a8f7e43f..54cf7ab8 100644 --- a/install.ps1 +++ b/install.ps1 @@ -11,7 +11,7 @@ $ErrorActionPreference = "Stop" $defaultInstallUrl = "https://raw.githubusercontent.com/Abdess/retrobios/main/install.py" - $defaultInstallSha256 = "c462ff5c1c755b269b680f6e1c4c22ef58b7ae9b92679444634c35d248cc4267" + $defaultInstallSha256 = "108b168f54fdc795322152b655fcca3793968cc8e4629287e64f2bd51fa13aa7" $maximumInstallerBytes = 2MB $installerExit = 0 $installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null } diff --git a/install.py b/install.py index 11053847..934c7b2e 100644 --- a/install.py +++ b/install.py @@ -3968,7 +3968,7 @@ def _default_dest(os_type: str, platform_name: str) -> Path | None: return DEFAULT_DESTS.get(platform_name) -def _manual_usage_hint(os_type: str) -> list[str]: +def _manual_usage_hint(os_type: str, listing: str = "") -> list[str]: """How to name the platform and directory when nothing is detected. In the form the run was started with: a one-liner user has no @@ -3980,6 +3980,15 @@ def _manual_usage_hint(os_type: str) -> list[str]: }.get(os_type, "~/.config/retroarch/system") hint = Invocation() hint.os_type, hint.options = os_type, _INVOCATION.options + if listing: + # A listing reads a platform's list and writes nothing: --dest is + # not needed, and a rebuilt install command dropped the listing + # and started a 6.5 GB download. + return [ + " Name the platform whose list to print, for example:", + f" {hint.command('retroarch', None)} {listing}", + f" The platforms: {hint.launcher()} --list-platforms", + ] return [ " Use --platform and --dest to specify manually, for example:", f" {hint.command('retroarch', example)}", @@ -4743,7 +4752,12 @@ def _install(args: argparse.Namespace, real_stdout: TextIO) -> None: if not platforms: print(" No supported platform detected.") if not interactive or listing: - for line in _manual_usage_hint(os_type): + asked = next((flag for flag, on in ( + ("--list-systems", args.list_systems), ("--list-cores", args.list_cores), + ("--list-emulators", args.list_emulators), + ("--list-targets", args.list_targets), + ) if on), "") + for line in _manual_usage_hint(os_type, asked): print(line) sys.exit(1) platforms = _prompt_manual_platform(os_type) diff --git a/install.sh b/install.sh index 1b2e1670..b3dbfdba 100755 --- a/install.sh +++ b/install.sh @@ -18,7 +18,7 @@ esac TEMP_INSTALLER="" TEMP_DIRECTORY="" DEFAULT_INSTALL_URL="https://raw.githubusercontent.com/Abdess/retrobios/main/install.py" -DEFAULT_INSTALL_SHA256="c462ff5c1c755b269b680f6e1c4c22ef58b7ae9b92679444634c35d248cc4267" +DEFAULT_INSTALL_SHA256="108b168f54fdc795322152b655fcca3793968cc8e4629287e64f2bd51fa13aa7" MAX_INSTALLER_BYTES=2097152 cleanup() { diff --git a/tests/test_install.py b/tests/test_install.py index 602d2b6d..4a7ace30 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -3446,6 +3446,19 @@ class HintsGiveTheUsersOwnCommandBack(unittest.TestCase): hint = "\n".join(install._manual_usage_hint("linux")) self.assertIn("python3 install.py --platform retroarch", hint) + def test_a_listing_hint_keeps_the_listing(self): + """--list-systems with nothing detected was answered with a full + install command: the listing flag gone, a --dest added.""" + home = Path(_tempdir(self)) + env = {**os.environ, "HOME": str(home), "RETROBIOS_OS": "linux", + "RETROBIOS_BOOTSTRAP": ""} + for flag in ("--list-systems", "--list-cores", "--list-emulators", "--list-targets"): + with self.subTest(flag=flag): + proc = _install_run(env, flag, "--no-input") + self.assertEqual(proc.returncode, 1, proc.stdout + proc.stderr) + self.assertIn(f"python3 install.py --platform retroarch {flag}", proc.stdout) + self.assertNotIn("--dest", proc.stdout) + def test_the_write_advice_keeps_the_narrowing(self): self._record("--system", "atari-lynx", "--region", "us") install._INVOCATION.os_type = "linux"