From b37f0cce2c9d94223caf5730af508c463e125457 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 30 Nov 2020 15:38:52 -0800 Subject: [PATCH] movve insert_build_prefix to mconf that's the only place it's used anyway. --- mesonbuild/coredata.py | 7 ------- mesonbuild/mconf.py | 10 ++++++++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index b39f205d7..44cfe2ea6 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -827,13 +827,6 @@ class CoreData: for k1, v1 in v0.items(): yield (k0 + k1, v1) - @classmethod - def insert_build_prefix(cls, k): - idx = k.find(':') - if idx < 0: - return 'build.' + k - return k[:idx + 1] + 'build.' + k[idx + 1:] - @classmethod def is_per_machine_option(cls, optname: OptionKey) -> bool: if optname.name in BUILTIN_OPTIONS_PER_MACHINE: diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py index 46aac6ea6..24638ebd3 100644 --- a/mesonbuild/mconf.py +++ b/mesonbuild/mconf.py @@ -35,6 +35,12 @@ def make_lower_case(val: T.Any) -> T.Union[str, T.List[T.Any]]: # T.Any because else: return str(val) +def insert_build_prefix(k: str) -> str: + idx = k.find(':') + if idx < 0: + return 'build.' + k + return k[:idx + 1] + 'build.' + k[idx + 1:] + class ConfException(mesonlib.MesonException): pass @@ -203,7 +209,7 @@ class Conf: self.coredata.compiler_options.host.items()))) build_compiler_options = self.split_options_per_subproject( dict(self.coredata.flatten_lang_iterator( - (self.coredata.insert_build_prefix(k), o) + (insert_build_prefix(k), o) for k, o in self.coredata.compiler_options.build.items()))) project_options = self.split_options_per_subproject(self.coredata.user_options) show_build_options = self.default_values_only or self.build.environment.is_cross_build() @@ -212,7 +218,7 @@ class Conf: self.print_options('Core options', core_options['']) self.print_options('', self.coredata.builtins_per_machine.host) if show_build_options: - self.print_options('', {self.coredata.insert_build_prefix(k): o for k, o in self.coredata.builtins_per_machine.build.items()}) + self.print_options('', {insert_build_prefix(k): o for k, o in self.coredata.builtins_per_machine.build.items()}) self.print_options('Backend options', self.coredata.backend_options) self.print_options('Base options', self.coredata.base_options) self.print_options('Compiler options', host_compiler_options.get('', {}))