diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2005-08-05 09:23:13 +0000 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2005-08-05 09:23:13 +0000 |
| commit | de457bf476143b1f617378c7215503b777a743cc (patch) | |
| tree | 71fabade43f9add41f6f1423fe39418b06c0d5bf | |
| parent | 698f8ba826e01386be5de57bc95b44a5f22454dd (diff) | |
| download | python-apt-de457bf476143b1f617378c7215503b777a743cc.tar.gz | |
* improved the examples, added README too
| -rw-r--r-- | debian/changelog | 4 | ||||
| -rw-r--r-- | debian/python-apt.docs | 1 | ||||
| -rw-r--r-- | doc/examples/action.py | 9 | ||||
| -rw-r--r-- | doc/examples/inst.py | 9 | ||||
| -rw-r--r-- | doc/examples/progress.py | 4 | ||||
| -rw-r--r-- | python/progress.cc | 7 |
6 files changed, 21 insertions, 13 deletions
diff --git a/debian/changelog b/debian/changelog index 3b502c6d..864dd0f7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -python-apt (0.6.13) breezy; urgency=low +python-apt (0.6.13) unstable; urgency=low * support for Marked{Downgrade,Reinstall} added * support for the PkgProblemResolver @@ -7,7 +7,7 @@ python-apt (0.6.13) breezy; urgency=low a more pythonic interface to apt_pkg * made the apt/ python code PEP08 conform - -- Michael Vogt <michael.vogt@ubuntu.com> Fri, 5 Aug 2005 10:30:31 +0200 + -- Michael Vogt <mvo@debian.org> Fri, 5 Aug 2005 10:30:31 +0200 python-apt (0.6.12.2) unstable; urgency=low diff --git a/debian/python-apt.docs b/debian/python-apt.docs index 893ab73a..f7756d28 100644 --- a/debian/python-apt.docs +++ b/debian/python-apt.docs @@ -1 +1,2 @@ +README apt/README.apt diff --git a/doc/examples/action.py b/doc/examples/action.py index 3eb58d9e..a794317a 100644 --- a/doc/examples/action.py +++ b/doc/examples/action.py @@ -4,17 +4,18 @@ import apt_pkg import sys import copy -from progress import OpProgress, FetchProgress - +from apt.progress import OpTextProgress +from progress import TextFetchProgress # init apt_pkg.init() -progress = OpProgress() +progress = OpTextProgress() cache = apt_pkg.GetCache(progress) print "Available packages: %s " % cache.PackageCount -progress = FetchProgress() +print "Fetching" +progress = TextFetchProgress() cache.Update(progress) print "Exiting" diff --git a/doc/examples/inst.py b/doc/examples/inst.py index 3cc4094e..b25cf542 100644 --- a/doc/examples/inst.py +++ b/doc/examples/inst.py @@ -5,13 +5,14 @@ import apt_pkg import sys, os import copy -from apt.progress import OpProgress, FetchProgress, InstallProgress +from progress import TextFetchProgress, TextInstallProgress +from apt.progress import OpTextProgress # init apt_pkg.init() -progress = OpProgress() +progress = OpTextProgress() cache = apt_pkg.GetCache(progress) print "Available packages: %s " % cache.PackageCount @@ -21,8 +22,8 @@ depcache.ReadPinFile() depcache.Init(progress) # do something -fprogress = FetchProgress() -iprogress = InstallProgress() +fprogress = TextFetchProgress() +iprogress = TextInstallProgress() # can be used to set a custom fork method (like vte.Terminal.forkpty) #iprogress.fork = os.fork diff --git a/doc/examples/progress.py b/doc/examples/progress.py index e2ff97e2..d820fcb2 100644 --- a/doc/examples/progress.py +++ b/doc/examples/progress.py @@ -1,4 +1,5 @@ import apt +from apt import SizeToStr import sys import time import string @@ -32,7 +33,8 @@ class TextFetchProgress(apt.FetchProgress): def updateStatus(self, uri, descr, shortDescr, status): print "UpdateStatus: '%s' '%s' '%s' '%i'" % (uri,descr,shortDescr, status) def pulse(self): - print "Pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % (apt_pkg.SizeToStr(self.currentCPS), apt_pkg.SizeToStr(self.currentBytes), apt_pkg.SizeToStr(self.totalBytes), self.currentItems, self.totalItems) + print "Pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % (SizeToStr(self.currentCPS), SizeToStr(self.currentBytes), SizeToStr(self.totalBytes), self.currentItems, self.totalItems) + return True def mediaChange(self, medium, drive): print "Please insert medium %s in drive %s" % (medium, drive) diff --git a/python/progress.cc b/python/progress.cc index 33b4ed97..f79090f7 100644 --- a/python/progress.cc +++ b/python/progress.cc @@ -165,8 +165,11 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner) RunSimpleCallback("pulse", arglist, &result); bool res = true; - if(!PyArg_Parse(result, "b", &res)) - std::cerr << "result could not be parsed" << std::endl; + if(!PyArg_Parse(result, "b", &res)) + { + // mvo: this is harmless, we shouldn't print anything here + //std::cerr << "result could not be parsed" << std::endl; + } // fetching can be canceld by returning false return res; |
