aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-07-26 10:50:17 -0400
committerXavier Claessens <xclaesse@gmail.com>2023-08-02 20:38:14 -0400
commitcdef6741698d98453142cb2a0b65c72676dbb259 (patch)
tree72531b6f6965e0a72f700c7882b89344cf8e148b
parentcec3edc08a6cd6a89761c49292ba6a3bace8b3c1 (diff)
downloadmeson-cdef6741698d98453142cb2a0b65c72676dbb259.zip
meson-cdef6741698d98453142cb2a0b65c72676dbb259.tar.gz
meson-cdef6741698d98453142cb2a0b65c72676dbb259.tar.bz2
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.
-rw-r--r--mesonbuild/interpreter/interpreter.py9
-rw-r--r--unittests/allplatformstests.py8
2 files changed, 10 insertions, 7 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index ff9b9ee..4df8a12 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.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)
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index 4327d99..7f38d4b 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -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