summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-08-22 20:40:37 +0000
committerZac Medico <zmedico@gentoo.org>2007-08-22 20:40:37 +0000
commit81f57e52f497411a562f593a5259f6d2b5010011 (patch)
tree1fce7bffb629cf30fcfa633778b0d8373eac12b6
parentb1c615a996101b42f441229805390a1dd30e0f1e (diff)
downloadportage-81f57e52f497411a562f593a5259f6d2b5010011.tar.gz
portage-81f57e52f497411a562f593a5259f6d2b5010011.tar.bz2
portage-81f57e52f497411a562f593a5259f6d2b5010011.zip
Make best() return early when it's only given one packages.
svn path=/main/trunk/; revision=7664
-rw-r--r--pym/portage/versions.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/pym/portage/versions.py b/pym/portage/versions.py
index b51b53ae5..d4699d1ab 100644
--- a/pym/portage/versions.py
+++ b/pym/portage/versions.py
@@ -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:]: