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