mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-01 07:33:45 -06:00
fix: usage names install.py, not its copy
install.ps1 runs a copy named retrobios-install-<guid>.py, and --help and every usage error printed that name. The parser names install.py.
This commit is contained in:
1 parent
10af16f55d
commit
03eac0da94
5 files changed
+35
-10
No files matched your search
+1
-1
@@ -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 }
|
||||
|
||||
@@ -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-<guid>.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, "
|
||||
|
||||
+1
-1
@@ -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() {
|
||||
|
||||
@@ -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
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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-<guid>.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."""
|
||||
|
||||
Reference in new issue
Block a user