commit:     8eeb4ee67da8ce2143f26f07545e666b3a4ad610
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 29 00:48:07 2019 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jul 29 00:50:23 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=8eeb4ee6

filter_flags: handle default IUSE correctly with reduce_flag

Fix comparisons to use the result of reduce_flag.

Bug: https://bugs.gentoo.org/690786
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 pym/gentoolkit/flag.py | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/pym/gentoolkit/flag.py b/pym/gentoolkit/flag.py
index 90a931a..42e8196 100644
--- a/pym/gentoolkit/flag.py
+++ b/pym/gentoolkit/flag.py
@@ -116,22 +116,21 @@ def filter_flags(use, use_expand_hidden, usemasked, 
useforced):
        """
        # clean out some environment flags, since they will most probably
        # be confusing for the user
+       use = dict((reduce_flag(flag), flag) for flag in use)
        for f in use_expand_hidden:
                f=f.lower() + "_"
-               for x in use:
-                       if f in x:
-                               use.remove(x)
+               for x in list(use):
+                       if x.startswith(f):
+                               del use[x]
        # clean out any arch's
        archlist = portage.settings["PORTAGE_ARCHLIST"].split()
-       for a in use[:]:
-               if a in archlist:
-                       use.remove(a)
+       for a in archlist:
+               use.pop(a, None)
        # dbl check if any from usemasked  or useforced are still there
        masked = usemasked + useforced
-       for a in use[:]:
-               if a in masked:
-                       use.remove(a)
-       return use
+       for a in masked:
+               use.pop(a, None)
+       return list(use.values())
 
 
 def get_all_cpv_use(cpv):

Reply via email to