mirror of
https://github.com/esphome/esphome.git
synced 2025-03-15 15:18:16 +00:00
clean up
This commit is contained in:
parent
9593350596
commit
8158659787
@ -194,10 +194,7 @@ PRELOAD_CONFIG_SCHEMA = cv.Schema(
|
|||||||
def _is_target_platform(name):
|
def _is_target_platform(name):
|
||||||
try:
|
try:
|
||||||
from esphome.loader import get_component
|
from esphome.loader import get_component
|
||||||
|
if get_component(name, True).is_target_platform:
|
||||||
# some components cannot be loaded without platform
|
|
||||||
component = get_component(name, True)
|
|
||||||
if component.is_target_platform:
|
|
||||||
return True
|
return True
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
@ -206,15 +203,12 @@ def _is_target_platform(name):
|
|||||||
|
|
||||||
def _supported_target_platforms():
|
def _supported_target_platforms():
|
||||||
target_platforms = []
|
target_platforms = []
|
||||||
root = Path(__file__).parent.parent
|
root = Path(__file__).parents[1]
|
||||||
components_dir = root / "components"
|
for path in (root / "components").iterdir():
|
||||||
|
|
||||||
for path in components_dir.iterdir():
|
|
||||||
if not path.is_dir():
|
if not path.is_dir():
|
||||||
continue
|
continue
|
||||||
if not (path / "__init__.py").is_file():
|
if not (path / "__init__.py").is_file():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
name = path.name
|
name = path.name
|
||||||
if _is_target_platform(name):
|
if _is_target_platform(name):
|
||||||
target_platforms += [name]
|
target_platforms += [name]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user