Make the ccache sentinel public; sibling modules pass it as a default

This commit is contained in:
J. Nick Koston
2026-08-21 20:55:07 -05:00
parent 587873a2da
commit 012b571a2e
+4 -4
View File
@@ -144,7 +144,7 @@ def check_and_install(framework_version: Version) -> InstalledPaths:
# Sentinel: "resolve for me" (None is a real value meaning disabled). # Sentinel: "resolve for me" (None is a real value meaning disabled).
# run_compile resolves once and threads the result so one build never pays # run_compile resolves once and threads the result so one build never pays
# the PATH scan and runnability probe three times. # the PATH scan and runnability probe three times.
_CCACHE_UNRESOLVED: Any = object() CCACHE_UNRESOLVED: Any = object()
def toolchain_tool(toolchain_path: Path, name: str) -> Path: def toolchain_tool(toolchain_path: Path, name: str) -> Path:
@@ -158,7 +158,7 @@ def toolchain_tool(toolchain_path: Path, name: str) -> Path:
def get_build_env( def get_build_env(
toolchain_path: Path, ccache: str | None = _CCACHE_UNRESOLVED toolchain_path: Path, ccache: str | None = CCACHE_UNRESOLVED
) -> dict[str, str]: ) -> dict[str, str]:
env = os.environ.copy() env = os.environ.copy()
# Drop empty entries: a trailing separator from an absent PATH would # Drop empty entries: a trailing separator from an absent PATH would
@@ -182,7 +182,7 @@ def ccache_path() -> str | None:
return resolve_ccache_path() return resolve_ccache_path()
def ccache_env(ccache: str | None = _CCACHE_UNRESOLVED) -> dict[str, str]: def ccache_env(ccache: str | None = CCACHE_UNRESOLVED) -> dict[str, str]:
"""Return ccache settings for the build subprocess (not os.environ). """Return ccache settings for the build subprocess (not os.environ).
Mirrors ``espidf.framework._ccache_env``: cache under the machine-global Mirrors ``espidf.framework._ccache_env``: cache under the machine-global
@@ -190,7 +190,7 @@ def ccache_env(ccache: str | None = _CCACHE_UNRESOLVED) -> dict[str, str]:
scoped to the build dir so devices share framework cache entries. Values scoped to the build dir so devices share framework cache entries. Values
the user already set in the environment are respected. the user already set in the environment are respected.
""" """
if ccache is _CCACHE_UNRESOLVED: if ccache is CCACHE_UNRESOLVED:
ccache = ccache_path() ccache = ccache_path()
if ccache is None: if ccache is None:
return {} return {}