commit:     4542a3fc2042bb029e0a7b124724c6af41d6ff87
Author:     Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 24 12:08:20 2015 +0000
Commit:     Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
CommitDate: Thu Jun 25 12:46:14 2015 +0000
URL:        https://gitweb.gentoo.org/proj/gnome.git/commit/?id=4542a3fc

scripts/gen_archlist: rename do_not_want function

Give it a better name of split logic down in multiple lines, it is
easier to read that a kilometric if line.

Logic was inverted to avoid double negation in match_wanted_atoms
function.

 scripts/gen_archlist.py | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/scripts/gen_archlist.py b/scripts/gen_archlist.py
index 9a74d21..9b60f03 100755
--- a/scripts/gen_archlist.py
+++ b/scripts/gen_archlist.py
@@ -131,15 +131,21 @@ def get_kws(cpv, arches=ARCHES):
     ]
 
 
-def do_not_want(cpv, release=None):
-    """
-    Check if a package atom is p.masked or has empty keywords, or does not
-    belong to a release
+def can_stabilize_cpv(cpv, release=None):
+    """Whether `cpv` matches stabilization criteria.
+
+    `cpv` must:
+    * belong to the release
+    * not be p.masked
+    * have keywords
     """
-    if release and not belongs_release(cpv, release) or not \
-        portage.portdb.visible([cpv]) or not get_kws(cpv, arches=ALL_ARCHES):
-        return True
-    return False
+    if release and not belongs_release(cpv, release):
+        return False
+    if not portage.portdb.visible([cpv]):
+        return False
+    if not get_kws(cpv, arches=ALL_ARCHES):
+        return False
+    return True
 
 
 def match_wanted_atoms(atom, release=None):
@@ -155,7 +161,7 @@ def match_wanted_atoms(atom, release=None):
 
     return [
         cpv for cpv in reversed(portage.portdb.xmatch('match-all', atom))
-        if not do_not_want(cpv, release)
+        if can_stabilize_cpv(cpv, release)
     ]
 
 

Reply via email to