api/modules: remove redundant localModules

This commit is contained in:
Johannes Kirschbauer
2025-07-13 11:52:13 +02:00
parent 38eb690bc5
commit 5f19e76cd0
4 changed files with 7 additions and 16 deletions

View File

@@ -29,8 +29,7 @@ def test_list_modules(test_flake_with_core: FlakeForTest) -> None:
base_path = test_flake_with_core.path
modules_info = list_modules(str(base_path))
assert "localModules" in modules_info
assert "modulesPerSource" in modules_info
assert "modules" in modules_info
@pytest.mark.impure

View File

@@ -154,22 +154,19 @@ class ModuleInfo(TypedDict):
roles: dict[str, None]
class ModuleLists(TypedDict):
modulesPerSource: dict[str, dict[str, ModuleInfo]]
localModules: dict[str, ModuleInfo]
class ModuleList(TypedDict):
modules: dict[str, dict[str, ModuleInfo]]
@API.register
def list_modules(base_path: str) -> ModuleLists:
def list_modules(base_path: str) -> ModuleList:
"""
Show information about a module
"""
flake = Flake(base_path)
modules = flake.select(
"clanInternals.inventoryClass.{?modulesPerSource,?localModules}"
)
modules = flake.select("clanInternals.inventoryClass.modulesPerSource")
return modules
return ModuleList({"modules": modules})
@dataclass

View File

@@ -208,7 +208,7 @@ def test_clan_create_api(
modules = list_modules(str(clan_dir_flake.path))
assert (
modules["modulesPerSource"]["clan-core"]["admin"]["manifest"]["name"]
modules["modules"]["clan-core"]["admin"]["manifest"]["name"]
== "clan-core/admin"
)