def define_target_constraints(self):

    def _all_targets_satisfiying(single_constraint):
        allowed_targets = []
        if (':' not in single_constraint):
            return [single_constraint]
        (t_min, _, t_max) = single_constraint.partition(':')
        for test_target in archspec.cpu.TARGETS.values():
            if (t_min and (not (t_min <= test_target))):
                continue
            if (t_max and (not (t_max >= test_target))):
                continue
            allowed_targets.append(test_target)
        return allowed_targets
    cache = {}
    for (spec_name, target_constraint) in sorted(self.target_constraints):
        allowed_targets = []
        for single_constraint in str(target_constraint).split(','):
            if (single_constraint not in cache):
                cache[single_constraint] = _all_targets_satisfiying(single_constraint)
            allowed_targets.extend(cache[single_constraint])
        for target in allowed_targets:
            self.gen.fact(fn.node_target_satisfies(spec_name, target_constraint, target))
        self.gen.newline()
def define_target_constraints(self):

    def _all_targets_satisfiying(single_constraint):
        allowed_targets = []
        if (':' not in single_constraint):
            return [single_constraint]
        (t_min, _, t_max) = single_constraint.partition(':')
        for test_target in archspec.cpu.TARGETS.values():
            if (t_min and (not (t_min <= test_target))):
                continue
            if (t_max and (not (t_max >= test_target))):
                continue
            allowed_targets.append(test_target)
        return allowed_targets
    cache = {}
    for (spec_name, target_constraint) in sorted(self.target_constraints):
        allowed_targets = []
        for single_constraint in str(target_constraint).split(','):
            if (single_constraint not in cache):
                cache[single_constraint] = _all_targets_satisfiying(single_constraint)
            allowed_targets.extend(cache[single_constraint])
        for target in allowed_targets:
            self.gen.fact(fn.node_target_satisfies(spec_name, target_constraint, target))
        self.gen.newline()