mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Migrate dependencies loader to use async_get_integrations (#110690)
This commit is contained in:
parent
9cf45882a7
commit
f7b9b0da0e
@ -1140,16 +1140,21 @@ async def _async_component_dependencies(
|
|||||||
integration: Integration,
|
integration: Integration,
|
||||||
) -> set[str]:
|
) -> set[str]:
|
||||||
"""Get component dependencies."""
|
"""Get component dependencies."""
|
||||||
loading = set()
|
loading: set[str] = set()
|
||||||
loaded = set()
|
loaded: set[str] = set()
|
||||||
|
|
||||||
async def component_dependencies_impl(integration: Integration) -> None:
|
async def component_dependencies_impl(integration: Integration) -> None:
|
||||||
"""Recursively get component dependencies."""
|
"""Recursively get component dependencies."""
|
||||||
domain = integration.domain
|
domain = integration.domain
|
||||||
loading.add(domain)
|
if not (dependencies := integration.dependencies):
|
||||||
|
loaded.add(domain)
|
||||||
|
return
|
||||||
|
|
||||||
for dependency_domain in integration.dependencies:
|
loading.add(domain)
|
||||||
dep_integration = await async_get_integration(hass, dependency_domain)
|
dep_integrations = await async_get_integrations(hass, dependencies)
|
||||||
|
for dependency_domain, dep_integration in dep_integrations.items():
|
||||||
|
if isinstance(dep_integration, Exception):
|
||||||
|
raise dep_integration
|
||||||
|
|
||||||
# If we are already loading it, we have a circular dependency.
|
# If we are already loading it, we have a circular dependency.
|
||||||
# We have to check it here to make sure that every integration that
|
# We have to check it here to make sure that every integration that
|
||||||
@ -1166,7 +1171,6 @@ async def _async_component_dependencies(
|
|||||||
raise CircularDependency(dependency_domain, domain)
|
raise CircularDependency(dependency_domain, domain)
|
||||||
|
|
||||||
await component_dependencies_impl(dep_integration)
|
await component_dependencies_impl(dep_integration)
|
||||||
|
|
||||||
loading.remove(domain)
|
loading.remove(domain)
|
||||||
loaded.add(domain)
|
loaded.add(domain)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user