summaryrefslogtreecommitdiffstats
path: root/pym/repoman/utilities.py
diff options
context:
space:
mode:
authorMichał Górny <gentoo@mgorny.alt.pl>2010-08-27 18:47:22 +0200
committerZac Medico <zmedico@gentoo.org>2010-08-27 09:57:58 -0700
commite081b9cf09a13a420ebace67b89a0a72fe88641b (patch)
treec6ec80f7f54bc58c0aa044aede6075675a77d16e /pym/repoman/utilities.py
parent1c0374f06bb251e7e4ec914a706c78f7451484eb (diff)
downloadportage-e081b9cf09a13a420ebace67b89a0a72fe88641b.tar.gz
portage-e081b9cf09a13a420ebace67b89a0a72fe88641b.tar.bz2
portage-e081b9cf09a13a420ebace67b89a0a72fe88641b.zip
Support returning multiple flag descriptions when restrict is used.
Return a dict of dicts in parse_metadata_use(), with second-level keys being the restrict strings (or None when no restrict). When generating use.local.desc, use the description from the possibly-highest-matching atom.
Diffstat (limited to 'pym/repoman/utilities.py')
-rw-r--r--pym/repoman/utilities.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index 3df437a01..a6c24d862 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -135,13 +135,7 @@ def parse_metadata_use(xml_tree):
pkg_flag = flag.get("name")
if pkg_flag is None:
raise exception.ParseError("missing 'name' attribute for 'flag' tag")
-
- if uselist.get(pkg_flag):
- # It's possible to have multiple elements with the same
- # flag name, but different 'restrict' attributes that
- # specify version restrictions. We use only the first
- # occurance.
- continue
+ flag_restrict = flag.get("restrict")
# emulate the Element.itertext() method from python-2.7
inner_text = []
@@ -158,7 +152,11 @@ def parse_metadata_use(xml_tree):
stack.append(obj.tail)
stack.extend(reversed(obj))
- uselist[pkg_flag] = " ".join("".join(inner_text).split())
+ if pkg_flag not in uselist:
+ uselist[pkg_flag] = {}
+
+ # (flag_restrict can be None)
+ uselist[pkg_flag][flag_restrict] = " ".join("".join(inner_text).split())
return uselist