Simplify match_to_list(). Thanks to Marat Radchenko <marat@slonopotamus.org>
authorZac Medico <zmedico@gentoo.org>
Mon, 21 Sep 2009 15:29:25 +0000 (15:29 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 21 Sep 2009 15:29:25 +0000 (15:29 -0000)
for this patch from bug #276813.

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

pym/portage/dep.py

index b89278bddd35e01b96c0c56394c751a91926c16d..9d055912dd9b02e6c1a7f2a4854dfedafa6b164a 100644 (file)
@@ -956,14 +956,7 @@ def match_to_list(mypkg, mylist):
        @rtype: List
        @return: A unique list of package atoms that match the given package atom
        """
-       matches = []
-       for x in mylist:
-               if not isinstance(x, Atom):
-                       x = Atom(x)
-               if match_from_list(x, [mypkg]):
-                       if x not in matches:
-                               matches.append(x)
-       return matches
+       return [ x for x in set(mylist) if match_from_list(x, [mypkg]) ]
 
 def best_match_to_list(mypkg, mylist):
        """