mirror of
https://github.com/esphome/esphome.git
synced 2025-04-06 10:50:28 +01:00
fix python 3.9 build
This commit is contained in:
parent
1832349d8a
commit
cb7121383a
@ -1,18 +1,21 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
from typing import Final
|
from typing import Final
|
||||||
from rich.pretty import pprint
|
from rich.pretty import pprint
|
||||||
from bleak import BleakScanner, BleakClient
|
from bleak import BleakScanner, BleakClient
|
||||||
from bleak.exc import BleakDeviceNotFoundError, BleakDBusError
|
from bleak.exc import BleakDeviceNotFoundError, BleakDBusError
|
||||||
from smpclient.transport.ble import SMPBLETransport
|
|
||||||
from smpclient.transport.serial import SMPSerialTransport
|
if sys.version_info >= (3, 10):
|
||||||
from smpclient import SMPClient
|
from smpclient.transport.ble import SMPBLETransport
|
||||||
from smpclient.mcuboot import IMAGE_TLV, ImageInfo, TLVNotFound, MCUBootImageError
|
from smpclient.transport.serial import SMPSerialTransport
|
||||||
from smpclient.requests.image_management import ImageStatesRead, ImageStatesWrite
|
from smpclient import SMPClient
|
||||||
from smpclient.requests.os_management import ResetWrite
|
from smpclient.mcuboot import IMAGE_TLV, ImageInfo, TLVNotFound, MCUBootImageError
|
||||||
from smpclient.generics import error, success
|
from smpclient.requests.image_management import ImageStatesRead, ImageStatesWrite
|
||||||
from smp.exceptions import SMPBadStartDelimiter
|
from smpclient.requests.os_management import ResetWrite
|
||||||
|
from smpclient.generics import error, success
|
||||||
|
from smp.exceptions import SMPBadStartDelimiter
|
||||||
|
|
||||||
from esphome.espota2 import ProgressBar
|
from esphome.espota2 import ProgressBar
|
||||||
|
|
||||||
@ -85,6 +88,9 @@ def get_image_tlv_sha256(file):
|
|||||||
|
|
||||||
|
|
||||||
async def smpmgr_upload(config, host, firmware):
|
async def smpmgr_upload(config, host, firmware):
|
||||||
|
if sys.version_info < (3, 10):
|
||||||
|
_LOGGER.error("smpmgr requires at least python 3.10")
|
||||||
|
return 1
|
||||||
image_tlv_sha256 = get_image_tlv_sha256(firmware)
|
image_tlv_sha256 = get_image_tlv_sha256(firmware)
|
||||||
if image_tlv_sha256 is None:
|
if image_tlv_sha256 is None:
|
||||||
return 1
|
return 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user