Exemplo n.º 1
0
 def search(self, searcher, _epochre=re.compile("[0-9]+:")):
     myname = self.name
     myversionwithepoch, myarch = splitarch(self.version)
     myversionwithoutepoch = _epochre.sub("", myversionwithepoch)
     ratio = 0
     ic = searcher.ignorecase
     for nameversion, cutoff in searcher.nameversion:
         if _epochre.search(nameversion):
             myversion = myversionwithepoch
         else:
             myversion = myversionwithoutepoch
         if '@' in nameversion:
             _, ratio1 = globdistance(
                 nameversion, "%s-%s@%s" % (myname, myversion, myarch),
                 cutoff, ic)
             _, ratio2 = globdistance(nameversion,
                                      "%s@%s" % (myname, myarch), cutoff,
                                      ic)
             _, ratio3 = globdistance(
                 nameversion,
                 "%s-%s@%s" % (myname, splitrelease(myversion)[0], myarch),
                 cutoff, ic)
         else:
             _, ratio1 = globdistance(nameversion, myname, cutoff, ic)
             _, ratio2 = globdistance(nameversion,
                                      "%s-%s" % (myname, myversion), cutoff,
                                      ic)
             _, ratio3 = globdistance(
                 nameversion,
                 "%s-%s" % (myname, splitrelease(myversion)[0]), cutoff, ic)
         ratio = max(ratio, ratio1, ratio2, ratio3)
     if ratio:
         searcher.addResult(self, ratio)
Exemplo n.º 2
0
 def search(self, searcher, _epochre=re.compile("[0-9]+:")):
     myname = self.name
     myversionwithepoch, myarch = splitarch(self.version)
     myversionwithoutepoch = _epochre.sub("", myversionwithepoch)
     ratio = 0
     ic = searcher.ignorecase
     for nameversion, cutoff in searcher.nameversion:
         if _epochre.search(nameversion):
             myversion = myversionwithepoch
         else:
             myversion = myversionwithoutepoch
         if '@' in nameversion:
             _, ratio1 = globdistance(nameversion, "%s-%s@%s" %
                                      (myname, myversion, myarch),
                                      cutoff, ic)
             _, ratio2 = globdistance(nameversion, "%s@%s" %
                                      (myname, myarch), cutoff, ic)
             _, ratio3 = globdistance(nameversion, "%s-%s@%s" %
                                      (myname, splitrelease(myversion)[0],
                                       myarch), cutoff, ic)
         else:
             _, ratio1 = globdistance(nameversion, myname, cutoff, ic)
             _, ratio2 = globdistance(nameversion,
                                      "%s-%s" % (myname, myversion),
                                      cutoff, ic)
             _, ratio3 = globdistance(nameversion, "%s-%s" %
                                      (myname, splitrelease(myversion)[0]),
                                      cutoff, ic)
         ratio = max(ratio, ratio1, ratio2, ratio3)
     if ratio:
         searcher.addResult(self, ratio)
Exemplo n.º 3
0
 def search(self, searcher, _epochre=re.compile("[0-9]+:")):
     myname = self.name
     myversion, myarch = splitarch(self.version)
     myversion = _epochre.sub("", myversion)
     ratio = 0
     for nameversion, cutoff in searcher.nameversion:
         nameversion = _epochre.sub("", nameversion)
         if '@' in nameversion:
             _, ratio1 = globdistance(nameversion, "%s-%s" %
                                      (myname, self.version), cutoff)
             _, ratio2 = globdistance(nameversion, "%s@%s" %
                                      (myname, myarch), cutoff)
             _, ratio3 = globdistance(nameversion, "%s-%s@%s" %
                                      (myname, splitrelease(myversion)[0],
                                       myarch), cutoff)
         else:
             _, ratio1 = globdistance(nameversion, myname, cutoff)
             _, ratio2 = globdistance(nameversion,
                                      "%s-%s" % (myname, myversion), cutoff)
             _, ratio3 = globdistance(nameversion, "%s-%s" %
                                      (myname, splitrelease(myversion)[0]),
                                      cutoff)
         ratio = max(ratio, ratio1, ratio2, ratio3)
     if ratio:
         searcher.addResult(self, ratio)