mirror of
https://github.com/esphome/esphome.git
synced 2026-08-27 00:18:32 +00:00
Drop the dead name injection and pass board_mcu lazily
This commit is contained in:
@@ -142,7 +142,7 @@ def _bundled_library(framework_path: Path, name: str) -> ArduinoLibrary:
|
||||
else:
|
||||
manifest = lib_dir / "library.properties"
|
||||
data = parse_library_properties(manifest) if manifest.is_file() else {}
|
||||
return _library_info(name, lib_dir, {"name": name, **data})
|
||||
return _library_info(name, lib_dir, data)
|
||||
|
||||
|
||||
def resolve_libraries(
|
||||
@@ -219,7 +219,9 @@ def resolve_libraries(
|
||||
bundled.append(_bundled_library(framework_path, name))
|
||||
|
||||
def _emit(component: ConvertedLibrary) -> None:
|
||||
apply_extra_script(component, board_mcu=board_mcu, pio_platform=pio_platform)
|
||||
apply_extra_script(
|
||||
component, board_mcu=lambda: board_mcu, pio_platform=pio_platform
|
||||
)
|
||||
converted.append(
|
||||
_library_info(
|
||||
component.get_require_name(), component.source_dir, component.data
|
||||
|
||||
@@ -214,9 +214,11 @@ def test_resolve_libraries_external_and_bundled_deps(tmp_path: Path) -> None:
|
||||
cache_key="arduino8266",
|
||||
)
|
||||
|
||||
mock_extra.assert_called_once_with(
|
||||
converted, board_mcu="esp8266", pio_platform="espressif8266"
|
||||
)
|
||||
mock_extra.assert_called_once()
|
||||
assert mock_extra.call_args.args == (converted,)
|
||||
assert mock_extra.call_args.kwargs["pio_platform"] == "espressif8266"
|
||||
# board_mcu is passed lazily, as the shared helper requires
|
||||
assert mock_extra.call_args.kwargs["board_mcu"]() == "esp8266"
|
||||
assert [lib.name for lib in libs] == [
|
||||
"Wire",
|
||||
"esp32async__ESPAsyncWebServer",
|
||||
|
||||
Reference in New Issue
Block a user