summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-05-30 21:14:32 +0000
committerZac Medico <zmedico@gentoo.org>2008-05-30 21:14:32 +0000
commitb91006f024eac5921e72a1736e48c34618e23dbf (patch)
tree7740e28a76e7aeff19142389784d45beab8bba27
parentFor consistency, make sure that a normal iterator is always returned (diff)
downloadportage-multirepo-b91006f024eac5921e72a1736e48c34618e23dbf.tar.gz
portage-multirepo-b91006f024eac5921e72a1736e48c34618e23dbf.tar.bz2
portage-multirepo-b91006f024eac5921e72a1736e48c34618e23dbf.zip
Now that dbapi._iter_match() is guaranteed to return a real iterator with
a next method(), we can just call next() and handle StopIteration. svn path=/main/trunk/; revision=10509
-rw-r--r--pym/portage/dbapi/porttree.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 685fd18c..83069bd2 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -619,10 +619,10 @@ class portdbapi(dbapi):
cpv_iter = iter(self.cp_list(mykey))
if mydep != mykey:
cpv_iter = self._iter_match(mydep, cpv_iter)
- myval = ""
- for cpv in cpv_iter:
- myval = cpv
- break
+ try:
+ myval = cpv_iter.next()
+ except StopIteration:
+ myval = ""
elif level in ("minimum-visible", "bestmatch-visible"):
# Find the minimum matching visible version. This is optimized to