예제 #1
0
파일: ebuild_src.py 프로젝트: ulm/pkgcore
def generate_required_use(self):
    if self.eapi.options.has_required_use:
        data = self.data.pop("REQUIRED_USE", "")
        if data:
            operators = {
                "||": boolean.OrRestriction,
                "": boolean.AndRestriction,
                "^^": boolean.JustOneRestriction
            }

            def _invalid_op(msg, *args):
                raise metadata_errors.MetadataException(
                    self, 'eapi', f'REQUIRED_USE: {msg}')

            if self.eapi.options.required_use_one_of:
                operators['??'] = boolean.AtMostOneOfRestriction
            else:
                operators['??'] = partial(
                    _invalid_op,
                    f"EAPI '{self.eapi}' doesn't support '??' operator")

            return conditionals.DepSet.parse(
                data,
                values.ContainmentMatch2,
                operators=operators,
                element_func=_mk_required_use_node)
    return conditionals.DepSet()
예제 #2
0
def _render_atom(value, namespace, attr):
    a = namespace.atom_kls(value)
    if isinstance(a, atom.transitive_use_atom):
        a.restrictions
        # XXX bit of a hack.
        a = conditionals.DepSet(a.restrictions, atom.atom, True)
        a = a.evaluate_depset(getattr(namespace, 'use', ()))
        a = AndRestriction(*a.restrictions)
    setattr(namespace, attr, a)
예제 #3
0
def get_bdepend(self):
    if "BDEPEND" in self.eapi.metadata_keys:
        return generate_depset(atom, "BDEPEND", self)
    return conditionals.DepSet()