コード例 #1
0
ファイル: restricts.py プロジェクト: floppym/pkgcore
    def match(self, pkginst):
        if self.droprev:
            r1, r2 = None, None
        else:
            r1, r2 = self.rev, pkginst.revision

        return (cpv.ver_cmp(pkginst.version, r2, self.ver, r1) in self.vals) != self.negate
コード例 #2
0
    def match(self, pkginst):
        if self.droprev:
            r1, r2 = None, None
        else:
            r1, r2 = self.rev, pkginst.revision

        return (cpv.ver_cmp(pkginst.version, r2, self.ver, r1) in self.vals) \
            != self.negate
コード例 #3
0
ファイル: results.py プロジェクト: sbraz/pkgcheck
 def __lt__(self, other, cmp=None):
     try:
         if cmp is None:
             cmp = cpv.ver_cmp(*(self.ver_rev + other.ver_rev))
         if cmp < 0:
             return True
         elif cmp > 0:
             return False
     except AttributeError:
         pass
     return super().__lt__(other)
コード例 #4
0
    def match(self, pkg, *args, **kwargs):
        if self.droprev:
            r1, r2 = None, None
        else:
            r1, r2 = self.rev, pkg.revision

        if pkg.version is None:
            return False

        return (cpv.ver_cmp(pkg.version, r2, self.ver, r1)
                in self.vals) != self.negate
コード例 #5
0
ファイル: results.py プロジェクト: sbraz/pkgcheck
 def __lt__(self, other):
     cmp = None
     try:
         # sort by line number for matching versions
         cmp = cpv.ver_cmp(*(self.ver_rev + other.ver_rev))
         if cmp == 0:
             if self.lineno < other.lineno:
                 return True
             elif self.lineno > other.lineno:
                 return False
     except AttributeError:
         pass
     return super().__lt__(other, cmp=cmp)
コード例 #6
0
ファイル: atom.py プロジェクト: houseofsuns/pkgcore
    def __cmp__(self, other):
        if not isinstance(other, self.__class__):
            raise TypeError("other isn't of %s type, is %s" %
                            (self.__class__, other.__class__))

        c = cmp(self.category, other.category)
        if c:
            return c

        c = cmp(self.package, other.package)
        if c:
            return c

        c = cmp(self.op, other.op)
        if c:
            return c

        c = cpv.ver_cmp(self.version, self.revision, other.version,
                        other.revision)
        if c:
            return c

        c = cmp(self.blocks, other.blocks)
        if c:
            # invert it; cmp(True, False) == 1
            # want non blockers then blockers.
            return -c

        c = cmp(self.blocks_strongly, other.blocks_strongly)
        if c:
            # want !! prior to !
            return c

        c = cmp(self.negate_vers, other.negate_vers)
        if c:
            return c

        def f(v):
            return '' if v is None else v

        c = cmp(f(self.slot), f(other.slot))
        if c:
            return c

        c = cmp(self.use, other.use)
        if c:
            return c

        return cmp(self.repo_id, other.repo_id)
コード例 #7
0
ファイル: atom.py プロジェクト: chutz/pkgcore
    def __cmp__(self, other):
        if not isinstance(other, self.__class__):
            raise TypeError("other isn't of %s type, is %s" %
                            (self.__class__, other.__class__))

        c = cmp(self.category, other.category)
        if c:
            return c

        c = cmp(self.package, other.package)
        if c:
            return c

        c = cmp(self.op, other.op)
        if c:
            return c

        c = cpv.ver_cmp(self.version, self.revision,
                        other.version, other.revision)
        if c:
            return c

        c = cmp(self.blocks, other.blocks)
        if c:
            # invert it; cmp(True, False) == 1
            # want non blockers then blockers.
            return -c

        c = cmp(self.blocks_strongly, other.blocks_strongly)
        if c:
            # want !! prior to !
            return c

        c = cmp(self.negate_vers, other.negate_vers)
        if c:
            return c

        def f(v):
            return '' if v is None else v
        c = cmp(f(self.slot), f(other.slot))
        if c:
            return c

        c = cmp(self.use, other.use)
        if c:
            return c

        return cmp(self.repo_id, other.repo_id)