MCPcopy Create free account
hub / github.com/astral-sh/python-build-standalone / parse_labels

Function parse_labels

ci-matrix.py:43–76  ·  view source on GitHub ↗

Parse labels into a dict of category -> set of values.

(labels: str | None)

Source from the content-addressed store, hash-verified

41
42
43def parse_labels(labels: str | None) -> dict[str, set[str]]:
44 """Parse labels into a dict of category -> set of values."""
45 if not labels:
46 return {}
47
48 result: dict[str, set[str]] = {
49 "platform": set(),
50 "python": set(),
51 "build": set(),
52 "arch": set(),
53 "libc": set(),
54 "directives": set(),
55 }
56
57 for label in labels.split(","):
58 label = label.strip()
59
60 # Handle special labels
61 if label in CI_EXTRA_SKIP_LABELS:
62 result["directives"].add("skip")
63 continue
64
65 if not label or ":" not in label:
66 continue
67
68 category, value = label.split(":", 1)
69
70 if category == "ci":
71 category = "directives"
72
73 if category in result:
74 result[category].add(value)
75
76 return result
77
78
79def get_all_build_options(ci_config: dict[str, Any], target_triple: str) -> list[str]:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected