mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 15:38:11 +01:00
Cleaner handling of optional dependencies
This commit is contained in:
parent
afe442a1fa
commit
0c837fd1f7
2 changed files with 9 additions and 5 deletions
|
@ -49,11 +49,12 @@ from esphome.const import (
|
|||
)
|
||||
from esphome.core import CORE, coroutine_with_priority
|
||||
|
||||
DEPENDENCIES = ["network"]
|
||||
|
||||
# required for WifiSecureClient to have current time to validate the certificate
|
||||
if CORE.is_esp8266:
|
||||
DEPENDENCIES.append("time")
|
||||
def DEPENDENCIES():
|
||||
if CORE.is_esp8266:
|
||||
# required for WifiSecureClient to have current time to validate the certificate
|
||||
return ["network", "time"]
|
||||
return ["network"]
|
||||
|
||||
|
||||
def AUTO_LOAD():
|
||||
|
|
|
@ -70,7 +70,10 @@ class ComponentManifest:
|
|||
|
||||
@property
|
||||
def dependencies(self) -> list[str]:
|
||||
return getattr(self.module, "DEPENDENCIES", [])
|
||||
dep = getattr(self.module, "DEPENDENCIES", [])
|
||||
if callable(dep):
|
||||
return dep()
|
||||
return dep
|
||||
|
||||
@property
|
||||
def conflicts_with(self) -> list[str]:
|
||||
|
|
Loading…
Reference in a new issue