From: Daan De Meyer Date: Thu, 9 Nov 2023 11:52:16 +0000 (+0100) Subject: Add extension() method to OutputFormat X-Git-Tag: v19~8^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6010bfcb4fa9a67dd6bb9f92ce8a1ff7b9eb7744;p=thirdparty%2Fmkosi.git Add extension() method to OutputFormat --- diff --git a/mkosi/config.py b/mkosi/config.py index 37851bf01..93be0eb0c 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -106,6 +106,14 @@ class OutputFormat(StrEnum): uki = enum.auto() none = enum.auto() + def extension(self) -> str: + return { + OutputFormat.disk: ".raw", + OutputFormat.cpio: ".cpio", + OutputFormat.tar: ".tar", + OutputFormat.uki: ".efi", + }.get(self, "") + class ManifestFormat(StrEnum): json = enum.auto() # the standard manifest in json format @@ -938,16 +946,7 @@ class MkosiConfig: @property def output_with_format(self) -> str: - output = self.output_with_version - - output += { - OutputFormat.disk: ".raw", - OutputFormat.cpio: ".cpio", - OutputFormat.tar: ".tar", - OutputFormat.uki: ".efi", - }.get(self.output_format, "") - - return output + return self.output_with_version + self.output_format.extension() @property def output_with_compression(self) -> str: