diff options
author | Brian Dolbec <brian.dolbec@gmail.com> | 2011-01-09 17:09:08 -0800 |
---|---|---|
committer | Brian Dolbec <brian.dolbec@gmail.com> | 2011-01-09 17:09:08 -0800 |
commit | 000ce49860b253ad6c917c5a58bc0ff31225134a (patch) | |
tree | e65b00fc8c8fdbb7e6803c787ec84651f11da6b1 /pym/gentoolkit/helpers.py | |
parent | remove the use of uniqify as it does not work correctly with atoms. (diff) | |
download | gentoolkit-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.py | 14 |
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: |