refactor: split this round's fixes into small helpers

This commit is contained in:
Abdessamad Derraz committed 2026-10-06 11:16:06 +02:00
1 parent 6748982d94
commit eb8c7e5267
15 files changed
+218 -157

No files matched your search

+19 -12
View File
@@ -2456,6 +2456,24 @@ def _refuse_for_all_variants(args, parser) -> None:
parser.error(f"{flag} is incompatible with --verify-packs")
def _refuse_refresh_data(args, parser) -> None:
"""Only the platform pack path refreshes the data directories.
Elsewhere the cache on disk was packed as it stood, and --offline wins
over the refresh without a word.
"""
if not args.refresh_data:
return
for flag, on in (
("--offline", args.offline),
("--emulator", args.emulator),
("--system", args.system and not (args.platform or args.all)),
("--from-md5", args.from_md5 or args.from_md5_file),
):
if on:
parser.error(f"--refresh-data is incompatible with {flag}")
def _refuse_unapplied_flags(args, parser) -> None:
"""Refuse every flag the requested mode would not apply.
@@ -2475,18 +2493,7 @@ def _refuse_unapplied_flags(args, parser) -> None:
parser.error("--region is incompatible with --manifest-targets")
if args.one_per_slot and args.manifest_targets:
parser.error("--one-per-slot is incompatible with --manifest-targets")
# Only the platform pack path refreshes the data directories; elsewhere
# the cache on disk was packed as it stood.
if args.refresh_data:
if args.offline:
parser.error("--refresh-data is incompatible with --offline")
for flag, on in (
("--emulator", args.emulator),
("--system", args.system and not (args.platform or args.all)),
("--from-md5", args.from_md5 or args.from_md5_file),
):
if on:
parser.error(f"--refresh-data is incompatible with {flag}")
_refuse_refresh_data(args, parser)
_refuse_for_all_variants(args, parser)
mode = next(