From 412e6c80ad56181546f29f2add405fa595116271 Mon Sep 17 00:00:00 2001 From: Thomas De Schampheleire Date: Fri, 3 Feb 2017 21:57:45 +0100 Subject: graph-depends: split off get_rdepends from get_depends The use of a 'rule' variable that can contain 'show-depends' or 'show-rdepends' is not logical if get_depends is considered as a reusable function from various scripts. The name of these rules are too much an implementation detail. Therefore, split the existing get_depends into two separate functions get_depends and get_rdepends, while keeping code duplication to a minimum. Signed-off-by: Thomas De Schampheleire Reviewed-by: "Yann E. MORIN" Signed-off-by: Thomas Petazzoni --- support/scripts/pkgutil.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'support/scripts/pkgutil.py') diff --git a/support/scripts/pkgutil.py b/support/scripts/pkgutil.py index 46af4b5d38..a0e2352bad 100644 --- a/support/scripts/pkgutil.py +++ b/support/scripts/pkgutil.py @@ -25,10 +25,7 @@ def get_version(pkgs): version[pkg] = output[i] return version -# Execute the "make -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: @@ -51,3 +48,15 @@ def get_depends(pkgs, rule): else: deps[pkg] = pkg_deps return deps + +# Execute the "make -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 -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') -- cgit v1.2.3