summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage_util.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/pym/portage_util.py b/pym/portage_util.py
index d318f80c2..e159c3766 100644
--- a/pym/portage_util.py
+++ b/pym/portage_util.py
@@ -81,7 +81,6 @@ def stack_dictlist(original_dicts, incremental=0, incrementals=[], ignore_none=0
overwriting matching key/value pairs for the dict[key]->list.
Returns a single dict. Higher index in lists is preferenced."""
final_dict = None
- kill_list = {}
for mydict in original_dicts:
if mydict is None:
continue
@@ -90,19 +89,21 @@ def stack_dictlist(original_dicts, incremental=0, incrementals=[], ignore_none=0
for y in mydict.keys():
if not final_dict.has_key(y):
final_dict[y] = []
- if not kill_list.has_key(y):
- kill_list[y] = []
- mydict[y].reverse()
for thing in mydict[y]:
- if thing and (thing not in kill_list[y]) and ("*" not in kill_list[y]):
- if (incremental or (y in incrementals)) and thing[0] == '-':
- if thing[1:] not in kill_list[y]:
- kill_list[y] += [thing[1:]]
- else:
- if thing not in final_dict[y]:
- final_dict[y].append(thing[:])
- mydict[y].reverse()
+ if thing:
+ if incremental or y in incrementals:
+ if thing == "-*":
+ final_dict[y] = []
+ continue
+ elif thing.startswith("-"):
+ try:
+ final_dict[y].remove(thing[1:])
+ except ValueError:
+ pass
+ continue
+ if thing not in final_dict[y]:
+ final_dict[y].append(thing)
if final_dict.has_key(y) and not final_dict[y]:
del final_dict[y]
return final_dict