Resolve the ccache path on every call, matching the espidf backend

functools.cache froze the ESPHOME_CCACHE_ENABLE/PATH decision for the
process lifetime, which a long-lived host like device-builder never
restarts, and forced a cache_clear fixture in the tests. The docstring
and test now pin the uncached delegation.
This commit is contained in:
J. Nick Koston
2026-08-21 15:33:51 -05:00
parent 33aea420ac
commit cbf1241401
2 changed files with 11 additions and 8 deletions
+6 -3
View File
@@ -18,7 +18,6 @@ toolchain has always used, so the bits are identical); the
from __future__ import annotations
import functools
import os
from pathlib import Path
from typing import NamedTuple
@@ -155,9 +154,13 @@ def get_build_env(toolchain_path: Path) -> dict[str, str]:
return env
@functools.cache
def ccache_path() -> str | None:
"""The ccache binary to prefix compiles with, or None when disabled."""
"""The ccache binary to prefix compiles with, or None when disabled.
Deliberately uncached (matching espidf): the decision reads
ESPHOME_CCACHE_ENABLE and PATH, which can change between builds in a
long-lived host process.
"""
return resolve_ccache_path()