]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Use list type for Images= and Dependencies= instead of tuple
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 8 Jul 2024 13:40:25 +0000 (15:40 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 8 Jul 2024 13:42:03 +0000 (15:42 +0200)
Also remove the unneeded JSON transformer/parser.

mkosi/config.py
tests/test_json.py

index f8abd99d53a299f74bb850f3296d63eb6245e73e..c8fbe5205bd6d80df235e3372aaba9e0ee1db15d 100644 (file)
@@ -1347,8 +1347,8 @@ class Config:
     profile: Optional[str]
     include: list[Path]
     initrd_include: list[Path]
-    images: tuple[str, ...]
-    dependencies: tuple[str, ...]
+    images: list[str]
+    dependencies: list[str]
     minimum_version: Optional[GenericVersion]
 
     distribution: Distribution
@@ -4171,9 +4171,6 @@ def json_type_transformer(refcls: Union[type[Args], type[Config]]) -> Callable[[
         enumtype = fieldtype.__args__[0]  # type: ignore
         return [enumtype[e] for e in enumlist]
 
-    def str_tuple_transformer(strtup: list[str], fieldtype: list[tuple[str, ...]]) -> tuple[str, ...]:
-        return tuple(strtup)
-
     def config_drive_transformer(drives: list[dict[str, Any]], fieldtype: type[QemuDrive]) -> list[QemuDrive]:
         # TODO: exchange for TypeGuard and list comprehension once on 3.10
         ret = []
@@ -4217,7 +4214,6 @@ def json_type_transformer(refcls: Union[type[Args], type[Config]]) -> Callable[[
         uuid.UUID: uuid_transformer,
         Optional[tuple[str, bool]]: root_password_transformer,
         list[ConfigTree]: config_tree_transformer,
-        tuple[str, ...]: str_tuple_transformer,
         Architecture: enum_transformer,
         BiosBootloader: enum_transformer,
         ShimBootloader: enum_transformer,
index fd44bd3d2e769b921647ab14bb6956f80313ebae..e5427249a121c6701e96629a8b4930a47a7cd7f9 100644 (file)
@@ -382,7 +382,7 @@ def test_config() -> None:
         compress_output=Compression.bz2,
         configure_scripts=[Path("/configure")],
         credentials= {"credkey": "credval"},
-        dependencies=("dep1",),
+        dependencies=["dep1"],
         distribution=Distribution.fedora,
         environment={"foo": "foo", "BAR": "BAR", "Qux": "Qux"},
         environment_files=[],
@@ -396,7 +396,7 @@ def test_config() -> None:
         image="default",
         image_id="myimage",
         image_version="5",
-        images=("default", "initrd"),
+        images=["default", "initrd"],
         include=[],
         incremental=False,
         initrd_include=[Path("/foo/bar"),],