From f0ab5181ab2c01812af6d8005de6a4bbd3719345 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Sat, 21 Nov 2026 20:39:06 +0100 Subject: [PATCH] fix: keep the offline variable beside --offline --- install.ps1 | 2 +- install.py | 5 +++-- install.sh | 2 +- install/launchers/index.json | 16 ++++++++-------- installer/cli.py | 5 +++-- tests/test_install_offline.py | 16 ++++++++++++++++ tests/test_install_tui.py | 2 +- 7 files changed, 33 insertions(+), 15 deletions(-) diff --git a/install.ps1 b/install.ps1 index e969df3bb..b31f59f30 100644 --- a/install.ps1 +++ b/install.ps1 @@ -16,7 +16,7 @@ # and Invoke-WebRequest throws on a cut transfer before the hash is read: # the site's build rewrites this line there (scripts/sitebootstrap.py). $mismatchAdvice = "The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that." - $defaultInstallSha256 = "5a07175ce9093e8ab8975dab0dfd2f18a25c0b0befa4996283834b3411fcd303" + $defaultInstallSha256 = "a14ac854879a2da7bb858b1a446d93175ffee13274cf09048636ce57fe4df397" # The pin above refuses any changed byte: this cap only stops a body that # cannot be the installer (a sign-in portal's page) before it is hashed. $maximumInstallerBytes = 8MB diff --git a/install.py b/install.py index ea998ea69..f74e021c8 100644 --- a/install.py +++ b/install.py @@ -32056,9 +32056,10 @@ def _main_check_add_app(parser: argparse.ArgumentParser, args: argparse.Namespac def _main_check_offline(parser: argparse.ArgumentParser, args: argparse.Namespace) -> None: """Record --offline, and refuse --target where no core list can be read.""" - if args.offline: + if args.offline and not offline_requested(): # The runs the full-screen interface starts read it from here, and - # the words name the option given. + # the words name the option given. A variable already set keeps its + # value: dropping --offline alone would leave the run offline. os.environ[OFFLINE_VARIABLE] = OFFLINE_FLAG_VALUE named = next((plat for plat in AVAILABLE_PLATFORMS if args.platform and _name_key( args.platform) in (_name_key(plat), _name_key(display_name(plat)))), "") diff --git a/install.sh b/install.sh index 7717db06f..0bd05ba6e 100755 --- a/install.sh +++ b/install.sh @@ -23,7 +23,7 @@ DEFAULT_INSTALL_URL="https://raw.githubusercontent.com/Abdess/retrobios/main/ins # curl or wget stop on a cut transfer before the hash is read: the site's # build rewrites this line there (scripts/sitebootstrap.py). MISMATCH_ADVICE="The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that." -DEFAULT_INSTALL_SHA256="5a07175ce9093e8ab8975dab0dfd2f18a25c0b0befa4996283834b3411fcd303" +DEFAULT_INSTALL_SHA256="a14ac854879a2da7bb858b1a446d93175ffee13274cf09048636ce57fe4df397" # The pin above refuses any changed byte: this cap only stops a body that # cannot be the installer (a sign-in portal's page) before it is hashed. MAX_INSTALLER_BYTES=8388608 diff --git a/install/launchers/index.json b/install/launchers/index.json index 975a8bb99..74a017d18 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": 1470007, - "sha256": "5a07175ce9093e8ab8975dab0dfd2f18a25c0b0befa4996283834b3411fcd303", + "size": 1470139, + "sha256": "a14ac854879a2da7bb858b1a446d93175ffee13274cf09048636ce57fe4df397", "executable": false }, { @@ -71,8 +71,8 @@ "muos": { "archive": { "dest": "ARCHIVE/RetroBIOS.muxapp", - "size": 1523632, - "sha256": "55f80b0407b229920d67b576844b3e9af8eee553dace0f13dbaa0d5609424298" + "size": 1523764, + "sha256": "feeeaa00566d25edb643e86b7882c92ceb77b963f64515991292703c87eaa91c" }, "members": [ { @@ -92,8 +92,8 @@ { "name": "RetroBIOS/install.py", "repo_path": "install.py", - "size": 1470007, - "sha256": "5a07175ce9093e8ab8975dab0dfd2f18a25c0b0befa4996283834b3411fcd303", + "size": 1470139, + "sha256": "a14ac854879a2da7bb858b1a446d93175ffee13274cf09048636ce57fe4df397", "executable": false }, { @@ -166,8 +166,8 @@ { "dest": ".config/modules/retrobios/install.py", "repo_path": "install.py", - "size": 1470007, - "sha256": "5a07175ce9093e8ab8975dab0dfd2f18a25c0b0befa4996283834b3411fcd303", + "size": 1470139, + "sha256": "a14ac854879a2da7bb858b1a446d93175ffee13274cf09048636ce57fe4df397", "executable": false }, { diff --git a/installer/cli.py b/installer/cli.py index acd32e48f..211f57847 100644 --- a/installer/cli.py +++ b/installer/cli.py @@ -220,9 +220,10 @@ def _main_check_add_app(parser: argparse.ArgumentParser, args: argparse.Namespac def _main_check_offline(parser: argparse.ArgumentParser, args: argparse.Namespace) -> None: """Record --offline, and refuse --target where no core list can be read.""" - if args.offline: + if args.offline and not offline_requested(): # The runs the full-screen interface starts read it from here, and - # the words name the option given. + # the words name the option given. A variable already set keeps its + # value: dropping --offline alone would leave the run offline. os.environ[OFFLINE_VARIABLE] = OFFLINE_FLAG_VALUE named = next((plat for plat in AVAILABLE_PLATFORMS if args.platform and _name_key( args.platform) in (_name_key(plat), _name_key(display_name(plat)))), "") diff --git a/tests/test_install_offline.py b/tests/test_install_offline.py index 618e22cc6..11fc6ec1f 100644 --- a/tests/test_install_offline.py +++ b/tests/test_install_offline.py @@ -1019,6 +1019,22 @@ class OneOfflineVocabulary(Scratch): hint.record(args) self.assertIn("--offline", hint.command("retroarch", self.dest, elevated=True)) + def test_the_variable_stays_named_beside_the_option(self): + """Both set: "without --offline" left the run offline, the variable + still set. The full screen hands --offline to runs that inherit it.""" + import argparse + + args = argparse.Namespace(offline=True, platform="retroarch", target=None, + list_targets=False, manifest=None, from_pack=None) + with unittest.mock.patch.dict(os.environ, {install.OFFLINE_VARIABLE: "1"}): + install._main_check_offline(argparse.ArgumentParser(), args) + self.assertEqual(os.environ[install.OFFLINE_VARIABLE], "1") + self.assertEqual(install.offline_undo(), f"with {install.OFFLINE_VARIABLE} unset") + with unittest.mock.patch.dict(os.environ): + os.environ.pop(install.OFFLINE_VARIABLE, None) + install._main_check_offline(argparse.ArgumentParser(), args) + self.assertEqual(install.offline_undo(), "without --offline") + def test_check_offline_says_what_cannot_come(self): """"Run the same command without --check to fetch them".""" proc = self.run_installer("--check", "--offline", "--manifest", str(self.list)) diff --git a/tests/test_install_tui.py b/tests/test_install_tui.py index f1bed9c68..45b5ee562 100644 --- a/tests/test_install_tui.py +++ b/tests/test_install_tui.py @@ -4462,7 +4462,7 @@ class LineModeOffline(unittest.TestCase): "the line mode run needs pyte and a pty") def test_nothing_is_offered_that_cannot_come(self): with FakeRepository() as repo: - env = {**repo.env(), "TERM": "xterm", install.OFFLINE_VARIABLE: "1"} + env = {**repo.env(), "TERM": "xterm"} term = Pty(["--plain", "--manifest", str(repo.root / "install" / "retroarch.json"), "--dest", str(repo.dest), "--offline"], env) term.wait("q) quit")