mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-23 20:29:06 -05:00
fix: keep the listing in the no-platform hint
--list-systems, --list-cores, --list-emulators and --list-targets with nothing detected were answered with an install command that dropped the listing and added --dest. The hint now names the platform and keeps the listing.
This commit is contained in:
1 parent
630d5d85fb
commit
6c4f056f08
4 files changed
+31
-4
No files matched your search
+1
-1
@@ -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 }
|
||||
|
||||
+16
-2
@@ -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)
|
||||
|
||||
+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="c462ff5c1c755b269b680f6e1c4c22ef58b7ae9b92679444634c35d248cc4267"
|
||||
DEFAULT_INSTALL_SHA256="108b168f54fdc795322152b655fcca3793968cc8e4629287e64f2bd51fa13aa7"
|
||||
MAX_INSTALLER_BYTES=2097152
|
||||
|
||||
cleanup() {
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in new issue
Block a user