1 |
On Tue, Jan 23, 2018 at 4:48 PM, Michał Górny <mgorny@g.o> wrote: |
2 |
|
3 |
> Always group all Prefix keywords after other types of keywords. This |
4 |
> not only ensures that fbsd sorts first but more importantly stabilizes |
5 |
> the LHS output between regular and -P variant -- that is, -P always adds |
6 |
> additional keywords at the end. |
7 |
> --- |
8 |
> pym/gentoolkit/eshowkw/keywords_header.py | 16 ++++++++++------ |
9 |
> 1 file changed, 10 insertions(+), 6 deletions(-) |
10 |
> |
11 |
> diff --git a/pym/gentoolkit/eshowkw/keywords_header.py |
12 |
> b/pym/gentoolkit/eshowkw/keywords_header.py |
13 |
> index 41b8ba4..1b64bfd 100644 |
14 |
> --- a/pym/gentoolkit/eshowkw/keywords_header.py |
15 |
> +++ b/pym/gentoolkit/eshowkw/keywords_header.py |
16 |
> @@ -142,12 +142,16 @@ class keywords_header: |
17 |
> break |
18 |
> |
19 |
> # sort by, in order (to match Bugzilla): |
20 |
> - # 1. arch, then ~arch |
21 |
> - # 2. profile stability |
22 |
> - # 3. short keywords, then long (prefix, fbsd) |
23 |
> - # 4. keyword name in reverse component order |
24 |
> - normal.sort(key=lambda kw: (kw in self.__TESTING_KW_ARCHS, |
25 |
> - levels.get(kw, 99), kw.count('-'), |
26 |
> list(reversed(kw.split('-'))))) |
27 |
> + # 1. non-prefix, then prefix (stable output between -P and |
28 |
> not) |
29 |
> + # 2. arch, then ~arch |
30 |
> + # 3. profile stability |
31 |
> + # 4. short keywords, then long (prefix, fbsd) |
32 |
> + # 5. keyword name in reverse component order |
33 |
> + normal.sort(key=lambda kw: (self.__isPrefix(kw), |
34 |
> + kw in self.__TESTING_KW_ARCHS, |
35 |
> + levels.get(kw, 99), |
36 |
> + kw.count('-'), |
37 |
> + list(reversed(kw.split('-'))))) |
38 |
> |
39 |
|
40 |
I'm a bit sad about this lambda because its ended up a bit long. |
41 |
|
42 |
What are your thoughts on splitting it out? |
43 |
|
44 |
return normal |
45 |
> |
46 |
> def __readAdditionalFields(self): |
47 |
> -- |
48 |
> 2.16.1 |
49 |
> |
50 |
> |
51 |
> |