1
0
mirror of https://github.com/esphome/esphome.git synced 2025-04-06 19:00:29 +01:00

fix python 3.9 build

This commit is contained in:
Tomasz Duda 2024-05-05 23:45:31 +02:00
parent 1832349d8a
commit cb7121383a

View File

@ -1,10 +1,13 @@
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
if sys.version_info >= (3, 10):
from smpclient.transport.ble import SMPBLETransport from smpclient.transport.ble import SMPBLETransport
from smpclient.transport.serial import SMPSerialTransport from smpclient.transport.serial import SMPSerialTransport
from smpclient import SMPClient from smpclient import SMPClient
@ -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