mirror of
https://github.com/esphome/esphome.git
synced 2025-10-13 07:13:47 +01:00
preen
This commit is contained in:
@@ -48,6 +48,10 @@ PACKAGE_DEPENDENCIES = {
|
||||
# Add more package dependencies here as needed
|
||||
}
|
||||
|
||||
# Bus types that can be defined directly in config files
|
||||
# Components defining these directly cannot be grouped (they create unique bus IDs)
|
||||
DIRECT_BUS_TYPES = ("i2c", "spi", "uart", "modbus")
|
||||
|
||||
# Base bus components - these ARE the bus implementations and should not
|
||||
# be flagged as needing migration since they are the platform/base components
|
||||
BASE_BUS_COMPONENTS = {
|
||||
@@ -213,10 +217,10 @@ def analyze_yaml_file(yaml_file: Path) -> dict[str, Any]:
|
||||
result["has_extend_remove"] = _contains_extend_or_remove(data)
|
||||
|
||||
# Check if buses are defined directly (not via packages)
|
||||
# Components that define i2c, spi, or uart directly in test files
|
||||
# Components that define i2c, spi, uart, or modbus directly in test files
|
||||
# cannot be grouped because they create unique bus IDs
|
||||
if isinstance(data, dict):
|
||||
for bus_type in ("i2c", "spi", "uart"):
|
||||
for bus_type in DIRECT_BUS_TYPES:
|
||||
if bus_type in data:
|
||||
result["has_direct_bus_config"] = True
|
||||
break
|
||||
|
@@ -72,14 +72,17 @@ def extract_packages_from_yaml(data: dict) -> dict[str, str]:
|
||||
# Dictionary format: packages: {name: value}
|
||||
for name, value in packages_value.items():
|
||||
# Only include common bus packages, ignore component-specific ones
|
||||
if name in common_bus_packages:
|
||||
packages[name] = str(value)
|
||||
# Also track package dependencies (e.g., modbus includes uart)
|
||||
if name in PACKAGE_DEPENDENCIES:
|
||||
for dep in PACKAGE_DEPENDENCIES[name]:
|
||||
if dep in common_bus_packages:
|
||||
# Mark as included via dependency
|
||||
packages[f"_dep_{dep}"] = f"(included via {name})"
|
||||
if name not in common_bus_packages:
|
||||
continue
|
||||
packages[name] = str(value)
|
||||
# Also track package dependencies (e.g., modbus includes uart)
|
||||
if name not in PACKAGE_DEPENDENCIES:
|
||||
continue
|
||||
for dep in PACKAGE_DEPENDENCIES[name]:
|
||||
if dep not in common_bus_packages:
|
||||
continue
|
||||
# Mark as included via dependency
|
||||
packages[f"_dep_{dep}"] = f"(included via {name})"
|
||||
|
||||
return packages
|
||||
|
||||
|
Reference in New Issue
Block a user