transitive = args.transitive
if args.direct:
- rule = "show-depends"
+ get_depends_func = pkgutil.get_depends
arrow_dir = "forward"
else:
if mode == MODE_FULL:
sys.stderr.write("--reverse needs a package\n")
sys.exit(1)
- rule = "show-rdepends"
+ get_depends_func = pkgutil.get_rdepends
arrow_dir = "back"
# Get the colours: we need exactly three colours,
if len(filtered_pkgs) == 0:
return []
- depends = pkgutil.get_depends(filtered_pkgs, rule)
+ depends = get_depends_func(filtered_pkgs)
deps = set()
for pkg in filtered_pkgs:
version[pkg] = output[i]
return version
-# Execute the "make <pkg>-show-depends" command to get the list of
-# dependencies of a given list of packages, and return the list of
-# dependencies formatted as a Python dictionary.
-def get_depends(pkgs, rule):
+def _get_depends(pkgs, rule):
sys.stderr.write("Getting dependencies for %s\n" % pkgs)
cmd = ["make", "-s", "--no-print-directory" ]
for pkg in pkgs:
else:
deps[pkg] = pkg_deps
return deps
+
+# Execute the "make <pkg>-show-depends" command to get the list of
+# dependencies of a given list of packages, and return the list of
+# dependencies formatted as a Python dictionary.
+def get_depends(pkgs):
+ return _get_depends(pkgs, 'show-depends')
+
+# Execute the "make <pkg>-show-rdepends" command to get the list of
+# reverse dependencies of a given list of packages, and return the
+# list of dependencies formatted as a Python dictionary.
+def get_rdepends(pkgs):
+ return _get_depends(pkgs, 'show-rdepends')