diff options
Diffstat (limited to 'python/depcache.cc')
| -rw-r--r-- | python/depcache.cc | 15 |
1 files changed, 15 insertions, 0 deletions
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__()"}, {} }; |
