fix the missing unset flags issue due to my misleading variable name for "cleaned...
authorBrian Dolbec <brian.dolbec@gmail.com>
Wed, 26 Jan 2011 07:12:09 +0000 (23:12 -0800)
committerBrian Dolbec <brian.dolbec@gmail.com>
Wed, 26 Jan 2011 07:12:09 +0000 (23:12 -0800)
pym/gentoolkit/analyse/analyse.py
pym/gentoolkit/analyse/lib.py
pym/gentoolkit/analyse/output.py

index 275bbc093b24a8c9c31280b044060460eb8ef360..e9ca36e5b5abcbe7f5212c34eb443d16ab05e416 100644 (file)
@@ -424,11 +424,11 @@ class Analyse(ModuleBase):
                        print("   cat/pkg-ver                                 USE Flags")
                        blankline = lambda: None
                for cpv in cpvs:
-                       (flag_plus, flag_neg, cleaned) = flags.analyse_cpv(cpv)
+                       (flag_plus, flag_neg, unset) = flags.analyse_cpv(cpv)
                        if self.options["unset"]:
-                               self.printer(cpv, "", (flag_plus, flag_neg, cleaned))
+                               self.printer(cpv, "", (flag_plus, flag_neg, unset))
                        else:
-                               self.printer(cpv, "", (flag_plus, [], cleaned))
+                               self.printer(cpv, "", (flag_plus, flag_neg, []))
                if not self.options['quiet']:
                        print("===================================================")
                        print("Total number of installed ebuilds =",
index 09f09834ed82ae45aac7537e34b7e91c47dbc3cb..901d75701991be1d55bbe27746b0316748ba6dc6 100644 (file)
@@ -85,8 +85,8 @@ class FlagAnalyzer(object):
                        plus = usedflags
                minus = defaults.difference(usedflags)
                unset = iuse.difference(defaults, plus, minus)
-               cleaned = self.remove_expanding(unset)
-               return (plus, minus, cleaned)
+               cleaned_unset = self.remove_expanding(unset)
+               return (plus, minus, cleaned_unset)
 
        def analyse_pkg(self, pkg):
                """Gets all relevent USE flag info for a pkg and breaks them down
@@ -98,7 +98,9 @@ class FlagAnalyzer(object):
                @return (plus, minus, unset) sets of USE flags
                """
                installed = set(self.pkg_used(pkg))
+               print("installed =", installed)
                iuse =  set(reduce_flags(self.pkg_flags(pkg)))
+               print("iuse =", iuse)
                return self._analyse(installed, iuse)
 
        def pkg_used(self, pkg):
index b0ed94327daa8cf47f472100a6e35f1c22ed250c..90db064a98980cae5c2f05dbbcfd7c98eccd060f 100644 (file)
@@ -138,6 +138,7 @@ class AnalysisPrinter(CpvValueWrapper):
                (plus, minus, cleaned) = flags
                _plus = []
                _minus = []
+               _cleaned = []
                for flag in plus:
                        _flag = flag.strip()
                        if _flag:
@@ -146,30 +147,39 @@ class AnalysisPrinter(CpvValueWrapper):
                        _flag = flag.strip()
                        if _flag:
                                _minus.append(_flag)
+               for flag in cleaned:
+                       _flag = flag.strip()
+                       if _flag:
+                               _cleaned.append(_flag)
                #print("cpv=", key, "_plus=", _plus, "_minus=", _minus)
                self.print_fn(key, (plus, minus, cleaned))
 
        def print_pkg_verbose(self, cpv, flags):
                """Verbosely prints the pkg's use flag info.
                """
-               (plus, minus, cleaned) = flags
+               (plus, minus, unset) = flags
                _flags = []
                for flag in plus:
                        _flags.append(pp.useflag((flag), True))
                for flag in minus:
-                       _flags.append(pp.useflag(('-'+flag), False))
-               
+                       _flags.append(pp.useflag(('-' + flag), False))
+               for flag in unset:
+                       _flags.append(pp.globaloption('-' + flag))
+                       
                print(self._format_values(cpv, ", ".join(_flags)))
 
+
        def print_pkg_quiet(self, cpv, flags):
                """Verbosely prints the pkg's use flag info.
                """
-               (plus, minus, cleaned) = flags
+               (plus, minus, unset) = flags
                _flags = []
                for flag in plus:
                        _flags.append(pp.useflag((flag), True))
                for flag in minus:
                        _flags.append(pp.useflag(('-'+flag), False))
+               for flag in unset:
+                       _flags.append(pp.globaloption('-' + flag))
                
                print(self._format_values(cpv, ", ".join(_flags)))