From 2c3636ac5977d17dce51003f15d5bfacbfb39a5e Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 11 Nov 2012 16:37:07 -0500 Subject: [PATCH] package: update PackageFormatter doctest to use Query helpers.find_packages has been replaced by the query.Query class. Also temporarily turn off Portage colorization during the doctest, otherwise the CPV value is printed in green. --- pym/gentoolkit/package.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pym/gentoolkit/package.py b/pym/gentoolkit/package.py index 682c53a..92fb924 100644 --- a/pym/gentoolkit/package.py +++ b/pym/gentoolkit/package.py @@ -418,16 +418,21 @@ class PackageFormatter(object): information can then be easily formatted and displayed. Example usage: - >>> from gentoolkit.helpers import find_packages + >>> from gentoolkit.query import Query >>> from gentoolkit.package import PackageFormatter - >>> pkgs = [PackageFormatter(x) for x in find_packages('gcc')] + >>> import portage.output + >>> q = Query('gcc') + >>> pkgs = [PackageFormatter(x) for x in q.find()] + >>> havecolor = portage.output.havecolor + >>> portage.output.havecolor = False >>> for pkg in pkgs: ... # Only print packages that are installed and from the Portage ... # tree ... if set('IP').issubset(pkg.location): ... print(pkg) ... - [IP-] [ ] sys-devel/gcc-4.3.2-r3 (4.3) + [IP-] [ ] sys-devel/gcc-4.5.4:4.5 + >>> portage.output.havecolor = havecolor @type pkg: L{gentoolkit.package.Package} @param pkg: package to format -- 2.26.2