From 83973e1415bc62d030d8a112eafd2fa4090727aa Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Fri, 23 Oct 2026 14:10:27 +0200 Subject: [PATCH] fix: point a declined download at the c entry Saying no to a large download sent a beginner to --help. When the question about what to install was asked, the line now names the c entry, and i with its size when installed cores were found. --- install.ps1 | 2 +- install.py | 13 +++++++++++- install.sh | 2 +- tests/test_install_selection.py | 36 +++++++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 3 deletions(-) diff --git a/install.ps1 b/install.ps1 index 9f0defe7..37aaf354 100644 --- a/install.ps1 +++ b/install.ps1 @@ -11,7 +11,7 @@ $ErrorActionPreference = "Stop" $defaultInstallUrl = "https://raw.githubusercontent.com/Abdess/retrobios/main/install.py" - $defaultInstallSha256 = "b5070145ae7920b90e8d904552a223261fae35a394552c7ce3a2b87cbcf613e8" + $defaultInstallSha256 = "a0b6a103d350e49f2751928c5a5560e239c52df81637a656e0691b9934e438bb" $maximumInstallerBytes = 2MB $installerExit = 0 $installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null } diff --git a/install.py b/install.py index c867a670..81e6386f 100644 --- a/install.py +++ b/install.py @@ -7561,6 +7561,8 @@ def _install(args: argparse.Namespace, real_stdout: TextIO) -> None: # What --core resolves against, for advice that names one. core_choices = set(available_choices(files, omitted_files)["cores"]) selection = _requested_narrowing(args, plat_name, files, omitted_files, manifest) + # What declining the size question points back at, when it was asked. + smaller = "" if ( selection is None and interactive @@ -7576,6 +7578,13 @@ def _install(args: argparse.Namespace, real_stdout: TextIO) -> None: plat_name, files, omitted_files, installed, display_name(plat_name, manifest), ) + if selection is None: + smaller = (" Nothing downloaded. To install less, run the same command " + "again and type c at the first question to choose systems") + if installed is not None: + smaller += (f", or i for only what the installed cores read " + f"({format_size(_bytes(installed[0]))})") + smaller += "." if selection == INSTALLED_ONLY: files, omitted_files = installed print("\n Same choice without questions: " @@ -7752,7 +7761,9 @@ def _install(args: argparse.Namespace, real_stdout: TextIO) -> None: f"\nDownload {format_size(dl_size)} to {bios_path}? [Y/n] " ) ): - print(" Nothing downloaded. --system, --core and --region " + # A beginner who just passed the c entry was sent to a + # 91-line --help. + print(smaller or " Nothing downloaded. --system, --core and --region " "install less (see --help).") total_up_to_date += len(up_to_date) total_declined += len(to_download) diff --git a/install.sh b/install.sh index a1de88a0..9312862d 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="b5070145ae7920b90e8d904552a223261fae35a394552c7ce3a2b87cbcf613e8" +DEFAULT_INSTALL_SHA256="a0b6a103d350e49f2751928c5a5560e239c52df81637a656e0691b9934e438bb" MAX_INSTALLER_BYTES=2097152 cleanup() { diff --git a/tests/test_install_selection.py b/tests/test_install_selection.py index 63a26ddf..e4764790 100644 --- a/tests/test_install_selection.py +++ b/tests/test_install_selection.py @@ -354,6 +354,42 @@ class CommandLineChoices(unittest.TestCase): install.parse_selection(bad, 5) +class DecliningTheSizePointsAtTheChoice(unittest.TestCase): + """Saying no to `Download 8.4 GB?` printed "--system, --core and + --region install less (see --help)": a 91-line help for someone who had + just passed the c entry that does it.""" + + def _run(self, answers: list[str], *options: str) -> str: + replies = iter(answers) + out = io.StringIO() + with FakeRepository() as repo, \ + mock.patch.object(sys, "argv", ["install.py", "--platform", "retroarch", + "--dest", str(repo.dest), *options]), \ + mock.patch.object(install, "MANIFEST_URL", + repo.env()["RETROBIOS_BASE_URL"] + "/install/{platform}.json"), \ + mock.patch.object(install, "RAW_FILE_URL", + repo.env()["RETROBIOS_BASE_URL"] + "/{path}"), \ + mock.patch.object(install, "CONFIRM_FROM_BYTES", 1), \ + mock.patch("sys.stdin", mock.Mock(isatty=lambda: True)), \ + mock.patch("builtins.input", lambda _prompt="": next(replies)), \ + contextlib.redirect_stdout(out): + try: + install.main() + except SystemExit: + pass + self.assertEqual(repo.installed(), []) + return out.getvalue() + + def test_install_everything_then_no_names_the_c_entry(self): + out = self._run(["", "n"]) + self.assertIn("type c at the first question", out) + self.assertNotIn("see --help", out) + + def test_options_given_keep_the_option_advice(self): + out = self._run(["n"], "--system", "sony-playstation") + self.assertIn("--system, --core and --region install less", out) + + class ACoreWithNoFileOfItsOwn(unittest.TestCase): """pcsx_rearmed, swanstation and pcsx1 showed `0 files, 0 B` in the cores step and in --list-cores, which reads as "this core gets nothing":