1 |
Since commit 4938b8a8a72e719b394a5c5b0c5030c160091d57, the search.addCP |
2 |
method has not worked as intended. |
3 |
|
4 |
Fixes: 4938b8a8a72e ("Display emerge search results incrementally (412471)") |
5 |
X-Gentoo-Bug: 547736 |
6 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=547736 |
7 |
--- |
8 |
pym/_emerge/search.py | 14 +++++++++++--- |
9 |
1 file changed, 11 insertions(+), 3 deletions(-) |
10 |
|
11 |
diff --git a/pym/_emerge/search.py b/pym/_emerge/search.py |
12 |
index 5a8143c..41c182d 100644 |
13 |
--- a/pym/_emerge/search.py |
14 |
+++ b/pym/_emerge/search.py |
15 |
@@ -36,6 +36,7 @@ class search(object): |
16 |
self.verbose = verbose |
17 |
self.searchdesc = searchdesc |
18 |
self.searchkey = None |
19 |
+ self._results_specified = False |
20 |
# Disable the spinner since search results are displayed |
21 |
# incrementally. |
22 |
self.spinner = None |
23 |
@@ -295,6 +296,12 @@ class search(object): |
24 |
yield ("set", setname) |
25 |
|
26 |
def addCP(self, cp): |
27 |
+ """ |
28 |
+ Add a specific cp to the search results. This modifies the |
29 |
+ behavior of the output method, so that it only displays specific |
30 |
+ packages added via this method. |
31 |
+ """ |
32 |
+ self._results_specified = True |
33 |
if not self._xmatch("match-all", cp): |
34 |
return |
35 |
self.matches["pkg"].append(cp) |
36 |
@@ -315,11 +322,12 @@ class search(object): |
37 |
metadata_keys.update(["DESCRIPTION", "HOMEPAGE", "LICENSE", "SRC_URI"]) |
38 |
metadata_keys = tuple(metadata_keys) |
39 |
|
40 |
- if self.searchkey is None: |
41 |
+ if self._results_specified: |
42 |
# Handle results added via addCP |
43 |
addCP_matches = [] |
44 |
- for mytype, match in self.matches.items(): |
45 |
- addCP_matches.append(mytype, match) |
46 |
+ for mytype, matches in self.matches.items(): |
47 |
+ for match in matches: |
48 |
+ addCP_matches.append((mytype, match)) |
49 |
iterator = iter(addCP_matches) |
50 |
|
51 |
else: |
52 |
-- |
53 |
2.3.5 |