diff options
| author | Christian Ruppert <idl0r@gentoo.org> | 2011-05-28 23:22:12 +0200 |
|---|---|---|
| committer | Christian Ruppert <idl0r@gentoo.org> | 2011-05-28 23:22:12 +0200 |
| commit | c9bd257c7cdd4c64ccefb687643958098c3c6d75 (patch) | |
| tree | 8fd4e3f7e7fa40b21bcf754ba6594882c4def80b /pym | |
| parent | 85af50f1a7234c56077556756400f2a540f76605 (diff) | |
| parent | d04544e03702d7358a8ccdee4a7696cdcba91b9c (diff) | |
| download | gentoolkit-c9bd257c7cdd4c64ccefb687643958098c3c6d75.tar.gz | |
Merge branch 'gentoolkit' of git+ssh://overlays.gentoo.org/proj/gentoolkit into gentoolkit
Diffstat (limited to 'pym')
19 files changed, 132 insertions, 106 deletions
diff --git a/pym/gentoolkit/dependencies.py b/pym/gentoolkit/dependencies.py index feced63..0396952 100644 --- a/pym/gentoolkit/dependencies.py +++ b/pym/gentoolkit/dependencies.py @@ -115,7 +115,7 @@ class Dependencies(Query): max_depth=1, printer_fn=None, # The rest of these are only used internally: - depth=0, + depth=1, seen=None, depcache=None, result=None @@ -151,32 +151,29 @@ class Dependencies(Query): except KeyError: pkgdep = Query(dep.atom).find_best() depcache[dep.atom] = pkgdep - if pkgdep and pkgdep.cpv in seen: + if not pkgdep: continue - if depth < max_depth or max_depth <= 0: - + elif pkgdep.cpv in seen: + continue + if depth <= max_depth or max_depth == 0: if printer_fn is not None: printer_fn(depth, pkgdep, dep) - if not pkgdep: - continue + result.append((depth,pkgdep)) seen.add(pkgdep.cpv) - result.append(( - depth, - pkgdep.deps.graph_depends( - max_depth=max_depth, - printer_fn=printer_fn, - # The rest of these are only used internally: - depth=depth+1, - seen=seen, - depcache=depcache, - result=result - ) - )) - - if depth == 0: - return result - return pkgdep + if depth < max_depth or max_depth == 0: + # result is passed in and added to directly + # so rdeps is disposable + rdeps = pkgdep.deps.graph_depends( + max_depth=max_depth, + printer_fn=printer_fn, + # The rest of these are only used internally: + depth=depth+1, + seen=seen, + depcache=depcache, + result=result + ) + return result def graph_reverse_depends( self, diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py index e29bbfc..4992ad7 100644 --- a/pym/gentoolkit/eclean/search.py +++ b/pym/gentoolkit/eclean/search.py @@ -124,7 +124,7 @@ class DistfilesSearch(object): self.output("...checking limits for %d ebuild sources" %len(pkgs)) - checks = self._get_default_checks(size_limit, time_limit, exclude) + checks = self._get_default_checks(size_limit, time_limit, exclude, destructive) checks.extend(extra_checks) clean_me = self._check_limits(_distdir, checks, clean_me) # remove any protected files from the list @@ -140,7 +140,7 @@ class DistfilesSearch(object): ####################### begin _check_limits code block - def _get_default_checks(self, size_limit, time_limit, excludes): + def _get_default_checks(self, size_limit, time_limit, excludes, destructive): #checks =[(self._isreg_check_, "is_reg_check")] checks =[self._isreg_check_] if 'filenames' in excludes: @@ -159,6 +159,10 @@ class DistfilesSearch(object): checks.append(partial(self._time_check_, time_limit)) else: self.output(" - skipping time limit check") + if destructive: + self.output(" - skipping dot files check") + else: + checks.append(self._dotfile_check_) return checks @@ -234,6 +238,14 @@ class DistfilesSearch(object): return True, False return False, True + @staticmethod + def _dotfile_check_(file_stat, file): + """check if file is a regular file.""" + head, tail = os.path.split(file) + if tail: + is_dot_file = tail.startswith('.') + return is_dot_file, not is_dot_file + ####################### end _check_limits code block @staticmethod diff --git a/pym/gentoolkit/analyse/__init__.py b/pym/gentoolkit/enalyze/__init__.py index 46d6185..b43a82c 100644 --- a/pym/gentoolkit/analyse/__init__.py +++ b/pym/gentoolkit/enalyze/__init__.py @@ -16,7 +16,7 @@ __docformat__ = 'epytext' # version is dynamically set by distutils sdist __version__ = "svn" -__productname__ = "analyse" +__productname__ = "enalyze" __authors__ = ( 'Brian Dolbec, <brian.dolbec@gmail.com>' @@ -48,15 +48,15 @@ from gentoolkit.formatters import format_options NAME_MAP = { - 'a': 'analyse', + 'a': 'analyze', 'r': 'rebuild' } FORMATTED_OPTIONS = ( - (" (a)nalyse", - "analyses the installed PKG database USE flag or keyword useage"), + (" (a)nalyze", + "analyzes the installed PKG database USE flag or keyword useage"), (" (r)ebuild", - "analyses the Installed PKG database and generates files suitable"), + "analyzes the Installed PKG database and generates files suitable"), (" ", "to replace corrupted or missing /etc/portage/package.* files") ) diff --git a/pym/gentoolkit/analyse/analyse.py b/pym/gentoolkit/enalyze/analyze.py index e2628e3..180865d 100644 --- a/pym/gentoolkit/analyse/analyse.py +++ b/pym/gentoolkit/enalyze/analyze.py @@ -14,11 +14,11 @@ import sys import gentoolkit from gentoolkit.dbapi import PORTDB, VARDB -from gentoolkit.analyse.base import ModuleBase +from gentoolkit.enalyze.base import ModuleBase from gentoolkit import pprinter as pp from gentoolkit.flag import get_installed_use, get_flags -from gentoolkit.analyse.lib import FlagAnalyzer, KeywordAnalyser -from gentoolkit.analyse.output import nl, AnalysisPrinter +from gentoolkit.enalyze.lib import FlagAnalyzer, KeywordAnalyser +from gentoolkit.enalyze.output import nl, AnalysisPrinter from gentoolkit.package import Package from gentoolkit.helpers import get_installed_cpvs @@ -35,10 +35,10 @@ def gather_flags_info( _get_flags=get_flags, _get_used=get_installed_use ): - """Analyse the installed pkgs USE flags for frequency of use + """Analyze the installed pkgs USE flags for frequency of use @type cpvs: list - @param cpvs: optional list of [cat/pkg-ver,...] to analyse or + @param cpvs: optional list of [cat/pkg-ver,...] to analyze or defaults to entire installed pkg db @type: system_flags: list @param system_flags: the current default USE flags as defined @@ -46,13 +46,13 @@ def gather_flags_info( @type include_unset: bool @param include_unset: controls the inclusion of unset USE flags in the report. @type target: string - @param target: the environment variable being analysed + @param target: the environment variable being analyzed one of ["USE", "PKGUSE"] @type _get_flags: function @param _get_flags: ovride-able for testing, - defaults to gentoolkit.analyse.lib.get_flags + defaults to gentoolkit.enalyze.lib.get_flags @param _get_used: ovride-able for testing, - defaults to gentoolkit.analyse.lib.get_installed_use + defaults to gentoolkit.enalyze.lib.get_installed_use @rtype dict. {flag:{"+":[cat/pkg-ver,...], "-":[cat/pkg-ver,...], "unset":[]} """ if cpvs is None: @@ -103,9 +103,9 @@ def gather_keywords_info( keywords=portage.settings["ACCEPT_KEYWORDS"], analyser = None ): - """Analyse the installed pkgs 'keywords' for frequency of use + """Analyze the installed pkgs 'keywords' for frequency of use - @param cpvs: optional list of [cat/pkg-ver,...] to analyse or + @param cpvs: optional list of [cat/pkg-ver,...] to analyze or defaults to entire installed pkg db @param system_keywords: list of the system keywords @param keywords: user defined list of keywords to check and report on @@ -166,7 +166,7 @@ class Analyse(ModuleBase): """ def __init__(self): ModuleBase.__init__(self) - self.module_name = "analyse" + self.module_name = "enalyze" self.options = { "flags": False, "keywords": False, @@ -193,14 +193,14 @@ class Analyse(ModuleBase): } self.formatted_options = [ (" -h, --help", "Outputs this useage message"), - (" -a, --analyse", + (" -a, --analyze", "Action, sets the module to gather data and output the"), ("", "formatted stats/information to the screen"), (" -u, --unset", "Additionally include any unset USE flags and the packages"), ("", "that could use them"), (" -v, --verbose", - "Used in the analyse action to output more detailed information"), + "Used in the analyze action to output more detailed information"), (" -p, --prefix", "Used for testing purposes only, runs report using " + "a prefix keyword and 'prefix' USE flag"), @@ -210,15 +210,15 @@ class Analyse(ModuleBase): ] self.formatted_args = [ (" use", - "Causes the action to analyse the installed packages USE flags"), + "Causes the action to analyze the installed packages USE flags"), (" pkguse", - "Causes the action to analyse the installed packages PKGUSE flags"), + "Causes the action to analyze the installed packages PKGUSE flags"), (" ", "These are flags that have been set in /etc/portage/package.use"), (" keywords", - "Causes the action to analyse the installed packages keywords"), + "Causes the action to analyze the installed packages keywords"), (" packages", - "Causes the action to analyse the installed packages and the"), + "Causes the action to analyze the installed packages and the"), (" ", "USE flags they were installed with"), ] @@ -251,12 +251,12 @@ class Analyse(ModuleBase): self.analyse_packages() def analyse_flags(self, target): - """This will scan the installed packages db and analyse the + """This will scan the installed packages db and analyze the USE flags used for installation and produce a report on how they were used. @type target: string - @param target: the target to be analysed, one of ["use", "pkguse"] + @param target: the target to be analyzed, one of ["use", "pkguse"] """ system_use = portage.settings["USE"].split() self.printer = AnalysisPrinter( @@ -307,7 +307,7 @@ class Analyse(ModuleBase): def analyse_keywords(self, keywords=None): - """This will scan the installed packages db and analyse the + """This will scan the installed packages db and analyze the keywords used for installation and produce a report on them. """ print() @@ -390,11 +390,11 @@ class Analyse(ModuleBase): def analyse_packages(self): - """This will scan the installed packages db and analyse the + """This will scan the installed packages db and analyze the USE flags used for installation and produce a report. @type target: string - @param target: the target to be analysed, one of ["use", "pkguse"] + @param target: the target to be analyzed, one of ["use", "pkguse"] """ system_use = portage.settings["USE"].split() if self.options["verbose"]: @@ -437,7 +437,7 @@ class Analyse(ModuleBase): def main(input_args): - """Common starting method by the analyse master + """Common starting method by the analyze master unless all modules are converted to this class method. @param input_args: input args as supplied by equery master module. diff --git a/pym/gentoolkit/analyse/base.py b/pym/gentoolkit/enalyze/base.py index a3f3fed..6622704 100644 --- a/pym/gentoolkit/analyse/base.py +++ b/pym/gentoolkit/enalyze/base.py @@ -6,7 +6,7 @@ # # $Header: $ -"""Analyse Base Module class to hold common module operation functions +"""Enalyze Base Module class to hold common module operation functions """ from __future__ import print_function @@ -25,7 +25,7 @@ from gentoolkit.base import mod_usage from gentoolkit import CONFIG class ModuleBase(object): - """Analyse base module class to parse module options print module help, etc..""" + """Enalyze base module class to parse module options print module help, etc..""" def __init__(self): self.module_name = None diff --git a/pym/gentoolkit/analyse/lib.py b/pym/gentoolkit/enalyze/lib.py index 901d757..015e23b 100644 --- a/pym/gentoolkit/analyse/lib.py +++ b/pym/gentoolkit/enalyze/lib.py @@ -6,7 +6,7 @@ # -"""Provides support functions to analyse modules""" +"""Provides support functions to enalyze modules""" import sys @@ -69,7 +69,7 @@ class FlagAnalyzer(object): return self._analyse(installed, iuse) def _analyse(self, installed, iuse): - """Analyses the supplied info and returns the flag settings + """Analyzes the supplied info and returns the flag settings that differ from the defaults @type installed: set diff --git a/pym/gentoolkit/analyse/output.py b/pym/gentoolkit/enalyze/output.py index b193d54..326ebbc 100644 --- a/pym/gentoolkit/analyse/output.py +++ b/pym/gentoolkit/enalyze/output.py @@ -291,7 +291,7 @@ class RebuildPrinter(CpvValueWrapper): h=("# This package.%s file was generated by " %self.target + - "gentoolkit's 'analyse rebuild' module\n" + "gentoolkit's 'enalyze rebuild' module\n" "# Date: " + time.asctime() + "\n" ) return h diff --git a/pym/gentoolkit/analyse/rebuild.py b/pym/gentoolkit/enalyze/rebuild.py index 091df3a..f1d7e88 100644 --- a/pym/gentoolkit/analyse/rebuild.py +++ b/pym/gentoolkit/enalyze/rebuild.py @@ -18,12 +18,12 @@ import sys import gentoolkit from gentoolkit.dbapi import PORTDB, VARDB -from gentoolkit.analyse.base import ModuleBase +from gentoolkit.enalyze.base import ModuleBase from gentoolkit import pprinter as pp -from gentoolkit.analyse.lib import (get_installed_use, get_flags, FlagAnalyzer, +from gentoolkit.enalyze.lib import (get_installed_use, get_flags, FlagAnalyzer, KeywordAnalyser) from gentoolkit.flag import reduce_flags -from gentoolkit.analyse.output import RebuildPrinter +from gentoolkit.enalyze.output import RebuildPrinter from gentoolkit.atom import Atom @@ -42,16 +42,16 @@ def cpv_all_diff_use( and the currently installed pkgs recorded USE flag settings @type cpvs: list - @param cpvs: optional list of [cat/pkg-ver,...] to analyse or + @param cpvs: optional list of [cat/pkg-ver,...] to analyze or defaults to entire installed pkg db @type: system_flags: list @param system_flags: the current default USE flags as defined by portage.settings["USE"].split() @type _get_flags: function @param _get_flags: ovride-able for testing, - defaults to gentoolkit.analyse.lib.get_flags + defaults to gentoolkit.enalyze.lib.get_flags @param _get_used: ovride-able for testing, - defaults to gentoolkit.analyse.lib.get_installed_use + defaults to gentoolkit.enalyze.lib.get_installed_use @rtype dict. {cpv:['flag1', '-flag2',...]} """ if cpvs is None: @@ -91,9 +91,9 @@ def cpv_all_diff_keywords( keywords=portage.settings["ACCEPT_KEYWORDS"], analyser = None ): - """Analyse the installed pkgs 'keywords' for difference from ACCEPT_KEYWORDS + """Analyze the installed pkgs 'keywords' for difference from ACCEPT_KEYWORDS - @param cpvs: optional list of [cat/pkg-ver,...] to analyse or + @param cpvs: optional list of [cat/pkg-ver,...] to analyze or defaults to entire installed pkg db @param system_keywords: list of the system keywords @param keywords: user defined list of keywords to check and report on @@ -182,11 +182,11 @@ class Rebuild(ModuleBase): ] self.formatted_args = [ (" use", - "causes the action to analyse the installed packages USE flags"), + "causes the action to analyze the installed packages USE flags"), (" keywords", - "causes the action to analyse the installed packages keywords"), + "causes the action to analyze the installed packages keywords"), (" unmask", - "causes the action to analyse the installed packages " + \ + "causes the action to analyze the installed packages " + \ "current mask status") ] self.short_opts = "hepsv" @@ -269,7 +269,7 @@ class Rebuild(ModuleBase): def rebuild_keywords(self): print("Module action not yet available") print() - """This will scan the installed packages db and analyse the + """This will scan the installed packages db and analyze the keywords used for installation and produce a report on them. """ system_keywords = portage.settings["ACCEPT_KEYWORDS"].split() @@ -357,7 +357,7 @@ class Rebuild(ModuleBase): def main(input_args): - """Common starting method by the analyse master + """Common starting method by the analyze master unless all modules are converted to this class method. @param input_args: input args as supplied by equery master module. diff --git a/pym/gentoolkit/eprefix.py b/pym/gentoolkit/eprefix.py index 9a04e4b..48bd140 100644 --- a/pym/gentoolkit/eprefix.py +++ b/pym/gentoolkit/eprefix.py @@ -10,25 +10,15 @@ used in all gentoolkit modules Example useage: from gentoolkit.eprefix import EPREFIX -then in code add it to the filepath eg.: +then in code add it to the filepath eg.: exclude_file = "%s/etc/%s/%s.exclude" % (EPREFIX,__productname__ , action) """ - -import os - - -EPREFIX = '' - -# the following code is used to set it when -# non-installed code is being run -if 'EPREFIX' in os.environ: - EPREFIX = os.environ['EPREFIX'] -else: - try: - import portage.const - EPREFIX = portage.BPREFIX - except AttributeError: - EPREFIX = '' - -#print("EPREFIX set to:", EPREFIX) +# Load EPREFIX from Portage, fall back to the empty string if it fails +try: + from portage.const import EPREFIX +except ImportError: + EPREFIX = '' + +if __name__ == "__main__": + print("EPREFIX set to:", EPREFIX) diff --git a/pym/gentoolkit/equery/__init__.py b/pym/gentoolkit/equery/__init__.py index e25ec54..b362bca 100644 --- a/pym/gentoolkit/equery/__init__.py +++ b/pym/gentoolkit/equery/__init__.py @@ -221,6 +221,9 @@ def initialize_configuration(): if CONFIG['piping']: CONFIG['verbose'] = False + # set extra wide, should disable wrapping unless + # there is some extra long text + CONFIG['termWidth'] = 600 CONFIG['debug'] = bool(os.getenv('DEBUG', False)) diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py index b67cbc6..01e090a 100644 --- a/pym/gentoolkit/equery/meta.py +++ b/pym/gentoolkit/equery/meta.py @@ -244,6 +244,14 @@ def format_keywords_line(pkg, fmtd_keywords, slot, verstr_len): return result +def format_homepage(homepage): + """format the homepage(s) entries for dispaly""" + result = [] + for page in homepage.split(): + result.append(format_line(page, "Homepage: ", " " * 13)) + return result + + # R0912: *Too many branches (%s/%s)* # pylint: disable-msg=R0912 def call_format_functions(best_match, matches): @@ -284,11 +292,13 @@ def call_format_functions(best_match, matches): if QUERY_OPTS["upstream"] or not got_opts: upstream = format_upstream(best_match.metadata.upstream()) + homepage = format_homepage(best_match.environment("HOMEPAGE")) if QUERY_OPTS["upstream"]: upstream = format_list(upstream) else: upstream = format_list(upstream, "Upstream: ", " " * 13) print_sequence(upstream) + print_sequence(homepage) if not got_opts: pkg_loc = best_match.package_path() diff --git a/pym/gentoolkit/eshowkw/__init__.py b/pym/gentoolkit/eshowkw/__init__.py index 9c70bee..e0544a9 100644 --- a/pym/gentoolkit/eshowkw/__init__.py +++ b/pym/gentoolkit/eshowkw/__init__.py @@ -14,10 +14,10 @@ from portage import config as portc from portage import portdbapi as portdbapi from portage import db as portdb -from .keywords_header import keywords_header -from .keywords_content import keywords_content -from .display_pretty import string_rotator -from .display_pretty import display +from gentoolkit.eshowkw.keywords_header import keywords_header +from gentoolkit.eshowkw.keywords_content import keywords_content +from gentoolkit.eshowkw.display_pretty import string_rotator +from gentoolkit.eshowkw.display_pretty import display ignore_slots = False bold = False @@ -25,6 +25,7 @@ order = 'bottom' topper = 'versionlist' def process_display(package, keywords, dbapi): + portdata = keywords_content(package, keywords.keywords, dbapi, ignore_slots, order, bold, topper) if topper == 'archlist': header = string_rotator().rotateContent(keywords.content, keywords.length, bold) @@ -108,7 +109,8 @@ def main(argv, indirect = False): dbapi = portdbapi(mysettings=mysettings) if not use_overlays: dbapi.porttrees = [dbapi.porttree_root] - map(lambda x: process_display(x, keywords, dbapi), package) + for pkg in package: + process_display(pkg, keywords, dbapi) else: currdir = os.getcwd() # check if there are actualy some ebuilds diff --git a/pym/gentoolkit/eshowkw/display_pretty.py b/pym/gentoolkit/eshowkw/display_pretty.py index 270a0eb..beca5f4 100644 --- a/pym/gentoolkit/eshowkw/display_pretty.py +++ b/pym/gentoolkit/eshowkw/display_pretty.py @@ -3,7 +3,10 @@ # Distributed under the terms of the GNU General Public License v2 from portage.output import colorize -from itertools import izip_longest +try: # newer python versions + from itertools import zip_longest +except ImportError: # older python naming + from itertools import izip_longest as zip_longest __all__ = ['string_rotator', 'colorize_string', 'align_string', 'rotate_dash', 'print_content', 'display'] @@ -17,14 +20,14 @@ def display(plain_list, rotated_list, plain_width, rotated_height, cp, toplist = if toplist != 'archlist': corner_image.extend(plain_list) data_printout = ['%s%s' % (x, y) - for x, y in izip_longest(corner_image, rotated_list, fillvalue=corner_image[0])] + for x, y in zip_longest(corner_image, rotated_list, fillvalue=corner_image[0])] if toplist == 'archlist': data_printout.extend(plain_list) output.extend(data_printout) print(print_content(output)) def align_string(string, align, length): - """Align string to the specified alignment (left or right, and after rotation it becames top and bottom)""" + """Align string to the specified alignment (left or right, and after rotation it becomes top and bottom)""" if align == 'top' or align == 'left': string = string.ljust(length) else: diff --git a/pym/gentoolkit/eshowkw/keywords_content.py b/pym/gentoolkit/eshowkw/keywords_content.py index 637c99a..99d652e 100644 --- a/pym/gentoolkit/eshowkw/keywords_content.py +++ b/pym/gentoolkit/eshowkw/keywords_content.py @@ -8,8 +8,8 @@ from portage.output import colorize __all__ = ['keywords_content'] -from display_pretty import colorize_string -from display_pretty import align_string +from gentoolkit.eshowkw.display_pretty import colorize_string +from gentoolkit.eshowkw.display_pretty import align_string class keywords_content: class RedundancyChecker: @@ -101,7 +101,7 @@ class keywords_content: def __getVersions(self, packages): """Obtain properly aligned version strings without colors.""" revlength = max([len(self.__getRevision(x)) for x in packages]) - return map(lambda x: self.__separateVersion(x, revlength), packages) + return [self.__separateVersion(x, revlength) for x in packages] def __getRevision(self, cpv): """Get revision informations for each package for nice further alignment""" diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py index 23588a4..f7e3e50 100644 --- a/pym/gentoolkit/eshowkw/keywords_header.py +++ b/pym/gentoolkit/eshowkw/keywords_header.py @@ -6,8 +6,8 @@ __all__ = ['keywords_header'] from portage import settings as ports from portage.output import colorize -from display_pretty import colorize_string -from display_pretty import align_string +from gentoolkit.eshowkw.display_pretty import colorize_string +from gentoolkit.eshowkw.display_pretty import align_string class keywords_header: __IMPARCHS = [ 'arm', 'amd64', 'x86' ] diff --git a/pym/gentoolkit/flag.py b/pym/gentoolkit/flag.py index a7d944f..b5c8228 100644 --- a/pym/gentoolkit/flag.py +++ b/pym/gentoolkit/flag.py @@ -36,7 +36,8 @@ def get_iuse(cpv): @returns [] or the list of IUSE flags """ try: - return PORTDB.aux_get(cpv, ["IUSE"])[0].split() + # aux_get might return dupes, so run them through set() to remove them + return list(set(PORTDB.aux_get(cpv, ["IUSE"])[0].split())) except: return [] diff --git a/pym/gentoolkit/helpers.py b/pym/gentoolkit/helpers.py index cd8b763..225a198 100644 --- a/pym/gentoolkit/helpers.py +++ b/pym/gentoolkit/helpers.py @@ -333,7 +333,7 @@ class FileOwner(object): osp = os.path paths.extend([osp.realpath(x) for x in paths - if osp.islink(x) and osp.realpath(x) not in paths]) + if osp.realpath(x) not in paths]) return paths diff --git a/pym/gentoolkit/package.py b/pym/gentoolkit/package.py index a4031a3..e405412 100644 --- a/pym/gentoolkit/package.py +++ b/pym/gentoolkit/package.py @@ -36,7 +36,7 @@ __all__ = ( FORMAT_TMPL_VARS = ( '$location', '$mask', '$mask2', '$cp', '$cpv', '$category', '$name', - '$version', '$revision', '$fullversion', '$slot', '$repo' + '$version', '$revision', '$fullversion', '$slot', '$repo', '$keywords' ) # ======= @@ -470,6 +470,7 @@ class PackageFormatter(object): "fullversion") fmt_vars.addLazySingleton("slot", self.format_slot) fmt_vars.addLazySingleton("repo", self.pkg.repo_name) + fmt_vars.addLazySingleton("keywords", self.format_keywords) def format_package_location(self): """Get the install status (in /var/db/?) and origin (from an overlay @@ -570,5 +571,12 @@ class PackageFormatter(object): else: return value + def format_keywords(self): + value = self.pkg.environment("KEYWORDS") + if self._do_format: + return pp.keyword(value) + else: + return value + # vim: set ts=4 sw=4 tw=79: diff --git a/pym/gentoolkit/test/eclean/test_search.py b/pym/gentoolkit/test/eclean/test_search.py index 328c543..7980161 100644 --- a/pym/gentoolkit/test/eclean/test_search.py +++ b/pym/gentoolkit/test/eclean/test_search.py @@ -151,7 +151,7 @@ class TestCheckLimits(unittest.TestCase): print("Error getting test data for index:", i) #self.target_class.set_data(self.set_limits(test)) size_chk, time_chk, exclude = test["params"] - checks = self.target_class._get_default_checks(size_chk, time_chk, exclude) + checks = self.target_class._get_default_checks(size_chk, time_chk, exclude, False) clean_me = self.target_class._check_limits(self.workdir, checks, clean_me) results = sorted(clean_me) run_results.append(results) |
