From 476ec16a3d178ddf419b8201f45c6f6e6610b78a Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 23 Aug 2026 18:58:48 -0500 Subject: [PATCH] Split the AS and ASPP source kinds to match SCons --- esphome/platformio/library.py | 13 +++++++------ tests/unit_tests/test_platformio_library.py | 8 ++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/esphome/platformio/library.py b/esphome/platformio/library.py index 3cee9684e7..521337ff84 100644 --- a/esphome/platformio/library.py +++ b/esphome/platformio/library.py @@ -55,8 +55,9 @@ DEFAULT_BUILD_SRC_DIRS = "src" DEFAULT_BUILD_INCLUDE_DIR = "include" DEFAULT_BUILD_FLAGS = [] # Suffix -> compiler kind (PlatformIO's CSUFFIXES/CXXSUFFIXES/ASSUFFIXES); -# "asm" merges SCons's AS and ASPP sets. Per CXXSUFFIXES .C/.C++ are C++ -# here, even where SCons demotes .C on case-insensitive filesystems. +# "aspp" is SCons's preprocessed-assembly set, "asm" its plain-assembler +# set (no preprocessor, defines, or includes). Per CXXSUFFIXES .C/.C++ are +# C++ here, even where SCons demotes .C on case-insensitive filesystems. SOURCE_KIND_FOR_SUFFIX: dict[str, str] = { ".c": "c", ".cpp": "cxx", @@ -65,10 +66,10 @@ SOURCE_KIND_FOR_SUFFIX: dict[str, str] = { ".c++": "cxx", ".C": "cxx", ".C++": "cxx", - ".S": "asm", - ".spp": "asm", - ".SPP": "asm", - ".sx": "asm", + ".S": "aspp", + ".spp": "aspp", + ".SPP": "aspp", + ".sx": "aspp", ".s": "asm", ".asm": "asm", ".ASM": "asm", diff --git a/tests/unit_tests/test_platformio_library.py b/tests/unit_tests/test_platformio_library.py index ff7e027616..a565229bb1 100644 --- a/tests/unit_tests/test_platformio_library.py +++ b/tests/unit_tests/test_platformio_library.py @@ -905,11 +905,11 @@ def test_split_flag_entry_non_string_is_clean() -> None: def test_source_kind_map_shape() -> None: - """The kind values the native compile rules key on, and the deliberate - AS/ASPP merge (.s and .S both map to asm).""" + """The kind values the native compile rules key on; the AS/ASPP split + matches SCons (.S preprocessed, .s plain assembler).""" - assert set(SOURCE_KIND_FOR_SUFFIX.values()) == {"c", "cxx", "asm"} + assert set(SOURCE_KIND_FOR_SUFFIX.values()) == {"c", "cxx", "asm", "aspp"} assert SOURCE_KIND_FOR_SUFFIX[".s"] == "asm" - assert SOURCE_KIND_FOR_SUFFIX[".S"] == "asm" + assert SOURCE_KIND_FOR_SUFFIX[".S"] == "aspp" assert SOURCE_KIND_FOR_SUFFIX[".c"] == "c" assert SOURCE_KIND_FOR_SUFFIX[".cpp"] == "cxx"