diff --git a/install.ps1 b/install.ps1 index 7892411d6..6d870ac14 100644 --- a/install.ps1 +++ b/install.ps1 @@ -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 } diff --git a/install.py b/install.py index 9d7fc2a7f..325e7efa1 100644 --- a/install.py +++ b/install.py @@ -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 diff --git a/install.sh b/install.sh index 8dc8ad1b3..34c845946 100755 --- a/install.sh +++ b/install.sh @@ -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() { diff --git a/install/launchers/index.json b/install/launchers/index.json index a68f0af23..77a7edb56 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": 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 }, { diff --git a/scripts/generate_installer_doc.py b/scripts/generate_installer_doc.py index 7b09eeba2..ef443d2d2 100644 --- a/scripts/generate_installer_doc.py +++ b/scripts/generate_installer_doc.py @@ -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": diff --git a/tests/test_install_tui.py b/tests/test_install_tui.py index 500637ac6..e9ff1c2bf 100644 --- a/tests/test_install_tui.py +++ b/tests/test_install_tui.py @@ -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() diff --git a/tests/test_site_r4_merge.py b/tests/test_site_r4_merge.py index 6879f885a..6b7d51031 100644 --- a/tests/test_site_r4_merge.py +++ b/tests/test_site_r4_merge.py @@ -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?") diff --git a/wiki/first-install.md b/wiki/first-install.md index 7e19047fa..29fac6118 100644 --- a/wiki/first-install.md +++ b/wiki/first-install.md @@ -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