diff options
| author | Julian Andres Klode <jak@debian.org> | 2009-08-24 15:46:29 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2009-08-24 15:46:29 +0200 |
| commit | b564655353399acb70431b31c63f3df08c5d42ab (patch) | |
| tree | bc15346cc36d51e2c805617e31671da77ca80de2 | |
| parent | 0fcb7e9ad1ec729a08d93b133dda7d5df37a3fd8 (diff) | |
| download | python-apt-b564655353399acb70431b31c63f3df08c5d42ab.tar.gz | |
* python/depcache.cc:
- Make ActionGroups context managers so apt.Cache.actiongroup() has
the same behavior as in 0.7.92
| -rw-r--r-- | debian/changelog | 10 | ||||
| -rw-r--r-- | python/depcache.cc | 15 |
2 files changed, 23 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog index eddd9194..00900dad 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,16 @@ python-apt (0.7.13.3) UNRELEASED; urgency=low + [ Michael Vogt ] * apt/cache.py: - add actiongroup() method (backport from 0.7.92) - -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 24 Aug 2009 13:41:38 +0200 - + [ 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: 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__()"}, {} }; |
