feat: complete S-52 resource contract
This commit is contained in:
@@ -155,7 +155,12 @@ def main() -> int:
|
||||
ap.add_argument("--chartsymbols", required=True, type=Path)
|
||||
ap.add_argument("--base-sprite-png", required=True, type=Path)
|
||||
ap.add_argument("--base-sprite-json", required=True, type=Path)
|
||||
ap.add_argument("--usage-audit", required=True, type=Path)
|
||||
ap.add_argument("--usage-audit", type=Path)
|
||||
ap.add_argument(
|
||||
"--all-patterns",
|
||||
action="store_true",
|
||||
help="Compile every vector S-52 pattern in chartsymbols.xml; production resource bundles should use this.",
|
||||
)
|
||||
ap.add_argument(
|
||||
"--usage-pbf",
|
||||
type=Path,
|
||||
@@ -174,7 +179,11 @@ def main() -> int:
|
||||
if patterns is None:
|
||||
raise SystemExit("missing patterns")
|
||||
by_name = {_text(n, "name"): n for n in patterns.findall("pattern")}
|
||||
usage = json.loads(args.usage_audit.read_text(encoding="utf-8"))
|
||||
usage = (
|
||||
json.loads(args.usage_audit.read_text(encoding="utf-8"))
|
||||
if args.usage_audit is not None
|
||||
else {}
|
||||
)
|
||||
lookup_used = {str(row[0]) for row in usage.get("pattern_resource_counts", [])}
|
||||
pbf_used: set[str] = set()
|
||||
if args.usage_pbf is not None:
|
||||
@@ -191,13 +200,12 @@ def main() -> int:
|
||||
if value not in (None, ""):
|
||||
pbf_used.add(str(value))
|
||||
used = sorted(lookup_used | pbf_used)
|
||||
selected = sorted(by_name) if args.all_patterns else used
|
||||
names = [
|
||||
name for name in used
|
||||
if name in by_name
|
||||
and by_name[name].find("vector") is not None
|
||||
and by_name[name].find("bitmap") is None
|
||||
name for name in selected
|
||||
if name in by_name and by_name[name].find("vector") is not None
|
||||
]
|
||||
missing = [name for name in used if name not in by_name]
|
||||
missing = [name for name in selected if name not in by_name]
|
||||
if missing:
|
||||
raise SystemExit(f"missing patterns: {missing}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user