mirror of
https://github.com/esphome/esphome.git
synced 2024-11-23 23:48: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
|
from esphome.core import CORE, coroutine_with_priority
|
||||||
|
|
||||||
DEPENDENCIES = ["network"]
|
|
||||||
|
|
||||||
# required for WifiSecureClient to have current time to validate the certificate
|
def DEPENDENCIES():
|
||||||
if CORE.is_esp8266:
|
if CORE.is_esp8266:
|
||||||
DEPENDENCIES.append("time")
|
# required for WifiSecureClient to have current time to validate the certificate
|
||||||
|
return ["network", "time"]
|
||||||
|
return ["network"]
|
||||||
|
|
||||||
|
|
||||||
def AUTO_LOAD():
|
def AUTO_LOAD():
|
||||||
|
|
|
@ -70,7 +70,10 @@ class ComponentManifest:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dependencies(self) -> list[str]:
|
def dependencies(self) -> list[str]:
|
||||||
return getattr(self.module, "DEPENDENCIES", [])
|
dep = getattr(self.module, "DEPENDENCIES", [])
|
||||||
|
if callable(dep):
|
||||||
|
return dep()
|
||||||
|
return dep
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def conflicts_with(self) -> list[str]:
|
def conflicts_with(self) -> list[str]:
|
||||||
|
|
Loading…
Reference in a new issue