mirror of
https://github.com/esphome/esphome.git
synced 2025-02-26 23:08:13 +00:00
[core] make upload_program more generic (#8321)
This commit is contained in:
parent
9448737a92
commit
b7b2f3e61c
@ -2,6 +2,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import functools
|
import functools
|
||||||
|
import importlib
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@ -336,6 +337,13 @@ def check_permissions(port):
|
|||||||
|
|
||||||
|
|
||||||
def upload_program(config, args, host):
|
def upload_program(config, args, host):
|
||||||
|
try:
|
||||||
|
module = importlib.import_module("esphome.components." + CORE.target_platform)
|
||||||
|
if getattr(module, "upload_program")(config, args, host):
|
||||||
|
return 0
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
if get_port_type(host) == "SERIAL":
|
if get_port_type(host) == "SERIAL":
|
||||||
check_permissions(host)
|
check_permissions(host)
|
||||||
if CORE.target_platform in (PLATFORM_ESP32, PLATFORM_ESP8266):
|
if CORE.target_platform in (PLATFORM_ESP32, PLATFORM_ESP8266):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user