Capitalize some constants in coredata
I've been getting confused between them and similarly-named other things, so I figured it was high time to clean this up.
This commit is contained in:
parent
70edf82c6c
commit
2447a1132a
|
@ -450,7 +450,7 @@ class CoreData:
|
|||
# getting the "system default" is always wrong on multiarch
|
||||
# platforms as it gets a value like lib/x86_64-linux-gnu.
|
||||
if self.cross_files:
|
||||
builtin_options['libdir'].default = 'lib'
|
||||
BUILTIN_OPTIONS['libdir'].default = 'lib'
|
||||
|
||||
def sanitize_prefix(self, prefix):
|
||||
prefix = os.path.expanduser(prefix)
|
||||
|
@ -506,10 +506,10 @@ class CoreData:
|
|||
|
||||
def init_builtins(self, subproject: str):
|
||||
# Create builtin options with default values
|
||||
for key, opt in builtin_options.items():
|
||||
for key, opt in BUILTIN_OPTIONS.items():
|
||||
self.add_builtin_option(self.builtins, key, opt, subproject)
|
||||
for for_machine in iter(MachineChoice):
|
||||
for key, opt in builtin_options_per_machine.items():
|
||||
for key, opt in BUILTIN_OPTIONS_PER_MACHINE.items():
|
||||
self.add_builtin_option(self.builtins_per_machine[for_machine], key, opt, subproject)
|
||||
|
||||
def add_builtin_option(self, opts_map, key, opt, subproject):
|
||||
|
@ -714,7 +714,7 @@ class CoreData:
|
|||
self.builtins['prefix'].set_value(prefix)
|
||||
for key in builtin_dir_noprefix_options:
|
||||
if key not in options:
|
||||
self.builtins[key].set_value(builtin_options[key].prefixed_default(key, prefix))
|
||||
self.builtins[key].set_value(BUILTIN_OPTIONS[key].prefixed_default(key, prefix))
|
||||
|
||||
unknown_options = []
|
||||
for k, v in options.items():
|
||||
|
@ -770,7 +770,7 @@ class CoreData:
|
|||
|
||||
for k, v in chain(env.meson_options.build.get('', {}).items(),
|
||||
env.meson_options.build.get(subproject, {}).items()):
|
||||
if k in builtin_options_per_machine:
|
||||
if k in BUILTIN_OPTIONS_PER_MACHINE:
|
||||
options[make_key('build.{}'.format(k))] = v
|
||||
|
||||
options.update({make_key(k): v for k, v in env.user_options.get(subproject, {}).items()})
|
||||
|
@ -780,7 +780,7 @@ class CoreData:
|
|||
# put those options into env.meson_options, only if they're not already
|
||||
# in there, as the machine files and command line have precendence.
|
||||
for k, v in default_options.items():
|
||||
if k in builtin_options and not builtin_options[k].yielding:
|
||||
if k in BUILTIN_OPTIONS and not BUILTIN_OPTIONS[k].yielding:
|
||||
continue
|
||||
for machine in MachineChoice:
|
||||
if machine is MachineChoice.BUILD and not self.is_cross_build():
|
||||
|
@ -1005,9 +1005,9 @@ def save(obj, build_dir):
|
|||
|
||||
|
||||
def register_builtin_arguments(parser):
|
||||
for n, b in builtin_options.items():
|
||||
for n, b in BUILTIN_OPTIONS.items():
|
||||
b.add_to_argparse(n, parser, '', '')
|
||||
for n, b in builtin_options_per_machine.items():
|
||||
for n, b in BUILTIN_OPTIONS_PER_MACHINE.items():
|
||||
b.add_to_argparse(n, parser, '', ' (just for host machine)')
|
||||
b.add_to_argparse(n, parser, 'build.', ' (just for build machine)')
|
||||
parser.add_argument('-D', action='append', dest='projectoptions', default=[], metavar="option",
|
||||
|
@ -1028,9 +1028,9 @@ def parse_cmd_line_options(args):
|
|||
|
||||
# Merge builtin options set with --option into the dict.
|
||||
for name in chain(
|
||||
builtin_options.keys(),
|
||||
('build.' + k for k in builtin_options_per_machine.keys()),
|
||||
builtin_options_per_machine.keys(),
|
||||
BUILTIN_OPTIONS.keys(),
|
||||
('build.' + k for k in BUILTIN_OPTIONS_PER_MACHINE.keys()),
|
||||
BUILTIN_OPTIONS_PER_MACHINE.keys(),
|
||||
):
|
||||
value = getattr(args, name, None)
|
||||
if value is not None:
|
||||
|
@ -1157,9 +1157,9 @@ BUILTIN_CORE_OPTIONS = OrderedDict([
|
|||
('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 = 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', [])),
|
||||
('cmake_prefix_path', BuiltinOption(UserArrayOption, 'List of additional prefixes for cmake to search', [])),
|
||||
])
|
||||
|
@ -1172,7 +1172,7 @@ builtin_dir_noprefix_options = {
|
|||
'sharedstatedir': {'/usr': '/var/lib', '/usr/local': '/var/local/lib'},
|
||||
}
|
||||
|
||||
forbidden_target_names = {'clean': None,
|
||||
FORBIDDEN_TARGET_NAMES = {'clean': None,
|
||||
'clean-ctlist': None,
|
||||
'clean-gcno': None,
|
||||
'clean-gcda': None,
|
||||
|
|
|
@ -701,7 +701,7 @@ class Environment:
|
|||
|
||||
# Read in command line and populate options
|
||||
# TODO: validate all of this
|
||||
all_builtins = set(coredata.builtin_options) | set(coredata.builtin_options_per_machine) | set(coredata.builtin_dir_noprefix_options)
|
||||
all_builtins = set(coredata.BUILTIN_OPTIONS) | set(coredata.BUILTIN_OPTIONS_PER_MACHINE) | set(coredata.builtin_dir_noprefix_options)
|
||||
for k, v in options.cmd_line_options.items():
|
||||
try:
|
||||
subproject, k = k.split(':')
|
||||
|
@ -716,7 +716,7 @@ class Environment:
|
|||
self.meson_options.host[subproject][k] = v
|
||||
elif k.startswith('build.'):
|
||||
k = k.lstrip('build.')
|
||||
if k in coredata.builtin_options_per_machine:
|
||||
if k in coredata.BUILTIN_OPTIONS_PER_MACHINE:
|
||||
if self.meson_options.build is None:
|
||||
self.meson_options.build = collections.defaultdict(dict)
|
||||
self.meson_options.build[subproject][k] = v
|
||||
|
|
|
@ -4685,7 +4685,7 @@ Try setting b_lundef to false instead.'''.format(self.coredata.base_options['b_s
|
|||
if name.startswith('meson-'):
|
||||
raise InvalidArguments("Target names starting with 'meson-' are reserved "
|
||||
"for Meson's internal use. Please rename.")
|
||||
if name in coredata.forbidden_target_names:
|
||||
if name in coredata.FORBIDDEN_TARGET_NAMES:
|
||||
raise InvalidArguments("Target name '%s' is reserved for Meson's "
|
||||
"internal use. Please rename." % name)
|
||||
# To permit an executable and a shared library to have the
|
||||
|
|
|
@ -22,7 +22,7 @@ from . import mesonlib
|
|||
from . import mparser
|
||||
from .interpreterbase import FeatureNew
|
||||
|
||||
forbidden_option_names = set(coredata.builtin_options.keys())
|
||||
forbidden_option_names = set(coredata.BUILTIN_OPTIONS.keys())
|
||||
forbidden_prefixes = [lang + '_' for lang in compilers.all_languages] + ['b_', 'backend_']
|
||||
reserved_prefixes = ['cross_']
|
||||
|
||||
|
|
|
@ -1372,8 +1372,8 @@ class DataTests(unittest.TestCase):
|
|||
found_entries |= options
|
||||
|
||||
self.assertEqual(found_entries, set([
|
||||
*mesonbuild.coredata.builtin_options.keys(),
|
||||
*mesonbuild.coredata.builtin_options_per_machine.keys()
|
||||
*mesonbuild.coredata.BUILTIN_OPTIONS.keys(),
|
||||
*mesonbuild.coredata.BUILTIN_OPTIONS_PER_MACHINE.keys()
|
||||
]))
|
||||
|
||||
# Check that `buildtype` table inside `Core options` matches how
|
||||
|
@ -3037,7 +3037,7 @@ int main(int argc, char **argv) {
|
|||
test. Needs to be a unit test because it accesses Meson internals.
|
||||
'''
|
||||
testdir = os.path.join(self.common_test_dir, '154 reserved targets')
|
||||
targets = mesonbuild.coredata.forbidden_target_names
|
||||
targets = mesonbuild.coredata.FORBIDDEN_TARGET_NAMES
|
||||
# We don't actually define a target with this name
|
||||
targets.pop('build.ninja')
|
||||
# Remove this to avoid multiple entries with the same name
|
||||
|
|
Loading…
Reference in New Issue