diff options
| author | Julian Andres Klode <jak@debian.org> | 2009-07-16 15:31:38 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2009-07-16 15:31:38 +0200 |
| commit | 5e3b11ad62c893fc3f46e748afdd4db5ce2d3672 (patch) | |
| tree | d615987f21d168b449482e1b029f7d95ce563101 /apt/cache.py | |
| parent | 22b5c5d28c31eed85d7fad3a7638e1067200029a (diff) | |
| download | python-apt-5e3b11ad62c893fc3f46e748afdd4db5ce2d3672.tar.gz | |
apt/cache.py: Support apt_pkg.OpProgress() and use apt.progress.text.OpProgress()
Diffstat (limited to 'apt/cache.py')
| -rw-r--r-- | apt/cache.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/apt/cache.py b/apt/cache.py index 414bd982..a93d5575 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -26,7 +26,7 @@ import apt_pkg from apt import Package from apt.deprecation import (AttributeDeprecatedBy, function_deprecated_by, deprecated_args) -import apt.progress +import apt.progress.text class FetchCancelledException(IOError): @@ -78,7 +78,7 @@ class Cache(object): a dictionary """ if progress is None: - progress = apt.progress.OpProgress() + progress = apt.progress.text.OpProgress() self._run_callbacks("cache_pre_open") # Make changes to Dir::State::Status work again, by reinitialising @@ -92,12 +92,16 @@ class Cache(object): self._set.clear() self._weakref.clear() - progress.Op = "Building data structures" + progress.op = "Building data structures" i=last=0 size=len(self._cache.packages) for pkg in self._cache.packages: if progress is not None and last+100 < i: - progress.update(i/float(size)*100) + if isinstance(progress, apt_pkg.OpProgress): + progress.percent = i/float(size)*100 + progress.update() + else: + progress.update(i/float(size)*100) last=i # drop stuff with no versions (cruft) if len(pkg.version_list) > 0: |
