diff --git a/esphome/components/api/__init__.py b/esphome/components/api/__init__.py index 4a157f9e01..31ba63ec4d 100644 --- a/esphome/components/api/__init__.py +++ b/esphome/components/api/__init__.py @@ -850,7 +850,7 @@ async def api_connected_to_code( # user_services.cpp is only needed when user defined actions exist; the # frame helpers are fully #ifdef'd on the protocol defines set in to_code # (both are set when encryption is configured without a key). -_filter_define_source_files = filter_source_files_from_defines( +_define_filter = filter_source_files_from_defines( { "user_services.cpp": "USE_API_USER_DEFINED_ACTIONS", "api_frame_helper_noise.cpp": "USE_API_NOISE", @@ -860,7 +860,7 @@ _filter_define_source_files = filter_source_files_from_defines( def FILTER_SOURCE_FILES() -> list[str]: - files_to_filter = _filter_define_source_files() + files_to_filter = _define_filter() # api_pb2_dump.cpp is only needed when HAS_PROTO_MESSAGE_DUMP is defined # This is a particularly large file that still needs to be opened and read diff --git a/esphome/components/ethernet/__init__.py b/esphome/components/ethernet/__init__.py index 84fdc9d03f..a44a609d3c 100644 --- a/esphome/components/ethernet/__init__.py +++ b/esphome/components/ethernet/__init__.py @@ -846,7 +846,8 @@ def _filter_source_files() -> list[str]: # to avoid shadowing. Native IDF builds always need the custom driver. if cv.Version(5, 4, 2) <= idf_version() < cv.Version(6, 0, 0): excluded.append("esp_eth_phy_jl1101.c") - return excluded + # The platform and define filters can both name the same file + return list(dict.fromkeys(excluded)) FILTER_SOURCE_FILES = _filter_source_files