convert booleans in summary function to correct representation

str() is going to return titlecased "True" which is not how meson works.
This is misleading, so use the meson-specific format instead.
pull/12074/head
Eli Schwartz 1 year ago committed by Xavier Claessens
parent cec3edc08a
commit cdef674169
  1. 9
      mesonbuild/interpreter/interpreter.py
  2. 8
      unittests/allplatformstests.py

@ -154,9 +154,12 @@ class Summary:
raise InterpreterException(f'Summary section {section!r} already have key {k!r}')
formatted_values = []
for i in listify(v):
if isinstance(i, bool) and bool_yn:
formatted_values.append(mlog.green('YES') if i else mlog.red('NO'))
elif isinstance(i, (str, int, bool)):
if isinstance(i, bool):
if bool_yn:
formatted_values.append(mlog.green('YES') if i else mlog.red('NO'))
else:
formatted_values.append('true' if i else 'false')
elif isinstance(i, (str, int)):
formatted_values.append(str(i))
elif isinstance(i, (ExternalProgram, Dependency)):
FeatureNew.single_use('dependency or external program in summary', '0.57.0', subproject)

@ -3530,7 +3530,7 @@ class AllPlatformTests(BasePlatformTests):
string : bar
integer: 1
boolean: True
boolean: true
subsub undefined
@ -3539,12 +3539,12 @@ class AllPlatformTests(BasePlatformTests):
My Project 1.0
Configuration
Some boolean : False
Another boolean: True
Some boolean : false
Another boolean: true
Some string : Hello World
A list : string
1
True
true
empty list :
enabled_opt : enabled
A number : 1

Loading…
Cancel
Save