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:44
Message-Id: 1516978247.1a7f870b68741331f69b07e8227685e70c964202.mgorny@gentoo
1 commit: 1a7f870b68741331f69b07e8227685e70c964202
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 23 12:11:13 2018 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Jan 26 14:50:47 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=1a7f870b
7
8 eshowkw: Split Prefix keyword test into separate function
9
10 pym/gentoolkit/eshowkw/keywords_header.py | 11 +++++++----
11 1 file changed, 7 insertions(+), 4 deletions(-)
12
13 diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py
14 index 9c6538c..9b00d17 100644
15 --- a/pym/gentoolkit/eshowkw/keywords_header.py
16 +++ b/pym/gentoolkit/eshowkw/keywords_header.py
17 @@ -1,5 +1,5 @@
18 # vim:fileencoding=utf-8
19 -# Copyright 2001-2010 Gentoo Foundation
20 +# Copyright 2001-2018 Gentoo Foundation
21 # Distributed under the terms of the GNU General Public License v2
22
23 __all__ = ['keywords_header']
24 @@ -97,6 +97,10 @@ class keywords_header:
25 return [x for x in ports.archlist()
26 if not x.startswith('~')]
27
28 + @staticmethod
29 + def __isPrefix(k):
30 + return len(k.split('-')) != 1
31 +
32 def __sortKeywords(self, keywords, prefix = False, required_keywords = []):
33 """Sort keywords: order by status (IMP, then DEV, then EXP, then
34 prefix), then by name."""
35 @@ -109,10 +113,9 @@ class keywords_header:
36 if len(tmpkeywords) != 0:
37 keywords = tmpkeywords
38
39 - normal = [k for k in keywords if len(k.split('-')) == 1]
40 + normal = [k for k in keywords if not self.__isPrefix(k)]
41 if prefix:
42 - longer = [k for k in keywords
43 - if len(k.split('-')) != 1]
44 + longer = [k for k in keywords if self.__isPrefix(k)]
45 longer.sort()
46 normal.extend(longer)