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.
This commit is contained in:
parent
54fb616278
commit
af763e093a
|
@ -1158,23 +1158,25 @@ class BuiltinOption(T.Generic[_T, _U]):
|
||||||
cmdline_name = self.argparse_name_to_arg(prefix + name)
|
cmdline_name = self.argparse_name_to_arg(prefix + name)
|
||||||
parser.add_argument(cmdline_name, help=h + help_suffix, **kwargs)
|
parser.add_argument(cmdline_name, help=h + help_suffix, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
# Update `docs/markdown/Builtin-options.md` after changing the options below
|
# Update `docs/markdown/Builtin-options.md` after changing the options below
|
||||||
builtin_options = OrderedDict([
|
BUILTIN_DIR_OPTIONS = OrderedDict([
|
||||||
# Directories
|
('prefix', BuiltinOption(UserStringOption, 'Installation prefix', default_prefix())),
|
||||||
('prefix', BuiltinOption(UserStringOption, 'Installation prefix', default_prefix())),
|
('bindir', BuiltinOption(UserStringOption, 'Executable directory', 'bin')),
|
||||||
('bindir', BuiltinOption(UserStringOption, 'Executable directory', 'bin')),
|
('datadir', BuiltinOption(UserStringOption, 'Data file directory', 'share')),
|
||||||
('datadir', BuiltinOption(UserStringOption, 'Data file directory', 'share')),
|
('includedir', BuiltinOption(UserStringOption, 'Header file directory', 'include')),
|
||||||
('includedir', BuiltinOption(UserStringOption, 'Header file directory', 'include')),
|
('infodir', BuiltinOption(UserStringOption, 'Info page directory', 'share/info')),
|
||||||
('infodir', BuiltinOption(UserStringOption, 'Info page directory', 'share/info')),
|
('libdir', BuiltinOption(UserStringOption, 'Library directory', default_libdir())),
|
||||||
('libdir', BuiltinOption(UserStringOption, 'Library directory', default_libdir())),
|
('libexecdir', BuiltinOption(UserStringOption, 'Library executable directory', default_libexecdir())),
|
||||||
('libexecdir', BuiltinOption(UserStringOption, 'Library executable directory', default_libexecdir())),
|
('localedir', BuiltinOption(UserStringOption, 'Locale data directory', 'share/locale')),
|
||||||
('localedir', BuiltinOption(UserStringOption, 'Locale data directory', 'share/locale')),
|
|
||||||
('localstatedir', BuiltinOption(UserStringOption, 'Localstate data directory', 'var')),
|
('localstatedir', BuiltinOption(UserStringOption, 'Localstate data directory', 'var')),
|
||||||
('mandir', BuiltinOption(UserStringOption, 'Manual page directory', 'share/man')),
|
('mandir', BuiltinOption(UserStringOption, 'Manual page directory', 'share/man')),
|
||||||
('sbindir', BuiltinOption(UserStringOption, 'System executable directory', 'sbin')),
|
('sbindir', BuiltinOption(UserStringOption, 'System executable directory', 'sbin')),
|
||||||
('sharedstatedir', BuiltinOption(UserStringOption, 'Architecture-independent data directory', 'com')),
|
('sharedstatedir', BuiltinOption(UserStringOption, 'Architecture-independent data directory', 'com')),
|
||||||
('sysconfdir', BuiltinOption(UserStringOption, 'Sysconf data directory', 'etc')),
|
('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')),
|
('auto_features', BuiltinOption(UserFeatureOption, "Override value of all 'auto' features", 'auto')),
|
||||||
('backend', BuiltinOption(UserComboOption, 'Backend to use', 'ninja', choices=backendlist)),
|
('backend', BuiltinOption(UserComboOption, 'Backend to use', 'ninja', choices=backendlist)),
|
||||||
('buildtype', BuiltinOption(UserComboOption, 'Build type to use', 'debug',
|
('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)),
|
('werror', BuiltinOption(UserBooleanOption, 'Treat warnings as errors', False, yielding=False)),
|
||||||
('wrap_mode', BuiltinOption(UserComboOption, 'Wrap mode', 'default', choices=['default', 'nofallback', 'nodownload', 'forcefallback'])),
|
('wrap_mode', BuiltinOption(UserComboOption, 'Wrap mode', 'default', choices=['default', 'nofallback', 'nodownload', 'forcefallback'])),
|
||||||
('force_fallback_for', BuiltinOption(UserArrayOption, 'Force fallback for those subprojects', [])),
|
('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([
|
builtin_options_per_machine = OrderedDict([
|
||||||
('pkg_config_path', BuiltinOption(UserArrayOption, 'List of additional paths for pkg-config to search', [])),
|
('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,
|
'dist': None,
|
||||||
'distcheck': None,
|
'distcheck': None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,19 +184,7 @@ class Conf:
|
||||||
if not self.default_values_only:
|
if not self.default_values_only:
|
||||||
print(' Build dir ', self.build_dir)
|
print(' Build dir ', self.build_dir)
|
||||||
|
|
||||||
dir_option_names = ['bindir',
|
dir_option_names = list(coredata.BUILTIN_DIR_OPTIONS)
|
||||||
'datadir',
|
|
||||||
'includedir',
|
|
||||||
'infodir',
|
|
||||||
'libdir',
|
|
||||||
'libexecdir',
|
|
||||||
'localedir',
|
|
||||||
'localstatedir',
|
|
||||||
'mandir',
|
|
||||||
'prefix',
|
|
||||||
'sbindir',
|
|
||||||
'sharedstatedir',
|
|
||||||
'sysconfdir']
|
|
||||||
test_option_names = ['errorlogs',
|
test_option_names = ['errorlogs',
|
||||||
'stdsplit']
|
'stdsplit']
|
||||||
core_option_names = [k for k in self.coredata.builtins if k not in dir_option_names + test_option_names]
|
core_option_names = [k for k in self.coredata.builtins if k not in dir_option_names + test_option_names]
|
||||||
|
|
|
@ -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]]]]:
|
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]]]]
|
optlist = [] # type: T.List[T.Dict[str, T.Union[str, bool, int, T.List[str]]]]
|
||||||
|
|
||||||
dir_option_names = ['bindir',
|
dir_option_names = list(cdata.BUILTIN_DIR_OPTIONS)
|
||||||
'datadir',
|
|
||||||
'includedir',
|
|
||||||
'infodir',
|
|
||||||
'libdir',
|
|
||||||
'libexecdir',
|
|
||||||
'localedir',
|
|
||||||
'localstatedir',
|
|
||||||
'mandir',
|
|
||||||
'prefix',
|
|
||||||
'sbindir',
|
|
||||||
'sharedstatedir',
|
|
||||||
'sysconfdir']
|
|
||||||
test_option_names = ['errorlogs',
|
test_option_names = ['errorlogs',
|
||||||
'stdsplit']
|
'stdsplit']
|
||||||
core_option_names = [k for k in coredata.builtins if k not in dir_option_names + test_option_names]
|
core_option_names = [k for k in coredata.builtins if k not in dir_option_names + test_option_names]
|
||||||
|
|
Loading…
Reference in New Issue