Allow printing UserOptions in the summary

pull/8422/head
Stephen Gregoratto 4 years ago committed by Xavier Claessens
parent ace22f21a7
commit ec5fe58e6d
  1. 1
      docs/markdown/Reference-manual.md
  2. 3
      docs/markdown/snippets/summary-accepts-features.md
  3. 3
      mesonbuild/interpreter.py
  4. 1
      run_unittests.py
  5. 1
      test cases/unit/73 summary/meson.build
  6. 1
      test cases/unit/73 summary/meson_options.txt

@ -1356,6 +1356,7 @@ dictionaries does not guarantee ordering. `key` must be string,
- an integer, boolean or string
- *since 0.57.0* an external program or a dependency
- *since 0.58.0* a feature option
- a list of those.
`summary()` can be called multiple times as long as the same

@ -0,0 +1,3 @@
## `summary()` accepts features
Build feature options can be passed to `summary()` as the value to be printed.

@ -1878,6 +1878,9 @@ class Summary:
elif isinstance(i, (ExternalProgram, Dependency)):
FeatureNew.single_use('dependency or external program in summary', '0.57.0', subproject)
formatted_values.append(i.summary_value())
elif isinstance(i, coredata.UserOption):
FeatureNew.single_use('feature option in summary', '0.58.0', subproject)
formatted_values.append(i.printable_value())
else:
m = 'Summary value in section {!r}, key {!r}, must be string, integer, boolean, dependency or external program'
raise InterpreterException(m.format(section, k))

@ -4996,6 +4996,7 @@ class AllPlatformTests(BasePlatformTests):
1
True
empty list :
enabled_opt : enabled
A number : 1
yes : YES
no : NO

@ -8,6 +8,7 @@ summary({'Some boolean': false,
'Some string': 'Hello World',
'A list': ['string', 1, true],
'empty list': [],
'enabled_opt': get_option('enabled_opt'),
}, section: 'Configuration')
summary({'missing prog': find_program('xyzzy', required: false),
'existing prog': import('python').find_installation(),

@ -0,0 +1 @@
option('enabled_opt', type: 'feature', value: 'enabled')
Loading…
Cancel
Save