fix: name --offline when given, keep page budget

--offline given with the variable set is named as the option, and the
runs the screen starts get it only when the user gave it. The first
install page stays under its 400 words, the 3.8 runs skip only the
pack test that needs generate_pack.
This commit is contained in:
Abdessamad Derraz committed 2026-10-27 16:57:34 +01:00
1 parent 73f8e48d41
commit a4af2ffda4
8 files changed
+42 -34

No files matched your search

+1 -1
View File
@@ -11,7 +11,7 @@
$ErrorActionPreference = "Stop"
$defaultInstallUrl = "https://raw.githubusercontent.com/Abdess/retrobios/main/install.py"
$defaultInstallSha256 = "c138739989d2ea32639c470f3af89d5038604b7fb446f08cc37659e139b76605"
$defaultInstallSha256 = "749d14547ad7a5504ff6ee4c62aca2ec710839174e149df77759c70d3e4fe951"
$maximumInstallerBytes = 2MB
$installerExit = 0
$installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null }
+6 -3
View File
@@ -10274,9 +10274,9 @@ def main() -> None:
):
if given:
parser.error(reason)
if args.offline and not offline_requested():
if args.offline:
# The runs the full-screen interface starts read it from here, and
# the words name the option, not a variable nobody set.
# the words name the option given.
os.environ[OFFLINE_VARIABLE] = OFFLINE_FLAG_VALUE
if offline_requested() and (args.target or args.list_targets):
parser.error("--target and --list-targets read a core list from the network, "
@@ -13246,7 +13246,10 @@ def tui_flags(state: TuiState) -> list[tuple[str, str | None]]:
if state.jobs != 8:
flags.append(("--jobs", str(state.jobs)))
flags += [("--from", str(folder)) for folder in state.from_folders]
if offline_requested() and not any(flag == "--offline" for flag, _v in flags):
if (os.environ.get(OFFLINE_VARIABLE) == OFFLINE_FLAG_VALUE
and not any(flag == "--offline" for flag, _v in flags)):
# Given as --offline: said so in the command. Set as the variable,
# the runs inherit it and the words name it.
flags.append(("--offline", None))
return flags
+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="c138739989d2ea32639c470f3af89d5038604b7fb446f08cc37659e139b76605"
DEFAULT_INSTALL_SHA256="749d14547ad7a5504ff6ee4c62aca2ec710839174e149df77759c70d3e4fe951"
MAX_INSTALLER_BYTES=2097152
cleanup() {
+8 -8
View File
@@ -27,8 +27,8 @@
{
"dest": "roms/ports/retrobios/install.py",
"repo_path": "install.py",
"size": 818472,
"sha256": "c138739989d2ea32639c470f3af89d5038604b7fb446f08cc37659e139b76605",
"size": 818600,
"sha256": "749d14547ad7a5504ff6ee4c62aca2ec710839174e149df77759c70d3e4fe951",
"executable": false
},
{
@@ -71,8 +71,8 @@
"muos": {
"archive": {
"dest": "ARCHIVE/RetroBIOS.muxapp",
"size": 871021,
"sha256": "0b2f463994437ab12013039a8eec8ce94040a03594e9d820a0da58a1058ef9e1"
"size": 871149,
"sha256": "cbca9dd0e3d7de656965dbff79512991856a03853c0e771da97e5e95d7d31f49"
},
"members": [
{
@@ -92,8 +92,8 @@
{
"name": "RetroBIOS/install.py",
"repo_path": "install.py",
"size": 818472,
"sha256": "c138739989d2ea32639c470f3af89d5038604b7fb446f08cc37659e139b76605",
"size": 818600,
"sha256": "749d14547ad7a5504ff6ee4c62aca2ec710839174e149df77759c70d3e4fe951",
"executable": false
},
{
@@ -166,8 +166,8 @@
{
"dest": ".config/modules/retrobios/install.py",
"repo_path": "install.py",
"size": 818472,
"sha256": "c138739989d2ea32639c470f3af89d5038604b7fb446f08cc37659e139b76605",
"size": 818600,
"sha256": "749d14547ad7a5504ff6ee4c62aca2ec710839174e149df77759c70d3e4fe951",
"executable": false
},
{
+1 -1
View File
@@ -154,7 +154,7 @@ def route_keys() -> str:
return _table(heading, rows)
def _marker(rule) -> str:
def _marker(rule: _install._OsRule) -> str:
"""A card rule's evidence in words: the file or folder, and the line it
holds for a rule that reads one."""
if rule.method == "file_matches":
+14 -8
View File
@@ -4636,11 +4636,11 @@ class EndToEnd(unittest.TestCase):
self.assertIn("6 files to download", screen)
# The second folder the run writes to, named before
# anything is written, and again on the result.
self.assertIn("1 file read from RetroArch's save directory goes to:\n"
" ~/MySaves", screen)
self.assertIn("1 file read from RetroArch's save directory goes to a "
"folder per core under:\n ~/MySaves", screen)
term.send("\r")
screen = term.wait("6 files installed.")
self.assertIn("save directory goes to:\n ~/MySaves", screen)
self.assertIn("folder per core under:\n ~/MySaves", screen)
term.send("\r")
self.assertEqual(term.close(), 0)
results.append(written(repo, saves))
@@ -6674,6 +6674,9 @@ class _CardFixtures:
listing = self.root / f"{plat}.json"
install_list = {"manifest_version": 2, "platform": plat, "files": files}
listing.write_text(json.dumps(install_list))
if sys.version_info < (3, 9):
# generate_pack.py's context managers need Python 3.9.
return listing, None, {}
sys.path.insert(0, str(REPO_ROOT / "scripts"))
self.addCleanup(sys.path.remove, str(REPO_ROOT / "scripts"))
import generate_pack # noqa: PLC0415
@@ -6794,6 +6797,8 @@ class _LineModeFindings(_CardFixtures):
region=["us"])
self.assertEqual(code, 0, text)
@unittest.skipIf(sys.version_info < (3, 9),
"generate_pack.py's context managers need Python 3.9")
def test_a_pack_names_its_list_only_when_that_list_records_it(self):
"""tui_audit_11 P2-1: a MinUI pack sent --core to install/minui.json,
refused the same way, and a MiSTer pack to install/misterfpga.json,
@@ -6825,10 +6830,9 @@ class _LineModeFindings(_CardFixtures):
"""tui_audit_11 P3-10: "c) choose systems, cores and regions" with a
pack that records systems only, and "Cores: 1) azahar" asked with
one answer."""
_listing, _pack, listed = self.minui("misterfpga", systems=True, cores=False,
regions=False)
files = [{"dest": f["path"], "sha1": f["sha1"], "size": f["size"],
"repo_path": "x", "systems": f["systems"]} for f in listed["files"]]
mister, _pack, _listed = self.minui("misterfpga", systems=True, cores=False,
regions=False)
files = json.loads(mister.read_text())["files"]
self.assertEqual(install.narrowing_words(files, []), "systems")
listing, _pack, _listed = self.minui()
minui = json.loads(listing.read_text())["files"]
@@ -7942,7 +7946,9 @@ class AuditSeventeenAndTen(unittest.TestCase):
"--manifest", str(listing)])
proc = subprocess.run(
["script", "-qec", command, "/dev/null"],
input=f"{repo.dest}\nc\n2\n\n2\n\n", env=env, capture_output=True,
# Enter on RetroArch, first of the setups that read its list
# (tui_audit_11 P1-2), then its folder.
input=f"\n{repo.dest}\nc\n2\n2\n\n", env=env, capture_output=True,
text=True, timeout=120, check=False)
self.assertEqual(proc.returncode, 0, proc.stdout + proc.stderr)
installed = repo.installed()
+4 -3
View File
@@ -181,9 +181,10 @@ class FaqInstallsFromWhatYouHold(unittest.TestCase):
for name in ("muOS", "Onion", "spruceOS", "MinUI", "KNULLI", "ROCKNIX"):
with self.subTest(card=name):
self.assertIn(name, known)
source = (REPO_ROOT / "install.py").read_text(encoding="utf-8")
self.assertIn('f"{card[2]} {kind} ({_mount_name(mount)})"', source)
self.assertIn('else "SD card"', source)
# The label the first screen gives a card found: "Onion SD card".
self.assertEqual(install._card_word(("retroarch", Path("/x/BIOS"), "Onion")), "SD card")
self.assertEqual(install._card_word(("batocera", Path("/x/bios"), "Batocera")),
"SHARE drive")
def test_a_wiped_card_links_the_copy(self):
section = self._section("Lost or wiped card?")
+7 -9
View File
@@ -88,12 +88,11 @@ Arrows move, Enter chooses, Esc goes back, as A and B on a handheld.
## 3. Install
The next screen counts missing files and free space.
It counts missing files and free space.
Press Enter on **Install**. **Choose systems** keeps the consoles you
play.
**Game data** is what a game reads, of no use to other cores. The count
shows it apart, and its row leaves it out.
**Game data** (only a game reads it) has its own row.
**Old card?** In a card reader, choose **Copy the BIOS files from your old
card or a folder**, then the card.
@@ -105,11 +104,11 @@ Esc or Ctrl+C stops, B on a handheld. Run again to resume.
## 5. Read the result
- **Done**: all files are in place.
- **Finished with errors**: run the command again. It retries only those.
- **Finished with errors**: run it again. It retries only those.
- **Finished with files missing**: run it again online.
- **Nothing installed**: the screen says why. See [If it stops](#if-it-stops).
For questions line by line (screen readers), add `--plain`.
For line-by-line questions (screen readers), add `--plain`.
## What the command does
@@ -132,8 +131,8 @@ All good:
## Undo
Files it replaces go to a `retrobios-backup` folder beside your BIOS folder.
The result says how to restore them.
Replaced files go to `retrobios-backup` beside your BIOS folder. The result
says how to restore them.
## If it stops
@@ -169,8 +168,7 @@ You cannot write there. Do what the message says.
### The card is full
Nothing was written. Free some space on the card. On a computer, you can
also choose another folder.
Nothing was written. Free some space there.
### The game still does not start