aboutsummaryrefslogtreecommitdiff
path: root/pym
diff options
context:
space:
mode:
Diffstat (limited to 'pym')
-rw-r--r--pym/gentoolkit/equery/depends.py29
1 files changed, 18 insertions, 11 deletions
diff --git a/pym/gentoolkit/equery/depends.py b/pym/gentoolkit/equery/depends.py
index 8ec5f75..f92b7b9 100644
--- a/pym/gentoolkit/equery/depends.py
+++ b/pym/gentoolkit/equery/depends.py
@@ -17,7 +17,6 @@ import gentoolkit.pprinter as pp
from gentoolkit.dependencies import Dependencies
from gentoolkit.equery import format_options, mod_usage, CONFIG
from gentoolkit.helpers import get_cpvs, get_installed_cpvs
-from gentoolkit.cpv import CPV
from gentoolkit.package import PackageFormatter, Package
# =======
@@ -27,7 +26,7 @@ from gentoolkit.package import PackageFormatter, Package
QUERY_OPTS = {
"include_masked": False,
"only_direct": True,
- "max_depth": -1,
+ "max_depth": None,
"package_format": None,
}
@@ -94,9 +93,9 @@ class DependPrinter:
if dep_is_displayed and not self.verbose:
return
- depth = getattr(dep, "depth", 0)
+ depth = dep.depth
indent = " " * depth
- mdep = dep.matching_dep
+ mdep = dep.depatom
use_conditional = ""
if QUERY_OPTS["package_format"] != None:
@@ -226,17 +225,25 @@ def main(input_args):
if CONFIG["verbose"]:
print(" * These packages depend on %s:" % pp.emph(pkg.cpv))
- if pkg.graph_reverse_depends(
- pkgset=sorted(pkggetter(), key=CPV),
- max_depth=QUERY_OPTS["max_depth"],
+
+ first_run = False
+
+ last_seen = None
+ for pkgdep in pkg.graph_reverse_depends(
+ pkgset=sorted(pkggetter()),
only_direct=QUERY_OPTS["only_direct"],
- printer_fn=dep_print,
+ max_depth=QUERY_OPTS["max_depth"],
):
+ if last_seen is None or last_seen != pkgdep:
+ seen = False
+ else:
+ seen = True
+ printer(pkgdep, dep_is_displayed=seen)
+ last_seen = pkgdep
+ if last_seen is not None:
got_match = True
- first_run = False
-
- if not got_match:
+ if got_match is None:
sys.exit(1)