From: Zac Medico Date: Mon, 21 Sep 2009 15:29:25 +0000 (-0000) Subject: Simplify match_to_list(). Thanks to Marat Radchenko X-Git-Tag: v2.2_rc42~77 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0202f59d1ba4309d25022ecdb7faa6114f9269cd;p=portage.git Simplify match_to_list(). Thanks to Marat Radchenko for this patch from bug #276813. svn path=/main/trunk/; revision=14325 --- diff --git a/pym/portage/dep.py b/pym/portage/dep.py index b89278bdd..9d055912d 100644 --- a/pym/portage/dep.py +++ b/pym/portage/dep.py @@ -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): """