mirror of
https://github.com/esphome/esphome.git
synced 2026-10-22 05:46:12 +00:00
Settle an empty version like a missing one
A dependency pinned to an empty string carries no version either, so it takes the deferred path and a registry miss is reported for its requester instead of being skipped quietly. A leftover docstring line in normalize_dependencies is removed.
This commit is contained in:
@@ -802,7 +802,6 @@ def normalize_dependencies(
|
||||
warning for entries that cannot be normalized.
|
||||
|
||||
Bare-name spellings carry no version; the walk settles them once the graph is known.
|
||||
framework libraries (Wire, SPI) that need no registry install.
|
||||
"""
|
||||
if dependencies is None:
|
||||
return []
|
||||
@@ -1426,7 +1425,8 @@ def convert_libraries(
|
||||
for dependency in normalize_dependencies(
|
||||
component.data.get("dependencies"), component.name
|
||||
):
|
||||
if "version" not in dependency:
|
||||
if not dependency.get("version"):
|
||||
# An empty version is as good as none; it settles the same way
|
||||
if not is_lib_ignored(
|
||||
dependency.get("name"), lib_ignore
|
||||
) and dependency_is_usable(
|
||||
|
||||
@@ -1565,6 +1565,26 @@ def test_registry_miss_resolves_again_as_a_git_source(tmp_path, monkeypatch) ->
|
||||
assert [d.name for d in emitted["C"].dependencies] == ["o/B"]
|
||||
|
||||
|
||||
def test_empty_version_is_settled_like_a_missing_one(
|
||||
tmp_path, monkeypatch, caplog: pytest.LogCaptureFixture
|
||||
) -> None:
|
||||
"""``{"Foo": ""}`` carries no version either, so it is matched, fetched by
|
||||
name or reported like a version-less entry rather than failing or vanishing."""
|
||||
asked = _patch_download_with_manifests(
|
||||
monkeypatch,
|
||||
tmp_path,
|
||||
{
|
||||
"esphome/A": {"name": "A", "dependencies": {"Foo": "", "Bar": ""}},
|
||||
"Bar": {"name": "Bar"},
|
||||
},
|
||||
unknown={"Foo"},
|
||||
)
|
||||
top = convert_libraries([Library("esphome/A", None, None)], _backend())
|
||||
assert [d.name for d in top[0].dependencies] == ["Bar"]
|
||||
assert (None, "Foo") in asked
|
||||
assert "Dependency Foo of esphome/A was not resolved; skipping" in caplog.text
|
||||
|
||||
|
||||
def test_bundled_name_is_satisfied_by_a_replacement_pulled_in_later(
|
||||
tmp_path, monkeypatch
|
||||
) -> None:
|
||||
|
||||
Reference in New Issue
Block a user