fix: keep the offline variable beside --offline

This commit is contained in:
Abdessamad Derraz committed 2026-11-21 21:42:19 +01:00
1 parent 4adb8ea635
commit f0ab5181ab
7 files changed
+33 -15

No files matched your search

+1 -1
View File
@@ -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
+3 -2
View File
@@ -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)))), "")
+1 -1
View File
@@ -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
+8 -8
View File
@@ -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
},
{
+3 -2
View File
@@ -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)))), "")
+16
View File
@@ -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))
+1 -1
View File
@@ -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")