[esp32] Fix idedata generation failing on unset ESPHOME_ARDUINO (#16925)

This commit is contained in:
Jonathan Swoboda
2026-06-14 17:48:43 -04:00
committed by GitHub
parent 5b7f8cf90d
commit 1e5771a3fa
6 changed files with 26 additions and 11 deletions

View File

@@ -1 +1 @@
442b8197be00e6fee6b1b64b07a0e3b3558188fddf1d9c510565da884687c451 a6ec18b82143e293ca6dee6947217f10a387ace99881a34b2c308ff627c8173c

View File

@@ -1,3 +1,5 @@
import os
Import("env") # noqa: F821 Import("env") # noqa: F821
# Remove custom_sdkconfig from the board config as it causes # Remove custom_sdkconfig from the board config as it causes
@@ -7,3 +9,8 @@ if "espidf.custom_sdkconfig" in board:
del board._manifest["espidf"]["custom_sdkconfig"] del board._manifest["espidf"]["custom_sdkconfig"]
if not board._manifest["espidf"]: if not board._manifest["espidf"]:
del board._manifest["espidf"] del board._manifest["espidf"]
# Referenced by rules in esphome/idf_component.yml; an unset env var is a
# fatal error there. Always 0: in PlatformIO builds arduino is not a managed
# IDF component.
os.environ.setdefault("ESPHOME_ARDUINO_COMPONENT", "0")

View File

@@ -162,7 +162,7 @@ def _setup_core(work_dir: Path, settings: _Settings) -> None:
# Gates arduino-only components in esphome/idf_component.yml (IDF reads it at # Gates arduino-only components in esphome/idf_component.yml (IDF reads it at
# reconfigure time). Set here -- before the manifest is written/reconfigured. # reconfigure time). Set here -- before the manifest is written/reconfigured.
os.environ["ESPHOME_ARDUINO"] = ( os.environ["ESPHOME_ARDUINO_COMPONENT"] = (
"1" if settings.target_framework == "arduino" else "0" "1" if settings.target_framework == "arduino" else "0"
) )

View File

@@ -109,4 +109,4 @@ dependencies:
git: https://github.com/FastLED/FastLED.git git: https://github.com/FastLED/FastLED.git
version: d44c800a9e876a8394caefc2ce4915dd96dac77b version: d44c800a9e876a8394caefc2ce4915dd96dac77b
rules: rules:
- if: "$ESPHOME_ARDUINO == 1" - if: "$ESPHOME_ARDUINO_COMPONENT == 1"

View File

@@ -141,7 +141,10 @@ extra_scripts = post:esphome/components/esp8266/post_build.py.script
; This are common settings for the ESP32 (all variants) using Arduino. ; This are common settings for the ESP32 (all variants) using Arduino.
[common:esp32-arduino] [common:esp32-arduino]
extends = common:arduino extends = common:arduino
platform = https://github.com/pioarduino/platform-espressif32.git platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.39/platform-espressif32.zip
platform_packages =
pioarduino/framework-arduinoespressif32@https://github.com/espressif/arduino-esp32/releases/download/3.3.9/esp32-core-3.3.9.tar.xz
pioarduino/framework-espidf@https://github.com/pioarduino/esp-idf/releases/download/v5.5.4/esp-idf-v5.5.4.tar.xz
framework = arduino, espidf ; Arduino as an ESP-IDF component framework = arduino, espidf ; Arduino as an ESP-IDF component
lib_deps = lib_deps =
@@ -168,12 +171,16 @@ build_flags =
-DAUDIO_NO_SD_FS ; i2s_audio -DAUDIO_NO_SD_FS ; i2s_audio
build_unflags = build_unflags =
${common.build_unflags} ${common.build_unflags}
extra_scripts = post:esphome/components/esp32/post_build.py.script extra_scripts =
pre:esphome/components/esp32/pre_build.py.script
post:esphome/components/esp32/post_build.py.script
; This are common settings for the ESP32 (all variants) using IDF. ; This are common settings for the ESP32 (all variants) using IDF.
[common:esp32-idf] [common:esp32-idf]
extends = common:idf extends = common:idf
platform = https://github.com/pioarduino/platform-espressif32.git platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.39/platform-espressif32.zip
platform_packages =
pioarduino/framework-espidf@https://github.com/pioarduino/esp-idf/releases/download/v5.5.4/esp-idf-v5.5.4.tar.xz
framework = espidf framework = espidf
lib_deps = lib_deps =
@@ -187,7 +194,9 @@ build_flags =
-DUSE_ESP32_FRAMEWORK_ESP_IDF -DUSE_ESP32_FRAMEWORK_ESP_IDF
build_unflags = build_unflags =
${common.build_unflags} ${common.build_unflags}
extra_scripts = post:esphome/components/esp32/post_build.py.script extra_scripts =
pre:esphome/components/esp32/pre_build.py.script
post:esphome/components/esp32/post_build.py.script
; These are common settings for the RP2040 using Arduino. ; These are common settings for the RP2040 using Arduino.
[common:rp2040-arduino] [common:rp2040-arduino]
@@ -271,7 +280,6 @@ build_unflags =
[env:esp32-arduino] [env:esp32-arduino]
extends = common:esp32-arduino extends = common:esp32-arduino
board = esp32dev board = esp32dev
board_build.partitions = huge_app.csv
build_flags = build_flags =
${common:esp32-arduino.build_flags} ${common:esp32-arduino.build_flags}
${flags:runtime.build_flags} ${flags:runtime.build_flags}

View File

@@ -56,11 +56,11 @@ def test_setup_core_sets_arduino_env(
target_framework: str, target_framework: str,
expected: str, expected: str,
) -> None: ) -> None:
"""_setup_core sets ESPHOME_ARDUINO, which gates arduino-only manifest deps.""" """_setup_core sets ESPHOME_ARDUINO_COMPONENT, which gates arduino-only manifest deps."""
# monkeypatch snapshots os.environ, so the env var _setup_core writes is # monkeypatch snapshots os.environ, so the env var _setup_core writes is
# restored after the test instead of leaking into later tests. # restored after the test instead of leaking into later tests.
monkeypatch.delenv("ESPHOME_ARDUINO", raising=False) monkeypatch.delenv("ESPHOME_ARDUINO_COMPONENT", raising=False)
_setup_core(tmp_path / "proj", _settings(target_framework=target_framework)) _setup_core(tmp_path / "proj", _settings(target_framework=target_framework))
assert os.environ["ESPHOME_ARDUINO"] == expected assert os.environ["ESPHOME_ARDUINO_COMPONENT"] == expected