Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH v2] parse_metadata_use: prefer first language found (bug 599060)
Date: Sun, 06 Nov 2016 20:39:47
Message-Id: 1478464642-31583-1-git-send-email-zmedico@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] parse_metadata_use: prefer first language found (bug 599060) by Zac Medico
1 Descriptions may exist for multiple languages, so ignore all except
2 the first description found for a particular value of restrict, so
3 that use.local.desc content is consistent.
4
5 X-Gentoo-Bug: 599060
6 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=599060
7 ---
8 pym/portage/xml/metadata.py | 10 ++++++++++
9 1 file changed, 10 insertions(+)
10
11 [PATCH v2] fix to handle multiple values of restrict
12
13 diff --git a/pym/portage/xml/metadata.py b/pym/portage/xml/metadata.py
14 index 4940bfb..1bc1c78 100644
15 --- a/pym/portage/xml/metadata.py
16 +++ b/pym/portage/xml/metadata.py
17 @@ -455,6 +455,16 @@ def parse_metadata_use(xml_tree):
18 if pkg_flag is not None:
19 flag_restrict = flag.get("restrict")
20
21 + # Descriptions may exist for multiple languages, so
22 + # ignore all except the first description found for a
23 + # particular value of restrict (see bug 599060).
24 + try:
25 + uselist[pkg_flag][flag_restrict]
26 + except KeyError:
27 + pass
28 + else:
29 + continue
30 +
31 # emulate the Element.itertext() method from python-2.7
32 inner_text = []
33 stack = []
34 --
35 2.7.4

Replies