fix: name a target only where it narrows the pack

This commit is contained in:
Abdessamad Derraz committed 2026-10-18 19:44:47 +02:00
1 parent 9c154a29b9
commit 4246d9ec66
3 files changed
+32 -2

No files matched your search

+11
View File
@@ -511,6 +511,17 @@ def _target_alias_index(targets: dict, overrides: dict) -> dict[str, str]:
return alias_index
def platform_files_target(platform: str, target: str, platforms_dir: str = "platforms") -> bool:
"""Whether the platform's targets file knows this target, by any alias."""
targets_dir = os.path.join(platforms_dir, "targets")
target_file = os.path.join(targets_dir, f"{platform}.yml")
if not os.path.exists(target_file):
return False
with open(target_file) as f:
targets = (yaml_load(f) or {}).get("targets", {})
return target in _target_alias_index(targets, _target_overrides(platform, targets_dir))
def canonical_target_name(
platforms: list[str], target: str, platforms_dir: str = "platforms"
) -> str: