Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/eshowkw/
Date: Fri, 26 Jan 2018 23:25:46
Message-Id: 1516978250.70b2518f12f63071f0192c23826188bd456698e7.mgorny@gentoo
1 commit: 70b2518f12f63071f0192c23826188bd456698e7
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 23 21:42:19 2018 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Jan 26 14:50:50 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=70b2518f
7
8 eshowkw: Always group Prefix keywords last
9
10 Always group all Prefix keywords after other types of keywords. This
11 not only ensures that fbsd sorts first but more importantly stabilizes
12 the LHS output between regular and -P variant -- that is, -P always adds
13 additional keywords at the end.
14
15 pym/gentoolkit/eshowkw/keywords_header.py | 16 ++++++++++------
16 1 file changed, 10 insertions(+), 6 deletions(-)
17
18 diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py
19 index ce3e8d4..6557f60 100644
20 --- a/pym/gentoolkit/eshowkw/keywords_header.py
21 +++ b/pym/gentoolkit/eshowkw/keywords_header.py
22 @@ -142,12 +142,16 @@ class keywords_header:
23 break
24
25 # sort by, in order (to match Bugzilla):
26 - # 1. arch, then ~arch
27 - # 2. profile stability
28 - # 3. short keywords, then long (prefix, fbsd)
29 - # 4. keyword name in reverse component order
30 - normal.sort(key=lambda kw: (kw in self.__TESTING_KW_ARCHS,
31 - levels.get(kw, 99), kw.count('-'), list(reversed(kw.split('-')))))
32 + # 1. non-prefix, then prefix (stable output between -P and not)
33 + # 2. arch, then ~arch
34 + # 3. profile stability
35 + # 4. short keywords, then long (prefix, fbsd)
36 + # 5. keyword name in reverse component order
37 + normal.sort(key=lambda kw: (self.__isPrefix(kw),
38 + kw in self.__TESTING_KW_ARCHS,
39 + levels.get(kw, 99),
40 + kw.count('-'),
41 + list(reversed(kw.split('-')))))
42 return normal
43
44 def __readAdditionalFields(self):