From 849463b8a5c20c15f99b54d3bbb484367c1afd0e Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 15 Apr 2026 16:47:44 -1000 Subject: [PATCH] libretiny: treat already-patched .ld as success on incremental rebuilds The idempotency check in _inject_keep returns content unchanged when the marker is already present, so patched stayed 0 and the fail-hard RuntimeError fired on every incremental rebuild after the first. Check for the marker before attempting to patch and count it as success. --- esphome/components/libretiny/patch_linker.py.script | 3 +++ 1 file changed, 3 insertions(+) diff --git a/esphome/components/libretiny/patch_linker.py.script b/esphome/components/libretiny/patch_linker.py.script index c490b10e9b..282a31d3f2 100644 --- a/esphome/components/libretiny/patch_linker.py.script +++ b/esphome/components/libretiny/patch_linker.py.script @@ -86,6 +86,9 @@ def _pre_link(target, source, env): path = os.path.join(build_dir, name) with open(path, "r", encoding="utf-8") as fh: original = fh.read() + if _MARKER in original: + patched += 1 + continue content = original for fn in _patchers: content = fn(content)