Make PackageSet.findAtomForPackage() just return the first atom found
authorZac Medico <zmedico@gentoo.org>
Fri, 30 May 2008 06:50:34 +0000 (06:50 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 30 May 2008 06:50:34 +0000 (06:50 -0000)
since best_match_to_list() won't work correctly for atoms matched
via PROVIDE.

svn path=/main/trunk/; revision=10501

pym/portage/sets/base.py

index 3f85965bcf9b86d0b246acd99d9c2dcf24afe638..2ae4723fb30c5f0c0942f821e885bed2f865e87f 100644 (file)
@@ -105,10 +105,10 @@ class PackageSet(object):
                None if there are no matches.  This matches virtual arguments against
                the PROVIDE metadata.  This can raise an InvalidDependString exception
                if an error occurs while parsing PROVIDE."""
-               atoms = list(self.iterAtomsForPackage(pkg))
-               if not atoms:
+               try:
+                       return self.iterAtomsForPackage(pkg).next()
+               except StopIteration:
                        return None
-               return best_match_to_list(pkg, atoms)
 
        def iterAtomsForPackage(self, pkg):
                """