summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-08-22 21:37:34 +0000
committerZac Medico <zmedico@gentoo.org>2007-08-22 21:37:34 +0000
commitc6a13282f89e40ee980f3e318481c468fd4716e2 (patch)
tree00e678d55fe750f9554880795b178fa5ea1cd69e
parentf7e93905cea59280770ce127d48ab3a968c1326e (diff)
downloadportage-c6a13282f89e40ee980f3e318481c468fd4716e2.tar.gz
portage-c6a13282f89e40ee980f3e318481c468fd4716e2.tar.bz2
portage-c6a13282f89e40ee980f3e318481c468fd4716e2.zip
Make best() return early when it's only given one package. (trunk r7664)
svn path=/main/branches/2.1.2/; revision=7668
-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 91b8cc164..cf8d20d4f 100644
--- a/pym/portage_versions.py
+++ b/pym/portage_versions.py
@@ -311,10 +311,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:]: