mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-26 03:18:52 -06:00
fix: stop on an unreadable retrodeck manifest
The local manifest read printed a warning and left the component out of retrodeck.yml with exit 0, where the remote read raises.
This commit is contained in:
1 parent
1b7d30967b
commit
5a931ad4b1
2 files changed
+13
-2
No files matched your search
@@ -448,11 +448,14 @@ class Scraper(BaseScraper):
|
||||
mf = d / "component_manifest.json"
|
||||
if not mf.exists():
|
||||
continue
|
||||
# Skipped with a warning, an unreadable manifest left its
|
||||
# component's systems out of retrodeck.yml, exit code 0, where
|
||||
# the remote read stops.
|
||||
try:
|
||||
with open(mf) as f:
|
||||
manifests.append((d.name, json.load(f)))
|
||||
except (json.JSONDecodeError, OSError) as e:
|
||||
print(f" WARNING: {mf}: {e}", file=sys.stderr)
|
||||
except json.JSONDecodeError as e:
|
||||
raise ValueError(f"{mf}: not JSON: {e}") from e
|
||||
return manifests
|
||||
|
||||
def component_file(self, path: str) -> str | None:
|
||||
|
||||
@@ -52,6 +52,14 @@ class RetrodeckConflicts(unittest.TestCase):
|
||||
scraper.fetch_requirements()
|
||||
self.assertEqual(scraper.dropped, [])
|
||||
|
||||
def test_an_unreadable_local_manifest_stops_the_scrape(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
folder = Path(tmp) / "np2kai"
|
||||
folder.mkdir()
|
||||
(folder / "component_manifest.json").write_text("{")
|
||||
with self.assertRaises(ValueError):
|
||||
retrodeck_scraper.Scraper(manifests_dir=tmp).fetch_requirements()
|
||||
|
||||
|
||||
class RommUnmappedSlug(unittest.TestCase):
|
||||
def test_an_unmapped_slug_fails_the_scrape(self) -> None:
|
||||
|
||||
Reference in new issue
Block a user