1 |
commit: da259e7cadb4726c283b1961a503509d1fa6751e |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue May 28 02:14:28 2019 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue May 28 02:35:37 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=da259e7c |
7 |
|
8 |
metadata.xml: filter empty elements (bug 686886) |
9 |
|
10 |
Bug: https://bugs.gentoo.org/686886 |
11 |
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> |
12 |
|
13 |
lib/portage/xml/metadata.py | 10 +++++----- |
14 |
1 file changed, 5 insertions(+), 5 deletions(-) |
15 |
|
16 |
diff --git a/lib/portage/xml/metadata.py b/lib/portage/xml/metadata.py |
17 |
index 24888bb47..e479f2dd2 100644 |
18 |
--- a/lib/portage/xml/metadata.py |
19 |
+++ b/lib/portage/xml/metadata.py |
20 |
@@ -172,16 +172,16 @@ class _Upstream(object): |
21 |
|
22 |
def upstream_bugtrackers(self): |
23 |
"""Retrieve upstream bugtracker location from xml node.""" |
24 |
- return [e.text for e in self.node.findall('bugs-to')] |
25 |
+ return [e.text for e in self.node.findall('bugs-to') if e.text] |
26 |
|
27 |
def upstream_changelogs(self): |
28 |
"""Retrieve upstream changelog location from xml node.""" |
29 |
- return [e.text for e in self.node.findall('changelog')] |
30 |
+ return [e.text for e in self.node.findall('changelog') if e.text] |
31 |
|
32 |
def upstream_documentation(self): |
33 |
"""Retrieve upstream documentation location from xml node.""" |
34 |
result = [] |
35 |
- for elem in self.node.findall('doc'): |
36 |
+ for elem in (e for e in self.node.findall('doc') if e.text): |
37 |
lang = elem.get('lang') |
38 |
result.append((elem.text, lang)) |
39 |
return result |
40 |
@@ -192,7 +192,7 @@ class _Upstream(object): |
41 |
|
42 |
def upstream_remoteids(self): |
43 |
"""Retrieve upstream remote ID from xml node.""" |
44 |
- return [(e.text, e.get('type')) for e in self.node.findall('remote-id')] |
45 |
+ return [(e.text, e.get('type')) for e in self.node.findall('remote-id') if e.text] |
46 |
|
47 |
|
48 |
class MetaDataXML(object): |
49 |
@@ -311,7 +311,7 @@ class MetaDataXML(object): |
50 |
self._descriptions = tuple() |
51 |
else: |
52 |
self._descriptions = tuple(e.text \ |
53 |
- for e in self._xml_tree.findall("longdescription")) |
54 |
+ for e in self._xml_tree.findall("longdescription") if e.text) |
55 |
|
56 |
return self._descriptions |