def condition(self, required_spec, imposed_spec=None, name=None):
    'Generate facts for a dependency or virtual provider condition.\n\n        Arguments:\n            required_spec (spack.spec.Spec): the spec that triggers this condition\n            imposed_spec (spack.spec.Spec or None): the sepc with constraints that\n                are imposed when this condition is triggered\n            name (str or None): name for `required_spec` (required if\n                required_spec is anonymous, ignored if not)\n\n        Returns:\n            int: id of the condition created by this function\n        '
    named_cond = required_spec.copy()
    named_cond.name = (named_cond.name or name)
    assert named_cond.name, 'must provide name for anonymous condtions!'
    condition_id = next(self._condition_id_counter)
    self.gen.fact(fn.condition(condition_id))
    requirements = self.checked_spec_clauses(named_cond, body=True, required_from=name)
    for pred in requirements:
        self.gen.fact(fn.condition_requirement(condition_id, pred.name, *pred.args))
    if imposed_spec:
        imposed_constraints = self.checked_spec_clauses(imposed_spec, body=False, required_from=name)
        for pred in imposed_constraints:
            if (pred.name in ('node', 'virtual_node')):
                continue
            self.gen.fact(fn.imposed_constraint(condition_id, pred.name, *pred.args))
    return condition_id
Generate facts for a dependency or virtual provider condition.

Arguments:
    required_spec (spack.spec.Spec): the spec that triggers this condition
    imposed_spec (spack.spec.Spec or None): the sepc with constraints that
        are imposed when this condition is triggered
    name (str or None): name for `required_spec` (required if
        required_spec is anonymous, ignored if not)

Returns:
    int: id of the condition created by this function
def condition(self, required_spec, imposed_spec=None, name=None):
    'Generate facts for a dependency or virtual provider condition.\n\n        Arguments:\n            required_spec (spack.spec.Spec): the spec that triggers this condition\n            imposed_spec (spack.spec.Spec or None): the sepc with constraints that\n                are imposed when this condition is triggered\n            name (str or None): name for `required_spec` (required if\n                required_spec is anonymous, ignored if not)\n\n        Returns:\n            int: id of the condition created by this function\n        '
    named_cond = required_spec.copy()
    named_cond.name = (named_cond.name or name)
    assert named_cond.name, 'must provide name for anonymous condtions!'
    condition_id = next(self._condition_id_counter)
    self.gen.fact(fn.condition(condition_id))
    requirements = self.checked_spec_clauses(named_cond, body=True, required_from=name)
    for pred in requirements:
        self.gen.fact(fn.condition_requirement(condition_id, pred.name, *pred.args))
    if imposed_spec:
        imposed_constraints = self.checked_spec_clauses(imposed_spec, body=False, required_from=name)
        for pred in imposed_constraints:
            if (pred.name in ('node', 'virtual_node')):
                continue
            self.gen.fact(fn.imposed_constraint(condition_id, pred.name, *pred.args))
    return condition_id