From 690d6585ffdc76b8455537696e1a7d9d606797a6 Mon Sep 17 00:00:00 2001 From: rjdbcm Date: Tue, 3 Dec 2024 22:24:12 -0600 Subject: [PATCH] refactor backend for future maintainability Signed-off-by: rjdbcm --- ozi_build/metadata.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ozi_build/metadata.py b/ozi_build/metadata.py index f8bd1b2..50dea33 100644 --- a/ozi_build/metadata.py +++ b/ozi_build/metadata.py @@ -141,6 +141,10 @@ def get_simple_headers(config): ('dynamic', 'Dynamic'), ]: vals = config.get(key, []) + if key == 'dynamic': + for i in vals: + if i in {'Name', 'Version', 'Metadata-Version'}: + raise ValueError('{} is not a valid value for dynamic'.format(key)) for val in vals: res += '{}: {}\n'.format(mdata_key, val) return res @@ -156,8 +160,6 @@ def get_license_headers(config): if key == 'license-expression' and 'license' in config: raise ValueError('license and license-expression are mutually exclusive') header = '-'.join(map(str.capitalize, key.split('-'))) - if header in {'Name', 'Version', 'Metadata-Version'}: - raise ValueError('{} is not a valid value for dynamic'.format(key)) res += '{}: {}\n'.format(header, config[key]) return res