mirror of
https://github.com/esphome/esphome.git
synced 2026-09-11 15:27:33 +00:00
Merge branch 'esp8266-native-pch' into esp32-idf-pch
This commit is contained in:
@@ -99,10 +99,7 @@ def effective_ccache_basedir() -> str:
|
||||
from esphome.core import CORE
|
||||
|
||||
raw = os.environ.get("CCACHE_BASEDIR")
|
||||
if raw is not None:
|
||||
# A degenerate value ("", "/", relative) must not be used for
|
||||
# substring stripping; fall back to the resolved build path
|
||||
if len(Path(raw).parts) > 1:
|
||||
return raw
|
||||
return str(Path(CORE.build_path).resolve())
|
||||
if raw is not None and Path(raw).is_absolute() and len(Path(raw).parts) > 1:
|
||||
return raw
|
||||
# Unset or degenerate ("", "/", relative): fall back to the build path
|
||||
return str(Path(CORE.build_path).resolve())
|
||||
|
||||
@@ -130,6 +130,6 @@ def test_effective_ccache_basedir_prefers_user_value(tmp_path: Path) -> None:
|
||||
with patch.dict(os.environ, {}, clear=True):
|
||||
assert ccache.effective_ccache_basedir() == str(tmp_path.resolve())
|
||||
# Degenerate values would strip substrings ccache never rewrites
|
||||
for bad in ("", "/"):
|
||||
for bad in ("", "/", "a/b"):
|
||||
with patch.dict(os.environ, {"CCACHE_BASEDIR": bad}, clear=True):
|
||||
assert ccache.effective_ccache_basedir() == str(tmp_path.resolve())
|
||||
|
||||
Reference in New Issue
Block a user