nir: Allow var_mem_global in nir_lower_vars_to_explicit_types
[mesa.git] / bin / meson-options.py
1 #!/usr/bin/env python3
2
3 from os import get_terminal_size
4 from textwrap import wrap
5 from mesonbuild import coredata
6 from mesonbuild import optinterpreter
7
8 (COLUMNS, _) = get_terminal_size()
9
10 def describe_option(option_name: str, option_default_value: str,
11 option_type: str, option_message: str) -> None:
12 print('name: ' + option_name)
13 print('default: ' + option_default_value)
14 print('type: ' + option_type)
15 for line in wrap(option_message, width=COLUMNS - 9):
16 print(' ' + line)
17 print('---')
18
19 oi = optinterpreter.OptionInterpreter('')
20 oi.process('meson_options.txt')
21
22 for (name, value) in oi.options.items():
23 if isinstance(value, coredata.UserStringOption):
24 describe_option(name,
25 value.value,
26 'string',
27 "You can type what you want, but make sure it makes sense")
28 elif isinstance(value, coredata.UserBooleanOption):
29 describe_option(name,
30 'true' if value.value else 'false',
31 'boolean',
32 "You can set it to 'true' or 'false'")
33 elif isinstance(value, coredata.UserIntegerOption):
34 describe_option(name,
35 str(value.value),
36 'integer',
37 "You can set it to any integer value between '{}' and '{}'".format(value.min_value, value.max_value))
38 elif isinstance(value, coredata.UserUmaskOption):
39 describe_option(name,
40 str(value.value),
41 'umask',
42 "You can set it to 'preserve' or a value between '0000' and '0777'")
43 elif isinstance(value, coredata.UserComboOption):
44 choices = '[' + ', '.join(["'" + v + "'" for v in value.choices]) + ']'
45 describe_option(name,
46 value.value,
47 'combo',
48 "You can set it to any one of those values: " + choices)
49 elif isinstance(value, coredata.UserArrayOption):
50 choices = '[' + ', '.join(["'" + v + "'" for v in value.choices]) + ']'
51 value = '[' + ', '.join(["'" + v + "'" for v in value.value]) + ']'
52 describe_option(name,
53 value,
54 'array',
55 "You can set it to one or more of those values: " + choices)
56 elif isinstance(value, coredata.UserFeatureOption):
57 describe_option(name,
58 value.value,
59 'feature',
60 "You can set it to 'auto', 'enabled', or 'disabled'")
61 else:
62 print(name + ' is an option of a type unknown to this script')
63 print('---')