aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <brian.dolbec@gmail.com>2011-01-09 17:09:08 -0800
committerBrian Dolbec <brian.dolbec@gmail.com>2011-01-09 17:09:08 -0800
commit000ce49860b253ad6c917c5a58bc0ff31225134a (patch)
treee65b00fc8c8fdbb7e6803c787ec84651f11da6b1 /pym/gentoolkit/helpers.py
parentremove the use of uniqify as it does not work correctly with atoms. (diff)
downloadgentoolkit-000ce49860b253ad6c917c5a58bc0ff31225134a.tar.gz
gentoolkit-000ce49860b253ad6c917c5a58bc0ff31225134a.tar.bz2
gentoolkit-000ce49860b253ad6c917c5a58bc0ff31225134a.zip
create a new uniqify_atoms() to properly handle a list of atom instances.
set the reverse dependency lookup to use it.
Diffstat (limited to 'pym/gentoolkit/helpers.py')
-rw-r--r--pym/gentoolkit/helpers.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/pym/gentoolkit/helpers.py b/pym/gentoolkit/helpers.py
index ab0cdbd..cf1b138 100644
--- a/pym/gentoolkit/helpers.py
+++ b/pym/gentoolkit/helpers.py
@@ -449,7 +449,7 @@ def get_bintree_cpvs(predicate=None):
for cpv in chain.from_iterable(BINDB.cp_list(x) for x in installed_cps):
yield cpv
-
+
def print_file(path):
"""Display the contents of a file."""
@@ -476,4 +476,16 @@ def uniqify(seq, preserve_order=True):
return result
+def uniqify_atoms(seq):
+ """Return a uniqified list."""
+ seen = set()
+ result = []
+ for x in seq:
+ dep = x.get_depstr()
+ if dep not in seen:
+ result.append(x)
+ seen.add(dep)
+
+ return result
+
# vim: set ts=4 sw=4 tw=79: