mirror of
https://github.com/esphome/esphome.git
synced 2026-08-22 22:26:21 +00:00
Merge branch 'esp8266-native-build-spec' into esp8266-native-ninja-emission
This commit is contained in:
@@ -740,8 +740,10 @@ def _prefetch_idf_tool_archives(
|
|||||||
", ".join(entry["name"] for entry in entries),
|
", ".join(entry["name"] for entry in entries),
|
||||||
)
|
)
|
||||||
# tools.json always carries sizes; should one be missing the combined
|
# 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
|
# bar could not be trusted, so show no bar at all rather than a wrong
|
||||||
# several threads would interleave) rather than a wrong one.
|
# 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]
|
sizes = [entry.get("size") or 0 for entry in entries]
|
||||||
progress = BatchDownloadProgress(
|
progress = BatchDownloadProgress(
|
||||||
"Downloading ESP-IDF tools", sum(sizes) if all(sizes) else 0
|
"Downloading ESP-IDF tools", sum(sizes) if all(sizes) else 0
|
||||||
|
|||||||
@@ -946,8 +946,8 @@ def _warn_unsatisfied_versionless(
|
|||||||
_DOWNLOAD_WORKERS = 4
|
_DOWNLOAD_WORKERS = 4
|
||||||
|
|
||||||
|
|
||||||
def _content_lengths(urls: list[str]) -> list[int]:
|
def _content_lengths(urls: list[str]) -> list[int | None]:
|
||||||
"""Content-Length per URL via HEAD requests; 0 for any that fail."""
|
"""Content-Length per URL via HEAD requests; None when unknown."""
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
def head(url: str) -> int | None:
|
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:
|
def test_content_lengths_head_requests(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||||
"""Sizes come from HEAD Content-Length; a failing HEAD reads as 0 so
|
"""Sizes come from HEAD Content-Length; a failing HEAD reads as 0 so
|
||||||
the combined bar is skipped rather than wrong."""
|
the combined bar is skipped rather than wrong."""
|
||||||
|
|||||||
Reference in New Issue
Block a user