fix: name a sign-in page sent for the file list

This commit is contained in:
Abdessamad Derraz committed 2026-11-05 12:08:12 +01:00
1 parent f6de9a0ae3
commit 3389651549
5 files changed
+39 -12

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 = "ca1c3c0d721787ee0fd9ab750839893d64f9313885dde6c1f88c5174d4281ce0"
$defaultInstallSha256 = "5255181d018ce7020a619c6a31419da0dde862626bc57347cd0299a099e64f11"
$maximumInstallerBytes = 2MB
$installerExit = 0
$installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null }
+13 -2
View File
@@ -4056,9 +4056,20 @@ def fetch_manifest(plat: str) -> dict:
try:
return _validate_manifest(_fetch_json(url, MAX_MANIFEST_BYTES, "file list"), plat)
except ValueError as exc:
words = f"the file list is not valid: {exc}"
if isinstance(exc.__cause__, (json.JSONDecodeError, UnicodeDecodeError)):
# The parser's "Expecting value: line 1 column 1" told no one
# anything, where the full screen names the usual cause.
words = ("what arrived is not a file list: a Wi-Fi sign-in page or a cut "
"download looks like this")
EVENTS.emit("error", stage="manifest", reason="invalid", platform=plat,
message=f"the file list is not valid: {exc}")
print(f" The file list for {plat} is not valid: {exc}", file=sys.stderr)
message=words)
print(f" For {display_name(plat)}, {words}.", file=sys.stderr)
if words.startswith("what arrived"):
for line in _address_lines(url):
print(line, file=sys.stderr)
print(" Check the connection (sign in to the Wi-Fi if it asks), then run the "
"same command again.", file=sys.stderr)
sys.exit(1)
except urllib.error.HTTPError as exc:
EVENTS.emit(
+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="ca1c3c0d721787ee0fd9ab750839893d64f9313885dde6c1f88c5174d4281ce0"
DEFAULT_INSTALL_SHA256="5255181d018ce7020a619c6a31419da0dde862626bc57347cd0299a099e64f11"
MAX_INSTALLER_BYTES=2097152
cleanup() {
+8 -8
View File
@@ -27,8 +27,8 @@
{
"dest": "roms/ports/retrobios/install.py",
"repo_path": "install.py",
"size": 1083967,
"sha256": "ca1c3c0d721787ee0fd9ab750839893d64f9313885dde6c1f88c5174d4281ce0",
"size": 1084625,
"sha256": "5255181d018ce7020a619c6a31419da0dde862626bc57347cd0299a099e64f11",
"executable": false
},
{
@@ -71,8 +71,8 @@
"muos": {
"archive": {
"dest": "ARCHIVE/RetroBIOS.muxapp",
"size": 1137594,
"sha256": "433caee0f48148c8c25122e3cfa4a6d4577160a2b4ddcf2267415ebd21beb843"
"size": 1138252,
"sha256": "bc75188e7d115aa35066fba281deb2bec5ce07553ebdbe2d8444d0dbdfc5d41d"
},
"members": [
{
@@ -92,8 +92,8 @@
{
"name": "RetroBIOS/install.py",
"repo_path": "install.py",
"size": 1083967,
"sha256": "ca1c3c0d721787ee0fd9ab750839893d64f9313885dde6c1f88c5174d4281ce0",
"size": 1084625,
"sha256": "5255181d018ce7020a619c6a31419da0dde862626bc57347cd0299a099e64f11",
"executable": false
},
{
@@ -166,8 +166,8 @@
{
"dest": ".config/modules/retrobios/install.py",
"repo_path": "install.py",
"size": 1083967,
"sha256": "ca1c3c0d721787ee0fd9ab750839893d64f9313885dde6c1f88c5174d4281ce0",
"size": 1084625,
"sha256": "5255181d018ce7020a619c6a31419da0dde862626bc57347cd0299a099e64f11",
"executable": false
},
{
+16
View File
@@ -2404,6 +2404,22 @@ class FileListsAreRetried(unittest.TestCase):
self.assertIs(result, missing)
self.assertEqual(len(calls), 1)
def test_a_sign_in_page_is_named(self):
"""A Wi-Fi sign-in page read as "invalid file list: Expecting value:
line 1 column 1 (char 0)", with no cause and no next step."""
page = io.BytesIO(b"<html>Sign in to Hotel WiFi</html>")
page.headers = {}
err = io.StringIO()
with unittest.mock.patch.object(
install.urllib.request, "urlopen",
lambda url, timeout=None: contextlib.nullcontext(page)), \
contextlib.redirect_stderr(err), self.assertRaises(SystemExit):
install.fetch_manifest("retroarch")
said = err.getvalue()
self.assertIn("a Wi-Fi sign-in page or a cut download looks like this", said)
self.assertIn("run the same command again", said)
self.assertNotIn("Expecting value", said)
def test_three_failures_end_with_advice(self):
import urllib.error