Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: Zac Medico <zmedico@g.o>
Cc: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH v2] parse_metadata_use: prefer first language found (bug 599060)
Date: Sun, 06 Nov 2016 20:53:13
Message-Id: 20161106215255.7919e9fe.mgorny@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH v2] parse_metadata_use: prefer first language found (bug 599060) by Zac Medico
1 On Sun, 6 Nov 2016 12:37:22 -0800
2 Zac Medico <zmedico@g.o> wrote:
3
4 > Descriptions may exist for multiple languages, so ignore all except
5 > the first description found for a particular value of restrict, so
6 > that use.local.desc content is consistent.
7 >
8 > X-Gentoo-Bug: 599060
9 > X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=599060
10 > ---
11 > pym/portage/xml/metadata.py | 10 ++++++++++
12 > 1 file changed, 10 insertions(+)
13 >
14 > [PATCH v2] fix to handle multiple values of restrict
15 >
16 > diff --git a/pym/portage/xml/metadata.py b/pym/portage/xml/metadata.py
17 > index 4940bfb..1bc1c78 100644
18 > --- a/pym/portage/xml/metadata.py
19 > +++ b/pym/portage/xml/metadata.py
20 > @@ -455,6 +455,16 @@ def parse_metadata_use(xml_tree):
21 > if pkg_flag is not None:
22 > flag_restrict = flag.get("restrict")
23 >
24 > + # Descriptions may exist for multiple languages, so
25 > + # ignore all except the first description found for a
26 > + # particular value of restrict (see bug 599060).
27 > + try:
28 > + uselist[pkg_flag][flag_restrict]
29 > + except KeyError:
30 > + pass
31 > + else:
32 > + continue
33 > +
34 > # emulate the Element.itertext() method from python-2.7
35 > inner_text = []
36 > stack = []
37
38 This really doesn't fix the bug at hand. We should always prefer
39 English descriptions, either through lang="en" or lang="".
40
41 --
42 Best regards,
43 Michał Górny
44 <http://dev.gentoo.org/~mgorny/>

Replies