fix: list a platform's files without installing it

--list-systems, --list-cores and --list-targets read the manifest and write nothing, yet with --platform bizhawk they went through the portable-install refusal and stopped asking for --dest. Someone checking BizHawk's firmware before downloading BizHawk got an error. A listing now runs whether the platform is installed or not.
This commit is contained in:
Abdessamad Derraz committed 2026-10-20 03:22:05 +02:00
1 parent 600bb71fb1
commit 33091dabaf
4 files changed
+27 -2

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ param(
$ErrorActionPreference = "Stop"
$defaultInstallUrl = "https://raw.githubusercontent.com/Abdess/retrobios/main/install.py"
$defaultInstallSha256 = "98bc3ac3442126a44534c4c6817dfda2f680e9f9a5aa499efb81cccebd692ec2"
$defaultInstallSha256 = "84b6a006895a34929d99cfd890f028c2ae09e134385dfd10cc955288daaf4260"
$maximumInstallerBytes = 2MB
$installerExit = 0
$installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null }
+5
View File
@@ -3677,6 +3677,11 @@ def _install(args: argparse.Namespace, real_stdout: TextIO) -> None:
matched = [(n, p) for n, p in detected if n == args.platform]
if matched:
platforms = matched
elif listing:
# A listing reads the manifest and writes nothing: no folder is
# needed, and asking BizHawk's for one refused a question asked
# before downloading BizHawk.
platforms = [(args.platform, _default_dest(os_type, args.platform) or Path.cwd())]
elif args.platform in PORTABLE_ONLY:
# A portable emulator reads the folder beside its executable:
# any default would be a folder it never opens.
+1 -1
View File
@@ -18,7 +18,7 @@ esac
TEMP_INSTALLER=""
TEMP_DIRECTORY=""
DEFAULT_INSTALL_URL="https://raw.githubusercontent.com/Abdess/retrobios/main/install.py"
DEFAULT_INSTALL_SHA256="98bc3ac3442126a44534c4c6817dfda2f680e9f9a5aa499efb81cccebd692ec2"
DEFAULT_INSTALL_SHA256="84b6a006895a34929d99cfd890f028c2ae09e134385dfd10cc955288daaf4260"
MAX_INSTALLER_BYTES=2097152
cleanup() {
+20
View File
@@ -665,5 +665,25 @@ class ACoreWithNothingHeldIsAnOmission(unittest.TestCase):
self.assertEqual(omitted, [])
class AListingNeedsNoInstall(unittest.TestCase):
"""--list-systems with --platform bizhawk stopped on "not found, name it
with --dest": a question asked before downloading BizHawk was refused."""
def test_bizhawk_lists_without_a_folder(self):
with FakeRepository() as repo:
manifest = json.loads((repo.root / "install" / "retroarch.json").read_text())
manifest["platform"] = "bizhawk"
(repo.root / "install" / "bizhawk.json").write_text(json.dumps(manifest))
env = {**repo.env(), "HOME": str(repo.root / "home"), "USERPROFILE": str(repo.root / "home")}
proc = subprocess.run(
[sys.executable, str(REPO_ROOT / "install.py"), "--platform", "bizhawk",
"--list-systems"],
env=env, capture_output=True, text=True, timeout=60, check=False,
stdin=subprocess.DEVNULL,
)
self.assertEqual(proc.returncode, 0, proc.stdout + proc.stderr)
self.assertIn("nintendo-gba", proc.stdout)
if __name__ == "__main__":
unittest.main()