summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2009-08-24 16:45:03 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2009-08-24 16:45:03 +0200
commitecbf6e3a8002a1173a05decdf57f5b197482f8d2 (patch)
tree47f13f24a2401c305bcfc4173e406dc1ed91ac18
parenteb48d80c9a845bbb687790331c0a7c71a3365973 (diff)
parentefad08768bc116c15de5f92387e1fd88c0734fd0 (diff)
downloadpython-apt-ecbf6e3a8002a1173a05decdf57f5b197482f8d2.tar.gz
merge the mvo branch
-rw-r--r--apt/cache.py10
-rw-r--r--debian/changelog22
-rw-r--r--python/depcache.cc15
3 files changed, 44 insertions, 3 deletions
diff --git a/apt/cache.py b/apt/cache.py
index 756f9ba9..828b167b 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -135,6 +135,7 @@ class Cache(object):
return self._weakref[key]
except KeyError:
if key in self._set:
+ key = str(key)
pkg = self._weakref[key] = Package(self, self._cache[key])
return pkg
else:
@@ -334,6 +335,15 @@ class Cache(object):
a signal then """
self._runCallbacks("cache_pre_change")
+ def actiongroup(self):
+ """Return an ActionGroup() object for the current cache.
+
+ Action groups can be used to speedup actions. The action group is
+ active as soon as it is created, and disabled when the object is
+ deleted or when release() is called.
+ """
+ return apt_pkg.GetPkgActionGroup(self._depcache)
+
def connect(self, name, callback):
""" connect to a signal, currently only used for
cache_{post,pre}_{changed,open} """
diff --git a/debian/changelog b/debian/changelog
index 88fa3c08..7d49c416 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,24 @@
-python-apt (0.7.13.1ubuntu1) karmic; urgency=low
+python-apt (0.7.13.2ubuntu1) karmic; urgency=low
- * merged from debian-sid
+ * merged from the debian-sid bzr branch
+
+ [ Michael Vogt ]
+ * apt/cache.py:
+ - add actiongroup() method (backport from 0.7.92)
+
+ [ Julian Andres Klode ]
+ * python/depcache.cc:
+ - Make ActionGroups context managers so apt.Cache.actiongroup() has
+ the same behavior as in 0.7.92
+
+ -- Julian Andres Klode <jak@debian.org> Mon, 24 Aug 2009 15:43:00 +0200
+
+python-apt (0.7.13.2) unstable; urgency=low
+
+ * apt/cache.py:
+ - Convert argument to str in __getitem__() (Closes: #542965).
- -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 24 Aug 2009 13:36:02 +0200
+ -- Julian Andres Klode <jak@debian.org> Sat, 22 Aug 2009 22:47:30 +0200
python-apt (0.7.13.1) unstable; urgency=low
diff --git a/python/depcache.cc b/python/depcache.cc
index 0e83c956..7edb7b59 100644
--- a/python/depcache.cc
+++ b/python/depcache.cc
@@ -794,9 +794,24 @@ static PyObject *PkgActionGroupRelease(PyObject *Self,PyObject *Args)
return HandleErrors(Py_None);
}
+static PyObject *PkgActionGroupEnter(PyObject *Self,PyObject *Args) {
+ if (PyArg_ParseTuple(Args,"") == 0)
+ return 0;
+ Py_INCREF(Self);
+ return Self;
+}
+static PyObject *PkgActionGroupExit(PyObject *Self,PyObject *Args) {
+ pkgDepCache::ActionGroup *ag = GetCpp<pkgDepCache::ActionGroup*>(Self);
+ ag->release();
+ Py_RETURN_FALSE;
+}
+
+
static PyMethodDef PkgActionGroupMethods[] =
{
{"release", PkgActionGroupRelease, METH_VARARGS, "release()"},
+ {"__enter__", PkgActionGroupEnter, METH_VARARGS, "__enter__() -> self"},
+ {"__exit__", PkgActionGroupExit, METH_VARARGS, "__exit__()"},
{}
};