diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-02-17 16:17:36 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-02-17 16:17:36 +0100 |
| commit | d1b2c0fbd34cee0ffced8270149b87def7675b2a (patch) | |
| tree | f4b8a14fc619b2e6ea297385e289b2549f6f21a4 /tests/old/cache.py | |
| parent | c62bdd0b1b633b134ba551847da0c1e8d12115c2 (diff) | |
| parent | 930f6a2899b0b410777397fb206a8eba8c99100c (diff) | |
| download | python-apt-d1b2c0fbd34cee0ffced8270149b87def7675b2a.tar.gz | |
merged from the debian-sid branch
Diffstat (limited to 'tests/old/cache.py')
| -rw-r--r-- | tests/old/cache.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/old/cache.py b/tests/old/cache.py new file mode 100644 index 00000000..f0bf6761 --- /dev/null +++ b/tests/old/cache.py @@ -0,0 +1,51 @@ +#!/usr/bin/python +# +# Test for the pkgCache code +# + +import apt_pkg +import sys + + +def main(): + apt_pkg.init() + cache = apt_pkg.Cache() + depcache = apt_pkg.DepCache(cache) + depcache.Init() + i=0 + all=cache.PackageCount + print "Running Cache test on all packages:" + # first, get all pkgs + for pkg in cache.Packages: + i += 1 + x = pkg.Name + # then get each version + for ver in pkg.VersionList: + # get some version information + a = ver.FileList + b = ver.VerStr + c = ver.Arch + d = ver.DependsListStr + dl = ver.DependsList + # get all dependencies (a dict of string->list, + # e.g. "depends:" -> [ver1,ver2,..] + for dep in dl.keys(): + # get the list of each dependency object + for depVerList in dl[dep]: + for z in depVerList: + # get all TargetVersions of + # the dependency object + for j in z.AllTargets(): + f = j.FileList + g = ver.VerStr + h = ver.Arch + k = ver.DependsListStr + j = ver.DependsList + pass + + print "\r%i/%i=%.3f%% " % (i, all, (float(i) / float(all) * 100)), + + +if __name__ == "__main__": + main() + sys.exit(0) |
