aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2018-01-23 13:11:13 +0100
committerMichał Górny <mgorny@gentoo.org>2018-01-26 15:50:47 +0100
commit1a7f870b68741331f69b07e8227685e70c964202 (patch)
treea6e5d681b03b00b2183ef172cd241f0189631ef8
parenteclean: add the missing ')' in the help string of --package-names (diff)
downloadgentoolkit-1a7f870b68741331f69b07e8227685e70c964202.tar.gz
gentoolkit-1a7f870b68741331f69b07e8227685e70c964202.tar.bz2
gentoolkit-1a7f870b68741331f69b07e8227685e70c964202.zip
eshowkw: Split Prefix keyword test into separate function
-rw-r--r--pym/gentoolkit/eshowkw/keywords_header.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py
index 9c6538c..9b00d17 100644
--- a/pym/gentoolkit/eshowkw/keywords_header.py
+++ b/pym/gentoolkit/eshowkw/keywords_header.py
@@ -1,5 +1,5 @@
# vim:fileencoding=utf-8
-# Copyright 2001-2010 Gentoo Foundation
+# Copyright 2001-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
__all__ = ['keywords_header']
@@ -97,6 +97,10 @@ class keywords_header:
return [x for x in ports.archlist()
if not x.startswith('~')]
+ @staticmethod
+ def __isPrefix(k):
+ return len(k.split('-')) != 1
+
def __sortKeywords(self, keywords, prefix = False, required_keywords = []):
"""Sort keywords: order by status (IMP, then DEV, then EXP, then
prefix), then by name."""
@@ -109,10 +113,9 @@ class keywords_header:
if len(tmpkeywords) != 0:
keywords = tmpkeywords
- normal = [k for k in keywords if len(k.split('-')) == 1]
+ normal = [k for k in keywords if not self.__isPrefix(k)]
if prefix:
- longer = [k for k in keywords
- if len(k.split('-')) != 1]
+ longer = [k for k in keywords if self.__isPrefix(k)]
longer.sort()
normal.extend(longer)