diff options
author | Stephen Gregoratto <dev@sgregoratto.me> | 2021-02-26 15:54:49 +1100 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2021-02-26 10:28:00 -0500 |
commit | ec5fe58e6dd0f42f126b48d1ebd191deeea38541 (patch) | |
tree | 6e442e0fa8ae90baa99eabb57b9be36d4f6e74a3 | |
parent | ace22f21a7f0abe9250e673a258e4adf3afa4ac0 (diff) | |
download | meson-ec5fe58e6dd0f42f126b48d1ebd191deeea38541.zip meson-ec5fe58e6dd0f42f126b48d1ebd191deeea38541.tar.gz meson-ec5fe58e6dd0f42f126b48d1ebd191deeea38541.tar.bz2 |
Allow printing UserOptions in the summary
-rw-r--r-- | docs/markdown/Reference-manual.md | 1 | ||||
-rw-r--r-- | docs/markdown/snippets/summary-accepts-features.md | 3 | ||||
-rw-r--r-- | mesonbuild/interpreter.py | 3 | ||||
-rwxr-xr-x | run_unittests.py | 1 | ||||
-rw-r--r-- | test cases/unit/73 summary/meson.build | 1 | ||||
-rw-r--r-- | test cases/unit/73 summary/meson_options.txt | 1 |
6 files changed, 10 insertions, 0 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index b0f5032..4c30ddd 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -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 diff --git a/docs/markdown/snippets/summary-accepts-features.md b/docs/markdown/snippets/summary-accepts-features.md new file mode 100644 index 0000000..81bf542 --- /dev/null +++ b/docs/markdown/snippets/summary-accepts-features.md @@ -0,0 +1,3 @@ +## `summary()` accepts features + +Build feature options can be passed to `summary()` as the value to be printed. diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 03e2d4f..98c5713 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -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)) diff --git a/run_unittests.py b/run_unittests.py index 1989e93..f7f9fd5 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -4996,6 +4996,7 @@ class AllPlatformTests(BasePlatformTests): 1 True empty list : + enabled_opt : enabled A number : 1 yes : YES no : NO diff --git a/test cases/unit/73 summary/meson.build b/test cases/unit/73 summary/meson.build index 50383b4..4205d6f 100644 --- a/test cases/unit/73 summary/meson.build +++ b/test cases/unit/73 summary/meson.build @@ -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(), diff --git a/test cases/unit/73 summary/meson_options.txt b/test cases/unit/73 summary/meson_options.txt new file mode 100644 index 0000000..f2c41f8 --- /dev/null +++ b/test cases/unit/73 summary/meson_options.txt @@ -0,0 +1 @@ +option('enabled_opt', type: 'feature', value: 'enabled') |