From c89b8408c0115e9fccdd4bfe180e93eb746b12cd Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 2 Dec 2005 23:17:16 +0000 Subject: * added "{candidate,installed}Downloadable" --- doc/examples/dependant-pkgs.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 doc/examples/dependant-pkgs.py (limited to 'doc') diff --git a/doc/examples/dependant-pkgs.py b/doc/examples/dependant-pkgs.py new file mode 100644 index 00000000..656e38bf --- /dev/null +++ b/doc/examples/dependant-pkgs.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +import apt +import sys + +pkgs = set() +cache = apt.Cache() +for pkg in cache: + candver = cache._depcache.GetCandidateVer(pkg._pkg) + if candver == None: + continue + dependslist = candver.DependsList + for dep in dependslist.keys(): + # get the list of each dependency object + for depVerList in dependslist[dep]: + for z in depVerList: + # get all TargetVersions of + # the dependency object + for tpkg in z.AllTargets(): + if sys.argv[1] == tpkg.ParentPkg.Name: + pkgs.add(pkg.name) + +main = [] +universe = [] +for pkg in pkgs: + if "universe" in cache[pkg].section: + universe.append(cache[pkg].sourcePackageName) + else: + main.append(cache[pkg].sourcePackageName) + +print "main:" +print "\n".join(main) +print + +print "universe:" +print "\n".join(universe) -- cgit v1.2.3