From: Brian Dolbec Date: Wed, 26 Jan 2011 07:12:09 +0000 (-0800) Subject: fix the missing unset flags issue due to my misleading variable name for "cleaned... X-Git-Tag: gentoolkit-0.3.0~17 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=809fc667867c33ef1cb829af7f9061431605e3ab;p=gentoolkit.git fix the missing unset flags issue due to my misleading variable name for "cleaned unset flags". --- diff --git a/pym/gentoolkit/analyse/analyse.py b/pym/gentoolkit/analyse/analyse.py index 275bbc0..e9ca36e 100644 --- a/pym/gentoolkit/analyse/analyse.py +++ b/pym/gentoolkit/analyse/analyse.py @@ -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 =", diff --git a/pym/gentoolkit/analyse/lib.py b/pym/gentoolkit/analyse/lib.py index 09f0983..901d757 100644 --- a/pym/gentoolkit/analyse/lib.py +++ b/pym/gentoolkit/analyse/lib.py @@ -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): diff --git a/pym/gentoolkit/analyse/output.py b/pym/gentoolkit/analyse/output.py index b0ed943..90db064 100644 --- a/pym/gentoolkit/analyse/output.py +++ b/pym/gentoolkit/analyse/output.py @@ -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)))