[script] Fix duplicate import in build_codeowners.py (#17543)

This commit is contained in:
Clyde Stubbs
2026-07-13 10:16:53 -04:00
committed by GitHub
parent d78cb09b17
commit 5e3e2f82c9
+7
View File
@@ -61,6 +61,13 @@ for path in components_dir.iterdir():
codeowners[f"esphome/components/{name}/*"].extend(comp.codeowners) codeowners[f"esphome/components/{name}/*"].extend(comp.codeowners)
for platform_path in path.iterdir(): for platform_path in path.iterdir():
if platform_path.name == "__init__.py":
# `import pkg.__init__` is valid but distinct from `import pkg`: it re-executes
# the component's __init__.py as a second, separate module. That's harmless for
# components whose top-level code is idempotent, but not guaranteed in general
# (e.g. code that registers into a global registry with a duplicate check), so
# never treat __init__.py itself as a platform candidate.
continue
platform_name = platform_path.stem platform_name = platform_path.stem
platform = get_platform(platform_name, name) platform = get_platform(platform_name, name)
if platform is None: if platform is None: