mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-22 17:47:48 -06:00
fix: read a full drive once when the run ends
This commit is contained in:
1 parent
0e2be04f9c
commit
36d5827b25
8 files changed
+30
-17
No files matched your search
+1
-1
@@ -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 = "c71894b367adea17ac830c508aa2d7b7ff7fbfb1d0a8f7246b6a1a74a20af6f9"
|
||||
$defaultInstallSha256 = "27533551d40958a3c9405f05d7900478298261dd07a4d3e7d485a59be99d7e08"
|
||||
# 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
|
||||
|
||||
+8
-3
@@ -13771,6 +13771,9 @@ class TuiState:
|
||||
self.code: int | None = None
|
||||
self.stopping: bool = False
|
||||
self.tail: list = []
|
||||
# The run's stop for lack of space in words, read when it ended: the
|
||||
# result screen looked through the mounted drives on every frame.
|
||||
self.full_drive: str = ""
|
||||
self.log: str = ""
|
||||
self.exit_code: int | None = None
|
||||
# The RetroBIOS app on the card the BIOS folder is on: asked for
|
||||
@@ -26865,8 +26868,9 @@ def _space_stop(state: TuiState) -> re.Match | None:
|
||||
return next(filter(None, (_SPACE_NEEDED.search(line) for line in state.tail)), None)
|
||||
|
||||
|
||||
def _space_words(state: TuiState) -> str:
|
||||
"""The run's stop for lack of space, in words, "" for another stop."""
|
||||
def full_drive_words(state: TuiState) -> str:
|
||||
"""The run's stop for lack of space, in words, "" for another stop: read
|
||||
once, when the run ends."""
|
||||
match = _space_stop(state)
|
||||
if match is None:
|
||||
return ""
|
||||
@@ -26926,7 +26930,7 @@ def _outcome_counts(state: TuiState) -> _OutcomeCounts:
|
||||
if _offline_only() and not offline_failed else 0)
|
||||
up_to_date = summary.get("up_to_date", 0)
|
||||
total = (state.download or {}).get("files", 0)
|
||||
space = "" if summary else _space_words(state)
|
||||
space = "" if summary else state.full_drive
|
||||
errors = f", {len(failed)} failed" if failed else ""
|
||||
return _OutcomeCounts(summary, installed, failed, offline_failed, left, up_to_date, total,
|
||||
space, errors)
|
||||
@@ -30554,6 +30558,7 @@ def tui_receive(state: TuiState, message: tuple) -> list[tuple]:
|
||||
state.running = False
|
||||
state.tail = [line for line in tail if not line.startswith("RetroBIOS ")]
|
||||
tail = state.tail
|
||||
state.full_drive = full_drive_words(state)
|
||||
if state.run in TUI_ACTION_RUNS:
|
||||
return _action_ended(state, code, tail)
|
||||
if state.run == "check":
|
||||
|
||||
+1
-1
@@ -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="c71894b367adea17ac830c508aa2d7b7ff7fbfb1d0a8f7246b6a1a74a20af6f9"
|
||||
DEFAULT_INSTALL_SHA256="27533551d40958a3c9405f05d7900478298261dd07a4d3e7d485a59be99d7e08"
|
||||
# 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
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
{
|
||||
"dest": "roms/ports/retrobios/install.py",
|
||||
"repo_path": "install.py",
|
||||
"size": 1450660,
|
||||
"sha256": "c71894b367adea17ac830c508aa2d7b7ff7fbfb1d0a8f7246b6a1a74a20af6f9",
|
||||
"size": 1450927,
|
||||
"sha256": "27533551d40958a3c9405f05d7900478298261dd07a4d3e7d485a59be99d7e08",
|
||||
"executable": false
|
||||
},
|
||||
{
|
||||
@@ -71,8 +71,8 @@
|
||||
"muos": {
|
||||
"archive": {
|
||||
"dest": "ARCHIVE/RetroBIOS.muxapp",
|
||||
"size": 1504285,
|
||||
"sha256": "7d917bbb0d44d98fd2a21944e4bf475cf65a4c221fc975c656b5f21e17fe8798"
|
||||
"size": 1504552,
|
||||
"sha256": "7011d54d1dbf6dbf135f319c17bc3a4ba1d57a479ccb0442086a7a3b0457d86b"
|
||||
},
|
||||
"members": [
|
||||
{
|
||||
@@ -92,8 +92,8 @@
|
||||
{
|
||||
"name": "RetroBIOS/install.py",
|
||||
"repo_path": "install.py",
|
||||
"size": 1450660,
|
||||
"sha256": "c71894b367adea17ac830c508aa2d7b7ff7fbfb1d0a8f7246b6a1a74a20af6f9",
|
||||
"size": 1450927,
|
||||
"sha256": "27533551d40958a3c9405f05d7900478298261dd07a4d3e7d485a59be99d7e08",
|
||||
"executable": false
|
||||
},
|
||||
{
|
||||
@@ -166,8 +166,8 @@
|
||||
{
|
||||
"dest": ".config/modules/retrobios/install.py",
|
||||
"repo_path": "install.py",
|
||||
"size": 1450660,
|
||||
"sha256": "c71894b367adea17ac830c508aa2d7b7ff7fbfb1d0a8f7246b6a1a74a20af6f9",
|
||||
"size": 1450927,
|
||||
"sha256": "27533551d40958a3c9405f05d7900478298261dd07a4d3e7d485a59be99d7e08",
|
||||
"executable": false
|
||||
},
|
||||
{
|
||||
|
||||
@@ -46,8 +46,9 @@ def _space_stop(state: TuiState) -> re.Match | None:
|
||||
return next(filter(None, (_SPACE_NEEDED.search(line) for line in state.tail)), None)
|
||||
|
||||
|
||||
def _space_words(state: TuiState) -> str:
|
||||
"""The run's stop for lack of space, in words, "" for another stop."""
|
||||
def full_drive_words(state: TuiState) -> str:
|
||||
"""The run's stop for lack of space, in words, "" for another stop: read
|
||||
once, when the run ends."""
|
||||
match = _space_stop(state)
|
||||
if match is None:
|
||||
return ""
|
||||
@@ -107,7 +108,7 @@ def _outcome_counts(state: TuiState) -> _OutcomeCounts:
|
||||
if _offline_only() and not offline_failed else 0)
|
||||
up_to_date = summary.get("up_to_date", 0)
|
||||
total = (state.download or {}).get("files", 0)
|
||||
space = "" if summary else _space_words(state)
|
||||
space = "" if summary else state.full_drive
|
||||
errors = f", {len(failed)} failed" if failed else ""
|
||||
return _OutcomeCounts(summary, installed, failed, offline_failed, left, up_to_date, total,
|
||||
space, errors)
|
||||
|
||||
@@ -21,6 +21,7 @@ from installer.tui_actions import (
|
||||
)
|
||||
from installer.tui_choice import _needed
|
||||
from installer.tui_commands import TUI_ACTION_RUNS
|
||||
from installer.tui_outcome import full_drive_words
|
||||
from installer.tui_paint import _styled
|
||||
from installer.tui_rows import tui_rows
|
||||
|
||||
@@ -309,6 +310,7 @@ def tui_receive(state: TuiState, message: tuple) -> list[tuple]:
|
||||
state.running = False
|
||||
state.tail = [line for line in tail if not line.startswith("RetroBIOS ")]
|
||||
tail = state.tail
|
||||
state.full_drive = full_drive_words(state)
|
||||
if state.run in TUI_ACTION_RUNS:
|
||||
return _action_ended(state, code, tail)
|
||||
if state.run == "check":
|
||||
|
||||
@@ -280,6 +280,9 @@ class TuiState:
|
||||
self.code: int | None = None
|
||||
self.stopping: bool = False
|
||||
self.tail: list = []
|
||||
# The run's stop for lack of space in words, read when it ended: the
|
||||
# result screen looked through the mounted drives on every frame.
|
||||
self.full_drive: str = ""
|
||||
self.log: str = ""
|
||||
self.exit_code: int | None = None
|
||||
# The RetroBIOS app on the card the BIOS folder is on: asked for
|
||||
|
||||
@@ -2987,7 +2987,8 @@ class CardsSpaceAndConfirm(unittest.TestCase):
|
||||
state.stack.append("result")
|
||||
state.code, state.tail = 2, list(self.FULL_TAIL)
|
||||
with mock.patch.object(install, "_mounted_cards", return_value=[root]):
|
||||
title, lines = install.tui_outcome(state)
|
||||
state.full_drive = install.full_drive_words(state)
|
||||
title, lines = install.tui_outcome(state)
|
||||
self.assertEqual(title, "Not enough space")
|
||||
self.assertEqual(lines[0], "The card is full: 1.2 GB needed, 300.0 MB free.")
|
||||
self.assertIn("Free some space, or run again and choose another folder.", lines)
|
||||
@@ -9555,6 +9556,7 @@ class PacksWordingAndDocs(unittest.TestCase):
|
||||
view = " ".join(install.tui_view(state, 120, 40))
|
||||
state.stack = ["result"]
|
||||
state.tail = ["Needed: 87.9 KB. Free: 36.0 KB."]
|
||||
state.full_drive = install.full_drive_words(state)
|
||||
_title, lines = install.tui_outcome(state)
|
||||
self.assertEqual(state.card_bound, ("Onion", "BIOS"))
|
||||
self.assertIn("The BIOS folder chosen for Onion:", view)
|
||||
|
||||
Reference in new issue
Block a user