From: Daan De Meyer Date: Mon, 8 Jul 2024 13:40:25 +0000 (+0200) Subject: Use list type for Images= and Dependencies= instead of tuple X-Git-Tag: v24~50^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0919439b8d1ea229b76cdd4a1a9a9986774c3b8;p=thirdparty%2Fmkosi.git Use list type for Images= and Dependencies= instead of tuple Also remove the unneeded JSON transformer/parser. --- diff --git a/mkosi/config.py b/mkosi/config.py index f8abd99d5..c8fbe5205 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -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, diff --git a/tests/test_json.py b/tests/test_json.py index fd44bd3d2..e5427249a 100644 --- a/tests/test_json.py +++ b/tests/test_json.py @@ -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"),],