diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 8a0484235..0d87bab86 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1783,6 +1783,8 @@ class Summary: formatted_values.append(mlog.green('YES') if i else mlog.red('NO')) else: formatted_values.append(i) + if not formatted_values: + formatted_values = [''] self.sections[section][k] = formatted_values self.max_key_len = max(self.max_key_len, len(k)) diff --git a/run_unittests.py b/run_unittests.py index 5388679ca..cf4095514 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -4254,6 +4254,7 @@ recommended as it is not supported on some platforms''') A list: string 1 True + empty list: A number: 1 yes: YES no: NO diff --git a/test cases/unit/72 summary/meson.build b/test cases/unit/72 summary/meson.build index c6d94d9c8..c155889bf 100644 --- a/test cases/unit/72 summary/meson.build +++ b/test cases/unit/72 summary/meson.build @@ -7,6 +7,7 @@ summary({'Some boolean': false, 'Another boolean': true, 'Some string': 'Hello World', 'A list': ['string', 1, true], + 'empty list': [], }, section: 'Configuration') summary('A number', 1, section: 'Configuration') summary('yes', true, bool_yn : true, section: 'Configuration')