summaryrefslogtreecommitdiff
path: root/doc/examples
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-03-09 16:59:16 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-03-09 16:59:16 +0000
commitd06566c40340c80db43e47b171ceda579291ef66 (patch)
treec9a5f694bca4067c594c62026b703ebc62857fcd /doc/examples
parent59902bad90ed9192ad9b2def78f588cdefe1080c (diff)
downloadpython-apt-d06566c40340c80db43e47b171ceda579291ef66.tar.gz
* OpProgress interface added for DepCache
Diffstat (limited to 'doc/examples')
-rw-r--r--doc/examples/depcache.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/doc/examples/depcache.py b/doc/examples/depcache.py
index 5e5699e7..baf2d875 100644
--- a/doc/examples/depcache.py
+++ b/doc/examples/depcache.py
@@ -11,8 +11,10 @@ class MyProgress:
def Update(self, percent):
if (self.last + 1.0) <= percent:
- print "lala %s " % (percent)
+ print "Progress: %s " % (percent)
self.last = percent
+ if percent >= 100:
+ self.last = 0.0
def Done(self):
self.last = 0.0
@@ -25,18 +27,22 @@ progress = MyProgress()
cache = apt_pkg.GetCache(progress)
print "Available packages: %s " % cache.PackageCount
-sys.exit()
-
iter = cache["base-config"]
print "example package iter: %s" % iter
-
# get depcache
-depcache = apt_pkg.GetDepCache(cache)
+print "\n\n depcache"
+depcache = apt_pkg.GetDepCache(cache, progress)
depcache.ReadPinFile()
print "got a depcache: %s " % depcache
print "Marked for install: %s " % depcache.InstCount
+print "\n\n Reinit"
+depcache.Init(progress)
+
+#sys.exit()
+
+
# get a canidate version
ver= depcache.GetCandidateVer(iter)
print "Candidate version: %s " % ver