Merge branch 'esp8266-native-ninja-emission' into esp8266-arduino-toolchain

This commit is contained in:
J. Nick Koston
2026-08-22 16:41:54 -05:00
3 changed files with 24 additions and 4 deletions
+4 -2
View File
@@ -740,8 +740,10 @@ def _prefetch_idf_tool_archives(
", ".join(entry["name"] for entry in entries),
)
# tools.json always carries sizes; should one be missing the combined
# bar could not be trusted, so show no bar at all (per-file bars from
# several threads would interleave) rather than a wrong one.
# bar could not be trusted, so show no bar at all rather than a wrong
# one. Unlike the library prefetch there is no sequential fallback:
# per-file bars from several threads would interleave, and skipping
# the prefetch would lose the resume workaround for #17703.
sizes = [entry.get("size") or 0 for entry in entries]
progress = BatchDownloadProgress(
"Downloading ESP-IDF tools", sum(sizes) if all(sizes) else 0
+2 -2
View File
@@ -946,8 +946,8 @@ def _warn_unsatisfied_versionless(
_DOWNLOAD_WORKERS = 4
def _content_lengths(urls: list[str]) -> list[int]:
"""Content-Length per URL via HEAD requests; 0 for any that fail."""
def _content_lengths(urls: list[str]) -> list[int | None]:
"""Content-Length per URL via HEAD requests; None when unknown."""
import requests
def head(url: str) -> int | None:
@@ -663,6 +663,24 @@ def test_prefetch_wave_downloads_registry_archives_in_parallel(
]
def test_prefetch_wave_unknown_size_falls_back_to_sequential(
setup_core, monkeypatch: pytest.MonkeyPatch
) -> None:
"""Any unknown HEAD size skips the parallel prefetch entirely so the
sequential downloads keep their per-file bars."""
def fail_download(self, force=False, salt="", namespace="", progress=None):
raise AssertionError("prefetched despite unknown size")
monkeypatch.setattr(ConvertedLibrary, "download", fail_download)
monkeypatch.setattr(lib, "_content_lengths", lambda urls: [1, None])
wave = [
("a", ConvertedLibrary("a", "1.0", URLSource("https://x/a.tar.gz"))),
("b", ConvertedLibrary("b", "1.0", URLSource("https://x/b.tar.gz"))),
]
lib._prefetch_wave(wave, "", "idf")
def test_content_lengths_head_requests(monkeypatch: pytest.MonkeyPatch) -> None:
"""Sizes come from HEAD Content-Length; a failing HEAD reads as 0 so
the combined bar is skipped rather than wrong."""