'Called by the parser to set the architecture.'

def _set_architecture(self, **kwargs):

    arch_attrs = ['platform', 'platform_os', 'target']
    if (self.architecture and self.architecture.concrete):
        raise DuplicateArchitectureError(("Spec    for    '%s'    cannot    have    two    architectures." % self.name))
    if (not self.architecture):
        new_vals = tuple((kwargs.get(arg, None) for arg in arch_attrs))
        self.architecture = ArchSpec(*new_vals)
    else:
        new_attrvals = [(a, v) for (a, v) in iteritems(kwargs) if (a in arch_attrs)]
        for (new_attr, new_value) in new_attrvals:
            if getattr(self.architecture, new_attr):
                raise DuplicateArchitectureError(("Spec    for    '%s'    cannot    have    two    '%s'    specified    for    its    architecture" % (self.name, new_attr)))
            else:
                setattr(self.architecture, new_attr, new_value)
