diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2005-06-03 09:07:45 +0000 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2005-06-03 09:07:45 +0000 |
| commit | ba52c2411c020e528e65450c7dfaf62525d45a78 (patch) | |
| tree | 2afa0c4710c6ef5eeb4cd3e01bfda6566a99a70c | |
| parent | 64ac76c04670fdf45da3c0ccab69d6427fd391e4 (diff) | |
| download | python-apt-ba52c2411c020e528e65450c7dfaf62525d45a78.tar.gz | |
* fixes, MarkedInstall() checks for "NewInstall()" now, we have "Upgrade()" to check for upgrades
| -rw-r--r-- | apt/cache.py | 4 | ||||
| -rw-r--r-- | apt/package.py | 9 | ||||
| -rw-r--r-- | python/depcache.cc | 2 |
3 files changed, 11 insertions, 4 deletions
diff --git a/apt/cache.py b/apt/cache.py index 1390e145..f2e8f4b7 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -133,9 +133,9 @@ class FilteredCache(Cache): self._reapplyFilter() def CachePostChange(self): - Cache.CachePostChange(self) " called internally if the cache changes, emit a signal then " self._reapplyFilter() + Cache.CachePostChange(self) def cache_pre_changed(): print "cache pre changed" @@ -166,6 +166,8 @@ if __name__ == "__main__": print "Testing filtered cache" c = FilteredCache() + c.connect("cache_pre_change", cache_pre_changed) + c.connect("cache_post_change", cache_post_changed) c.Upgrade() c.SetFilter(MarkedChangesFilter()) print len(c) diff --git a/apt/package.py b/apt/package.py index fb4a85a2..de9a9dbb 100644 --- a/apt/package.py +++ b/apt/package.py @@ -125,9 +125,14 @@ class Package(object): self._pcache.CachePostChange() def MarkInstall(self): self._pcache.CachePreChange() - return self._depcache.MarkInstall(self._pkg) + self._depcache.MarkInstall(self._pkg) self._pcache.CachePostChange() - + def MarkUpgrade(self): + if self.IsUpgradable(): + self.MarkInstall() + # FIXME: we may want to throw a exception here + sys.stderr.write("MarkUpgrade() called on a non-upgrable pkg") + # size def PackageSize(self, UseCandidate=True): if UseCandidate: diff --git a/python/depcache.cc b/python/depcache.cc index b7ed98ac..027fb9bb 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -358,7 +358,7 @@ static PyObject *PkgDepCacheMarkedInstall(PyObject *Self,PyObject *Args) pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj); pkgDepCache::StateCache &state = (*depcache)[Pkg]; - return HandleErrors(Py_BuildValue("b",state.Install())); + return HandleErrors(Py_BuildValue("b",state.NewInstall())); } static PyObject *PkgDepCacheMarkedUpgrade(PyObject *Self,PyObject *Args) |
