diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2024-08-29 09:23:05 -0700 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2025-02-05 17:45:38 +0200 |
| commit | b32e4e87b1c88eb235389c4f60f540154d720970 (patch) | |
| tree | ec52cf7639df0b937d9faee9e9d15e849a0d7384 /mesonbuild/mintro.py | |
| parent | 4aa0e93922355c01c86ad41d985ec24e4ec8a1f6 (diff) | |
| download | meson-b32e4e87b1c88eb235389c4f60f540154d720970.tar.gz | |
options: Add a printable_choices method to UserOption
This provides a method to get choices for options in a printable form.
The goal is to make refactoring options simpler.
Diffstat (limited to 'mesonbuild/mintro.py')
| -rw-r--r-- | mesonbuild/mintro.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index b9b09c557..cd68911ce 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -315,14 +315,15 @@ def list_buildoptions(coredata: cdata.CoreData, subprojects: T.Optional[T.List[s elif isinstance(opt, options.UserBooleanOption): typestr = 'boolean' elif isinstance(opt, options.UserComboOption): - optdict['choices'] = opt.choices + optdict['choices'] = opt.printable_choices() typestr = 'combo' elif isinstance(opt, options.UserIntegerOption): typestr = 'integer' elif isinstance(opt, options.UserArrayOption): typestr = 'array' - if opt.choices: - optdict['choices'] = opt.choices + c = opt.printable_choices() + if c: + optdict['choices'] = c else: raise RuntimeError("Unknown option type") optdict['type'] = typestr |
