From 07777e15d47dbddaf849d24b3a30c85745c533ca Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 4 Oct 2018 20:52:08 -0400 Subject: Purge `is_cross` and friends without changing user interfaces In most cases instead pass `for_machine`, the name of the relevant machines (what compilers target, what targets run on, etc). This allows us to use the cross code path in the native case, deduplicating the code. As one can see, environment got bigger as more information is kept structured there, while ninjabackend got a smaller. Overall a few amount of lines were added, but the hope is what's added is a lot simpler than what's removed. --- mesonbuild/compilers/compilers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'mesonbuild/compilers/compilers.py') diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 3ad80fe..0a228b4 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -21,7 +21,7 @@ from .. import coredata from .. import mlog from .. import mesonlib from ..mesonlib import ( - EnvironmentException, MesonException, OrderedSet, + EnvironmentException, MachineChoice, MesonException, OrderedSet, version_compare, Popen_safe ) from ..envconfig import ( @@ -871,7 +871,7 @@ class Compiler: # manually searched. internal_libs = () - def __init__(self, exelist, version, **kwargs): + def __init__(self, exelist, version, for_machine: MachineChoice, **kwargs): if isinstance(exelist, str): self.exelist = [exelist] elif isinstance(exelist, list): @@ -889,6 +889,7 @@ class Compiler: self.full_version = kwargs['full_version'] else: self.full_version = None + self.for_machine = for_machine self.base_options = [] def __repr__(self): @@ -2183,7 +2184,7 @@ class ClangCompiler(GnuLikeCompiler): class ArmclangCompiler: def __init__(self, compiler_type): - if not self.is_cross: + if self.is_cross: raise EnvironmentException('armclang supports only cross-compilation.') # Check whether 'armlink.exe' is available in path self.linker_exe = 'armlink.exe' -- cgit v1.1