__author__ = "Karl Trygve Kalleberg"
__email__ = "karltk@gentoo.org"
-__version__ = "0.1.2"
+__version__ = "0.1.3"
__productname__ = "equery"
__description__ = "Gentoo Package Query Tool"
# portage (output module) and gentoolkit need special path modifications
sys.path.insert(0, "/usr/lib/portage/pym")
-sys.path.insert(0, "/usr/lib/gentoolkit/pym")
+#sys.path.insert(0, "/usr/lib/gentoolkit/pym")
import gentoolkit
import portage
import gentoolkit.pprinter as pp
-from gentoolkit.pprinter import print_info, print_error, print_warn
+from gentoolkit.pprinter import print_info, print_error, print_warn, die
# Auxiliary functions
def perform(self, args):
(query, opts) = self.parseArgs(args)
- # Act intelligently on the query
try:
q = string.join(query, "|")
if opts["fullRegex"]:
def perform(self, args):
(query, opts) = self.parseArgs(args)
+
+ if not Config["piping"]:
+ print_info(3, "[ Searching for packages matching " + pp.pkgquery(query) + "... ]")
matches = gentoolkit.find_packages(query, True)
print_info(3, "[ : Right column (I) - USE flags packages was installed with ]")
# Iterate through matches, printing a report for each package
- printed_matches = 0
+ matches_found = 0
for p in matches:
+
if not p.is_installed() and opts["installedOnly"]:
continue
+ matches_found += 1
+
bestver = p.get_cpv()
iuse = p.get_env_var("IUSE")
-
+
if iuse:
usevar = iuse.split()
else:
print_info(0, " : " + desc)
else:
print_info(0, " : <unknown>")
- printed_matches += 1
else:
if not Config["piping"]:
- print_info(1, "[ No USE flags found for " + pp.cppv(p.get_cpv()) + "]")
+ print_info(1, "[ No USE flags found for " + pp.cpv(p.get_cpv()) + "]")
if Config["verbosityLevel"] >= 2:
- if printed_matches == 0:
+ if matches_found == 0:
s = ""
if opts["installedOnly"]:
s = "installed "
if cat == ".*":
scat = "all categories"
if not Config["piping"]:
- print_info(2, "Searching for USE flag " + pp.useflag(query) + " in " + pp.cpv(scat) + " among:")
+ print_info(2, "[ Searching for USE flag " + pp.useflag(query) + " in " + pp.cpv(scat) + " among: ]")
if opts["includeInstalled"]:
print_info(1, pp.section(" *") + " installed packages")
if opts["includePortTree"]: