aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-06-10 10:28:21 -0700
committerDylan Baker <dylan@pnwbakers.com>2020-08-01 22:00:06 -0700
commitaf763e093a8172536d96e24901b82edd2e5b2dc9 (patch)
tree06faee7e6705c1bf2ef9f8660134bd1082d87909
parent54fb61627851a0fe765d31955629ff5d7be2d064 (diff)
downloadmeson-af763e093a8172536d96e24901b82edd2e5b2dc9.zip
meson-af763e093a8172536d96e24901b82edd2e5b2dc9.tar.gz
meson-af763e093a8172536d96e24901b82edd2e5b2dc9.tar.bz2
mconf/mintro: use authoritative list of options from coredata
This splits the directory options and non-directory options into two dicts, and then merges them later to maintain API.
-rw-r--r--mesonbuild/coredata.py29
-rw-r--r--mesonbuild/mconf.py14
-rw-r--r--mesonbuild/mintro.py14
3 files changed, 19 insertions, 38 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 49104a7..3330ae5 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -1158,23 +1158,25 @@ class BuiltinOption(T.Generic[_T, _U]):
cmdline_name = self.argparse_name_to_arg(prefix + name)
parser.add_argument(cmdline_name, help=h + help_suffix, **kwargs)
+
# Update `docs/markdown/Builtin-options.md` after changing the options below
-builtin_options = OrderedDict([
- # Directories
- ('prefix', BuiltinOption(UserStringOption, 'Installation prefix', default_prefix())),
- ('bindir', BuiltinOption(UserStringOption, 'Executable directory', 'bin')),
- ('datadir', BuiltinOption(UserStringOption, 'Data file directory', 'share')),
- ('includedir', BuiltinOption(UserStringOption, 'Header file directory', 'include')),
- ('infodir', BuiltinOption(UserStringOption, 'Info page directory', 'share/info')),
- ('libdir', BuiltinOption(UserStringOption, 'Library directory', default_libdir())),
- ('libexecdir', BuiltinOption(UserStringOption, 'Library executable directory', default_libexecdir())),
- ('localedir', BuiltinOption(UserStringOption, 'Locale data directory', 'share/locale')),
+BUILTIN_DIR_OPTIONS = OrderedDict([
+ ('prefix', BuiltinOption(UserStringOption, 'Installation prefix', default_prefix())),
+ ('bindir', BuiltinOption(UserStringOption, 'Executable directory', 'bin')),
+ ('datadir', BuiltinOption(UserStringOption, 'Data file directory', 'share')),
+ ('includedir', BuiltinOption(UserStringOption, 'Header file directory', 'include')),
+ ('infodir', BuiltinOption(UserStringOption, 'Info page directory', 'share/info')),
+ ('libdir', BuiltinOption(UserStringOption, 'Library directory', default_libdir())),
+ ('libexecdir', BuiltinOption(UserStringOption, 'Library executable directory', default_libexecdir())),
+ ('localedir', BuiltinOption(UserStringOption, 'Locale data directory', 'share/locale')),
('localstatedir', BuiltinOption(UserStringOption, 'Localstate data directory', 'var')),
('mandir', BuiltinOption(UserStringOption, 'Manual page directory', 'share/man')),
('sbindir', BuiltinOption(UserStringOption, 'System executable directory', 'sbin')),
('sharedstatedir', BuiltinOption(UserStringOption, 'Architecture-independent data directory', 'com')),
('sysconfdir', BuiltinOption(UserStringOption, 'Sysconf data directory', 'etc')),
- # Core options
+]) # type: OptionDictType
+
+BUILTIN_CORE_OPTIONS = OrderedDict([
('auto_features', BuiltinOption(UserFeatureOption, "Override value of all 'auto' features", 'auto')),
('backend', BuiltinOption(UserComboOption, 'Backend to use', 'ninja', choices=backendlist)),
('buildtype', BuiltinOption(UserComboOption, 'Build type to use', 'debug',
@@ -1194,7 +1196,9 @@ builtin_options = OrderedDict([
('werror', BuiltinOption(UserBooleanOption, 'Treat warnings as errors', False, yielding=False)),
('wrap_mode', BuiltinOption(UserComboOption, 'Wrap mode', 'default', choices=['default', 'nofallback', 'nodownload', 'forcefallback'])),
('force_fallback_for', BuiltinOption(UserArrayOption, 'Force fallback for those subprojects', [])),
-])
+]) # type: OptionDictType
+
+builtin_options = OrderedDict(chain(BUILTIN_DIR_OPTIONS.items(), BUILTIN_CORE_OPTIONS.items()))
builtin_options_per_machine = OrderedDict([
('pkg_config_path', BuiltinOption(UserArrayOption, 'List of additional paths for pkg-config to search', [])),
@@ -1230,3 +1234,4 @@ forbidden_target_names = {'clean': None,
'dist': None,
'distcheck': None,
}
+
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py
index 2e03cab..f070355 100644
--- a/mesonbuild/mconf.py
+++ b/mesonbuild/mconf.py
@@ -184,19 +184,7 @@ class Conf:
if not self.default_values_only:
print(' Build dir ', self.build_dir)
- dir_option_names = ['bindir',
- 'datadir',
- 'includedir',
- 'infodir',
- 'libdir',
- 'libexecdir',
- 'localedir',
- 'localstatedir',
- 'mandir',
- 'prefix',
- 'sbindir',
- 'sharedstatedir',
- 'sysconfdir']
+ dir_option_names = list(coredata.BUILTIN_DIR_OPTIONS)
test_option_names = ['errorlogs',
'stdsplit']
core_option_names = [k for k in self.coredata.builtins if k not in dir_option_names + test_option_names]
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py
index cccedaa..0049bbd 100644
--- a/mesonbuild/mintro.py
+++ b/mesonbuild/mintro.py
@@ -200,19 +200,7 @@ def list_buildoptions_from_source(intr: IntrospectionInterpreter) -> T.List[T.Di
def list_buildoptions(coredata: cdata.CoreData, subprojects: T.Optional[T.List[str]] = None) -> T.List[T.Dict[str, T.Union[str, bool, int, T.List[str]]]]:
optlist = [] # type: T.List[T.Dict[str, T.Union[str, bool, int, T.List[str]]]]
- dir_option_names = ['bindir',
- 'datadir',
- 'includedir',
- 'infodir',
- 'libdir',
- 'libexecdir',
- 'localedir',
- 'localstatedir',
- 'mandir',
- 'prefix',
- 'sbindir',
- 'sharedstatedir',
- 'sysconfdir']
+ dir_option_names = list(cdata.BUILTIN_DIR_OPTIONS)
test_option_names = ['errorlogs',
'stdsplit']
core_option_names = [k for k in coredata.builtins if k not in dir_option_names + test_option_names]