mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-25 02:57:52 -06:00
fix: target scrapers exit on errors like scrapers
This commit is contained in:
1 parent
83fdc97edd
commit
79c3c02885
4 files changed
+26
-42
No files matched your search
@@ -16,7 +16,7 @@ from model.sourcerevision import platform_revision
|
||||
|
||||
# Every target scraper reads the network through the platform scrapers'
|
||||
# helpers: one retry policy, one size cap, one token rule.
|
||||
from ..base_scraper import fetch_text, forge_headers
|
||||
from ..base_scraper import exit_on_scrape_error, fetch_text, forge_headers
|
||||
|
||||
__all__ = ["BaseTargetScraper", "discover_target_scrapers", "fetch_text", "forge_headers",
|
||||
"target_cli"]
|
||||
@@ -66,8 +66,11 @@ def target_cli(scraper_class: type[BaseTargetScraper], description: str, unit: s
|
||||
parser.add_argument("--output", "-o", help="Output YAML file")
|
||||
args = parser.parse_args()
|
||||
|
||||
scraper = scraper_class()
|
||||
data = scraper.fetch_targets()
|
||||
try:
|
||||
scraper = scraper_class()
|
||||
data = scraper.fetch_targets()
|
||||
except (OSError, ValueError, RuntimeError) as e:
|
||||
exit_on_scrape_error(e)
|
||||
if args.dry_run:
|
||||
for name, info in data["targets"].items():
|
||||
print(f" {name} ({info['architecture']}): {len(info['cores'])} {unit}")
|
||||
|
||||
@@ -20,14 +20,11 @@ Buildbot structure varies by platform:
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import re
|
||||
import sys
|
||||
from datetime import datetime, timezone
|
||||
|
||||
import yaml
|
||||
|
||||
from . import BaseTargetScraper, fetch_text
|
||||
from . import BaseTargetScraper, fetch_text, target_cli
|
||||
|
||||
PLATFORM_NAME = "retroarch"
|
||||
|
||||
@@ -165,36 +162,7 @@ class Scraper(BaseTargetScraper):
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(
|
||||
allow_abbrev=False,
|
||||
description="Scrape RetroArch buildbot nightly targets"
|
||||
)
|
||||
parser.add_argument("--dry-run", action="store_true", help="Show target summary")
|
||||
parser.add_argument("--output", "-o", help="Output YAML file")
|
||||
args = parser.parse_args()
|
||||
|
||||
scraper = Scraper()
|
||||
data = scraper.fetch_targets()
|
||||
|
||||
total_cores = sum(len(t["cores"]) for t in data["targets"].values())
|
||||
print(
|
||||
f"\n{len(data['targets'])} targets, {total_cores} total core entries",
|
||||
file=sys.stderr,
|
||||
)
|
||||
|
||||
if args.dry_run:
|
||||
for name, info in sorted(data["targets"].items()):
|
||||
print(
|
||||
f" {name:30s} {info['architecture']:10s} {len(info['cores']):>4d} cores"
|
||||
)
|
||||
return
|
||||
|
||||
if args.output:
|
||||
scraper.write_output(data, args.output)
|
||||
print(f"Written to {args.output}")
|
||||
return
|
||||
|
||||
print(yaml.dump(data, default_flow_style=False, sort_keys=False))
|
||||
target_cli(Scraper, "Scrape RetroArch buildbot nightly targets")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user