def __init__()

in builder/core/toolchain.py [0:0]


    def __init__(self, **kwargs):
        if 'default' in kwargs or len(kwargs) == 0:
            for slot in ('host', 'target', 'arch', 'compiler', 'compiler_version'):
                setattr(self, slot, 'default')

        if 'spec' in kwargs:
            spec = kwargs['spec']
            self.host = spec.host
            self.compiler = spec.compiler
            self.compiler_version = spec.compiler_version
            self.target = spec.target
            self.arch = normalize_arch(spec.arch)

        # Pull out individual fields. Note this is not in an else to support overriding at construction time
        for slot in ('host', 'target', 'arch', 'compiler', 'compiler_version'):
            if slot in kwargs:
                setattr(self, slot, kwargs[slot])

        if self.target == 'default':
            self.target = current_os()
        if self.arch == 'default':
            self.arch = current_arch()

        # detect cross-compile
        self.cross_compile = _is_cross_compile(self.target, self.arch)
        self.platform = normalize_target(
            '{}-{}'.format(self.target, self.arch))
        self.shell_env = []

        if self.cross_compile:
            print('Setting compiler to gcc for cross compile')
            self.compiler = 'gcc'
            # it's really 4.9, but don't need a separate entry for that
            self.compiler_version = '4.8'
        else:
            # resolve default compiler and/or version
            if self.compiler == 'default':
                c, v = Toolchain.default_compiler()
                if c and v:
                    self.compiler, self.compiler_version = c, v
            elif self.compiler_version == 'default':
                self.compiler_version = _compiler_version(
                    self.compiler_path())[1]
                if not self.compiler_version:
                    self.compiler_version = 'default'

        self.name = '-'.join([self.host, self.compiler,
                              self.compiler_version, self.target, self.arch])