mirror of
https://github.com/esphome/esphome.git
synced 2026-10-06 10:56:43 +00:00
Keep the flags helper private and make the identity guard explicit
This commit is contained in:
@@ -1245,18 +1245,18 @@ def write_project(paths: InstalledPaths, ccache: str | None) -> bool:
|
||||
pch_text = pch_header_text(pch_includes)
|
||||
# The .sum exists only for CCACHE_PCH_EXTSUM; ninja's depfile
|
||||
# handles staleness
|
||||
checksum = (
|
||||
pch_identity(
|
||||
identity_ok = True
|
||||
checksum = None
|
||||
if ccache:
|
||||
checksum = pch_identity(
|
||||
cxxflags,
|
||||
src_dir,
|
||||
pch_includes,
|
||||
(str(paths.framework), str(paths.toolchain)),
|
||||
)
|
||||
if ccache
|
||||
else None
|
||||
)
|
||||
# Identity unknown under ccache: pch_identity warned and degraded
|
||||
if not ccache or checksum is not None:
|
||||
# Identity unknown: pch_identity warned and degraded
|
||||
identity_ok = checksum is not None
|
||||
if identity_ok:
|
||||
log_pch_in_use()
|
||||
write_file_if_changed(pch_header, pch_text)
|
||||
sum_path = build_dir / f"{PCH_HEADER_NAME}.gch.sum"
|
||||
|
||||
@@ -389,7 +389,7 @@ def pch_compile_command(
|
||||
return [*args, "-x", "c++-header", "-c", str(header), "-o", str(gch)], cmd_dir
|
||||
|
||||
|
||||
def flags_identity(tokens: Iterable[str]) -> str:
|
||||
def _flags_identity(tokens: Iterable[str]) -> str:
|
||||
"""Flag string normalized for digest use: strip like ccache's rewriting
|
||||
(user CCACHE_BASEDIR wins); the raw build path covers unresolved
|
||||
(symlinked) spellings."""
|
||||
@@ -420,7 +420,7 @@ def pch_identity(
|
||||
# The closure is sorted, so root order only enters via the text
|
||||
pch_header_text(include_headers),
|
||||
*extra,
|
||||
flags_identity(tokens),
|
||||
_flags_identity(tokens),
|
||||
),
|
||||
)
|
||||
except (OSError, UnicodeError) as err:
|
||||
|
||||
Reference in New Issue
Block a user