Drop the dead name injection and pass board_mcu lazily

This commit is contained in:
J. Nick Koston
2026-08-20 15:46:39 -05:00
parent e032f37e04
commit d4e3603a19
2 changed files with 9 additions and 5 deletions
+4 -2
View File
@@ -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
+5 -3
View File
@@ -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",