aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-10-05 12:51:05 -0700
committerZac Medico <zmedico@gentoo.org>2011-10-05 12:51:05 -0700
commitfcc8105402dc5f0b55aacff0368a5977e271ec3d (patch)
tree55aa4e3c69f668b60c15c431bde527ae812d232b /pym/portage/dep
parenttest_best_match_to_list: test all permutations (diff)
downloadportage-fcc8105402dc5f0b55aacff0368a5977e271ec3d.tar.gz
portage-fcc8105402dc5f0b55aacff0368a5977e271ec3d.tar.bz2
portage-fcc8105402dc5f0b55aacff0368a5977e271ec3d.zip
match_to_list: preserve order
This allows us to properly test behavior of best_match_to_list with different permutations of the input.
Diffstat (limited to 'pym/portage/dep')
-rw-r--r--pym/portage/dep/__init__.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 8c65d669f..154b8a23e 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -1776,7 +1776,14 @@ def match_to_list(mypkg, mylist):
@rtype: List
@return: A unique list of package atoms that match the given package atom
"""
- return [ x for x in set(mylist) if match_from_list(x, [mypkg]) ]
+ matches = set()
+ result = []
+ pkgs = [mypkg]
+ for x in mylist:
+ if x not in matches and match_from_list(x, pkgs):
+ matches.add(x)
+ result.append(x)
+ return result
def best_match_to_list(mypkg, mylist):
"""