From 1e05ec1d75be4bbdacf52ce22ad70c7fda75c338 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 11 Aug 2006 19:31:20 +0000 Subject: Fix stack_dictlist() so that incremental stacking behaves more like it does in config.regenerate(). svn path=/main/trunk/; revision=4213 --- pym/portage_util.py | 25 +++++++++++++------------ 1 file 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 -- cgit v1.2.3-1-g7c22