Make best() return early when it's only given one packages.
authorZac Medico <zmedico@gentoo.org>
Wed, 22 Aug 2007 20:40:37 +0000 (20:40 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 22 Aug 2007 20:40:37 +0000 (20:40 -0000)
svn path=/main/trunk/; revision=7664

pym/portage/versions.py

index b51b53ae543cb91a871064cb92983d1e453c9099..d4699d1ab7103d303cd9ddb63037a20212416254 100644 (file)
@@ -306,10 +306,10 @@ def catsplit(mydep):
 
 def best(mymatches):
        """Accepts None arguments; assumes matches are valid."""
-       if mymatches is None:
-               return ""
-       if not len(mymatches):
+       if not mymatches:
                return ""
+       if len(mymatches) == 1:
+               return mymatches[0]
        bestmatch = mymatches[0]
        p2 = catpkgsplit(bestmatch)[1:]
        for x in mymatches[1:]: