Merge remote-tracking branch 'upstream' into fix_rc5_recv

This commit is contained in:
Jon Krause 2024-10-05 13:57:23 +00:00
commit 3f9ddf8e95
3 changed files with 6 additions and 7 deletions

View file

@ -6,7 +6,7 @@ import logging
from pathlib import Path from pathlib import Path
import re import re
from magic import Magic import puremagic
from esphome import core, external_files from esphome import core, external_files
import esphome.codegen as cg import esphome.codegen as cg
@ -237,8 +237,8 @@ CONFIG_SCHEMA = cv.All(font.validate_pillow_installed, IMAGE_SCHEMA)
def load_svg_image(file: bytes, resize: tuple[int, int]): def load_svg_image(file: bytes, resize: tuple[int, int]):
# Local import only to allow "validate_pillow_installed" to run *before* importing it # Local imports only to allow "validate_pillow_installed" to run *before* importing it
# This import is only needed in case of SVG images; adding it # cairosvg is only needed in case of SVG images; adding it
# to the top would force configurations not using SVG to also have it # to the top would force configurations not using SVG to also have it
# installed for no reason. # installed for no reason.
from cairosvg import svg2png from cairosvg import svg2png
@ -281,8 +281,7 @@ async def to_code(config):
except Exception as e: except Exception as e:
raise core.EsphomeError(f"Could not load image file {path}: {e}") raise core.EsphomeError(f"Could not load image file {path}: {e}")
mime = Magic(mime=True) file_type = puremagic.from_string(file_contents, mime=True)
file_type = mime.from_buffer(file_contents)
resize = config.get(CONF_RESIZE) resize = config.get(CONF_RESIZE)
if "svg" in file_type: if "svg" in file_type:

View file

@ -15,7 +15,7 @@ click==8.1.7
esphome-dashboard==20240620.0 esphome-dashboard==20240620.0
aioesphomeapi==24.6.2 aioesphomeapi==24.6.2
zeroconf==0.132.2 zeroconf==0.132.2
python-magic==0.4.27 puremagic==1.27
ruamel.yaml==0.18.6 # dashboard_import ruamel.yaml==0.18.6 # dashboard_import
# esp-idf requires this, but doesn't bundle it by default # esp-idf requires this, but doesn't bundle it by default

View file

@ -98,7 +98,7 @@ def clang_options(idedata):
cmd.extend(["-isystem", directory]) cmd.extend(["-isystem", directory])
# add library include directories using -isystem to suppress their errors # add library include directories using -isystem to suppress their errors
for directory in set(idedata["includes"]["build"]): for directory in list(idedata["includes"]["build"]):
# skip our own directories, we add those later # skip our own directories, we add those later
if ( if (
not directory.startswith(f"{root_path}/") not directory.startswith(f"{root_path}/")