diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-02-28 10:59:54 +0000 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-02-28 10:59:54 +0000 |
| commit | 55b2eeb0b63b544b3519b019f6d3969d88296618 (patch) | |
| tree | ef9a4ff5f89381b11d7fdd90de469758e7fa0ca4 /apt/progress.py | |
| parent | 9861af130e14ec76fd6b5e945ac5d57d8128503c (diff) | |
| download | python-apt-55b2eeb0b63b544b3519b019f6d3969d88296618.tar.gz | |
* interface fixes for kamion, pychecker fixes
Diffstat (limited to 'apt/progress.py')
| -rw-r--r-- | apt/progress.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/apt/progress.py b/apt/progress.py index 40cf8e48..9958b9b7 100644 --- a/apt/progress.py +++ b/apt/progress.py @@ -21,7 +21,7 @@ import sys, apt_pkg, os, fcntl, string, re -class OpProgress: +class OpProgress(object): """ Abstract class to implement reporting on cache opening Subclass this class to implement simple Operation progress reporting """ @@ -117,7 +117,7 @@ class TextFetchProgress(FetchProgress): res = false; return res -class DumbInstallProgress: +class DumbInstallProgress(object): """ Report the install progress Subclass this class to implement install progress reporting """ @@ -135,9 +135,10 @@ class DumbInstallProgress: class InstallProgress(DumbInstallProgress): """ A InstallProgress that is pretty useful. It supports the attributes 'percent' 'status' and callbacks - for the dpkg errors and conffiles (not implemented yet) + for the dpkg errors and conffiles and status changes """ def __init__(self): + DumbInstallProgress.__init__(self) (read, write) = os.pipe() self.writefd=write self.statusfd = os.fdopen(read, "r") @@ -151,6 +152,9 @@ class InstallProgress(DumbInstallProgress): def conffile(self,current,new): " called when a conffile question from dpkg is detected " pass + def statusChange(self, pkg, percent, status): + " called when the status changed " + pass def updateInterface(self): if self.statusfd != None: try: @@ -173,8 +177,12 @@ class InstallProgress(DumbInstallProgress): match = re.compile("\s*\'(.*)\'\s*\'(.*)\'.*").match(status_str) if match: self.conffile(match.group(1), match.group(2)) - self.percent = float(percent) - self.status = string.strip(status_str) + elif status == "pmstatus": + if float(percent) != self.percent or \ + status_str != self.status: + self.statusChange(pkg, percent, status_str) + self.percent = float(percent) + self.status = string.strip(status_str) self.read = "" def fork(self): |
