From 03eac0da94b27467d1ef4ffc7cdde7babc827c19 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Wed, 28 Oct 2026 06:28:38 +0100 Subject: [PATCH] fix: usage names install.py, not its copy install.ps1 runs a copy named retrobios-install-.py, and --help and every usage error printed that name. The parser names install.py. --- install.ps1 | 2 +- install.py | 3 +++ install.sh | 2 +- install/launchers/index.json | 16 ++++++++-------- tests/test_install_tui.py | 22 ++++++++++++++++++++++ 5 files changed, 35 insertions(+), 10 deletions(-) diff --git a/install.ps1 b/install.ps1 index f03e3245d..3c80ac49c 100644 --- a/install.ps1 +++ b/install.ps1 @@ -11,7 +11,7 @@ $ErrorActionPreference = "Stop" $defaultInstallUrl = "https://raw.githubusercontent.com/Abdess/retrobios/main/install.py" - $defaultInstallSha256 = "d3900f45996c1df29734403c5d15767c5fc3badcb070c93bbaf5a4f16f65140b" + $defaultInstallSha256 = "4464cd84fdc1fcabb2428d73a9e5c1842e16f81d62b6e016d01a3408c8d41d67" $maximumInstallerBytes = 2MB $installerExit = 0 $installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null } diff --git a/install.py b/install.py index c65d8addd..25f50a32f 100644 --- a/install.py +++ b/install.py @@ -10423,6 +10423,9 @@ def build_parser() -> argparse.ArgumentParser: """The options, in the order --help and wiki/installer.md list them (scripts/generate_installer_doc.py writes its table from this parser).""" parser = argparse.ArgumentParser( + # Never the file's own name: install.ps1 runs a copy named + # retrobios-install-.py, which usage and errors printed. + prog="install.py", allow_abbrev=False, description="Download missing BIOS files for retrogaming emulators. " "For questions line by line, as a screen reader reads them, " diff --git a/install.sh b/install.sh index aee7254dd..458921b17 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="d3900f45996c1df29734403c5d15767c5fc3badcb070c93bbaf5a4f16f65140b" +DEFAULT_INSTALL_SHA256="4464cd84fdc1fcabb2428d73a9e5c1842e16f81d62b6e016d01a3408c8d41d67" MAX_INSTALLER_BYTES=2097152 cleanup() { diff --git a/install/launchers/index.json b/install/launchers/index.json index 6ffb5f4d3..f28533d55 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": 910604, - "sha256": "d3900f45996c1df29734403c5d15767c5fc3badcb070c93bbaf5a4f16f65140b", + "size": 910769, + "sha256": "4464cd84fdc1fcabb2428d73a9e5c1842e16f81d62b6e016d01a3408c8d41d67", "executable": false }, { @@ -71,8 +71,8 @@ "muos": { "archive": { "dest": "ARCHIVE/RetroBIOS.muxapp", - "size": 963396, - "sha256": "adb57fcae73e5138cc204f38065557677fe32cd11888e336cd1363eb53d72b20" + "size": 963561, + "sha256": "122336a78dc618927fc75c708c2991ae373783db031e3fba5828bc372e17e3f8" }, "members": [ { @@ -92,8 +92,8 @@ { "name": "RetroBIOS/install.py", "repo_path": "install.py", - "size": 910604, - "sha256": "d3900f45996c1df29734403c5d15767c5fc3badcb070c93bbaf5a4f16f65140b", + "size": 910769, + "sha256": "4464cd84fdc1fcabb2428d73a9e5c1842e16f81d62b6e016d01a3408c8d41d67", "executable": false }, { @@ -166,8 +166,8 @@ { "dest": ".config/modules/retrobios/install.py", "repo_path": "install.py", - "size": 910604, - "sha256": "d3900f45996c1df29734403c5d15767c5fc3badcb070c93bbaf5a4f16f65140b", + "size": 910769, + "sha256": "4464cd84fdc1fcabb2428d73a9e5c1842e16f81d62b6e016d01a3408c8d41d67", "executable": false }, { diff --git a/tests/test_install_tui.py b/tests/test_install_tui.py index 24df2e54d..73e48e79f 100644 --- a/tests/test_install_tui.py +++ b/tests/test_install_tui.py @@ -11679,6 +11679,28 @@ class AuditTwentyAndThirteen(unittest.TestCase): self.assertIn("So is a platform named by a file list or a pack", page) +class TheUsageNamesTheInstaller(unittest.TestCase): + """The Windows one-liner's --help said "usage: retrobios-install-.py", + the name install.ps1 gives its copy.""" + + def test_a_copy_under_a_temporary_name_says_install_py(self): + scratch = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp")) + self.addCleanup(shutil.rmtree, scratch, True) + copy = scratch / "retrobios-install-33826e0b-37cc-4ad3-a6c4-6ed168e3fe9e.py" + shutil.copyfile(REPO_ROOT / "install.py", copy) + env = {**os.environ, "RETROBIOS_BOOTSTRAP": "ps1"} + for option in ("--help", "--no-such-option"): + with self.subTest(option=option): + proc = subprocess.run([sys.executable, str(copy), option], env=env, + capture_output=True, text=True, timeout=60, + stdin=subprocess.DEVNULL, check=False) + said = proc.stdout + proc.stderr + self.assertIn("usage: install.py", said) + self.assertNotIn("retrobios-install-", said) + with mock.patch.object(sys, "argv", [str(copy), "--help"]): + self.assertEqual(install.build_parser().prog, "install.py") + + class TapsSeenBeforeTheyAct(unittest.TestCase): """code_audit_20 P3-2 and tui_audit_13 P2-1, P2-2: a tap acts on the frame it was made on, and never commits on one tap."""