From fb35e6faac2a5efbb8fd0ff6ee5627b144adb184 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Tue, 4 Dec 2018 21:28:36 +0000 Subject: [PATCH] Remove compiler data from build object The actual data is in Coredata (which is serialized) and we just held a reference in Build for (in)convenience. --- mesonbuild/build.py | 7 ------- mesonbuild/environment.py | 4 ++-- mesonbuild/interpreter.py | 10 +++++----- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 093ab8fdf..d51e2e318 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -114,9 +114,6 @@ class Build: self.environment = environment self.projects = {} self.targets = OrderedDict() - # Coredata holds the state. This is just here for convenience. - self.compilers = environment.coredata.compilers - self.cross_compilers = environment.coredata.cross_compilers self.global_args = {} self.projects_args = {} self.global_link_args = {} @@ -149,10 +146,6 @@ class Build: def copy(self): other = Build(self.environment) for k, v in self.__dict__.items(): - if k in ['compilers', 'cross_compilers']: - # These alias coredata's fields of the same name, and must not - # become copies. - continue if isinstance(v, (list, dict, set, OrderedDict)): other.__dict__[k] = v.copy() else: diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index e638f3112..1ccdf98eb 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -411,8 +411,8 @@ class Environment: # target machine.) machines = PerThreeMachineDefaultable() - # Similar to coredata.compilers and build.compilers, but lower level in - # that there is no meta data, only names/paths. + # Similar to coredata.compilers, but lower level in that there is no + # meta data, only names/paths. binaries = PerMachineDefaultable() # Misc other properties about each machine. diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 766a22f72..ea99a43fd 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1824,9 +1824,9 @@ class MesonMain(InterpreterObject): if not isinstance(native, bool): raise InterpreterException('Type of "native" must be a boolean.') if native: - clist = self.build.compilers + clist = self.interpreter.coredata.compilers else: - clist = self.build.cross_compilers + clist = self.interpreter.coredata.cross_compilers if cname in clist: return CompilerHolder(clist[cname], self.build.environment, self.interpreter.subproject) raise InterpreterException('Tried to access compiler for unspecified language "%s".' % cname) @@ -2208,7 +2208,7 @@ class Interpreter(InterpreterBase): def check_cross_stdlibs(self): if self.build.environment.is_cross_build(): props = self.build.environment.properties.host - for l in self.build.cross_compilers.keys(): + for l in self.coredata.cross_compilers.keys(): try: di = mesonlib.stringlistify(props.get_stdlib(l)) if len(di) != 2: @@ -3857,7 +3857,7 @@ different subdirectory. self.print_extra_warnings() def print_extra_warnings(self): - for c in self.build.compilers.values(): + for c in self.coredata.compilers.values(): if c.get_id() == 'clang': self.check_clang_asan_lundef() break @@ -4074,7 +4074,7 @@ This will become a hard error in the future.''', location=self.current_node) def get_used_languages(self, target): result = {} for i in target.sources: - for lang, c in self.build.compilers.items(): + for lang, c in self.coredata.compilers.items(): if c.can_compile(i): result[lang] = True break