aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordol-sen <brian.dolbec@gmail.com>2011-05-22 20:44:38 -0700
committerdol-sen <brian.dolbec@gmail.com>2011-05-22 20:44:38 -0700
commit665ee8fc8c85bceda7ec86e5df1c7f8c580d9be0 (patch)
tree0b4903fbc636723e65057f1caf3170f38b2cb706
parentfix bug 368113 dupe'd USE flags (diff)
downloadgentoolkit-665ee8fc8c85bceda7ec86e5df1c7f8c580d9be0.tar.gz
gentoolkit-665ee8fc8c85bceda7ec86e5df1c7f8c580d9be0.tar.bz2
gentoolkit-665ee8fc8c85bceda7ec86e5df1c7f8c580d9be0.zip
fix the Dependencies.graph_depends() api return value not being correct.
-rw-r--r--pym/gentoolkit/dependencies.py41
1 files changed, 19 insertions, 22 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,