summaryrefslogtreecommitdiff
path: root/python/depcache.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-03-09 16:59:16 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-03-09 16:59:16 +0000
commitd06566c40340c80db43e47b171ceda579291ef66 (patch)
treec9a5f694bca4067c594c62026b703ebc62857fcd /python/depcache.cc
parent59902bad90ed9192ad9b2def78f588cdefe1080c (diff)
downloadpython-apt-d06566c40340c80db43e47b171ceda579291ef66.tar.gz
* OpProgress interface added for DepCache
Diffstat (limited to 'python/depcache.cc')
-rw-r--r--python/depcache.cc26
1 files changed, 21 insertions, 5 deletions
diff --git a/python/depcache.cc b/python/depcache.cc
index ac779063..4bd1f390 100644
--- a/python/depcache.cc
+++ b/python/depcache.cc
@@ -20,7 +20,7 @@
#include <Python.h>
#include <iostream>
-
+#include "progress.h"
// DepCache Class /*{{{*/
// ---------------------------------------------------------------------
@@ -49,7 +49,17 @@ static PyObject *PkgDepCacheInit(PyObject *Self,PyObject *Args)
{
PkgDepCacheStruct &Struct = GetCpp<PkgDepCacheStruct>(Self);
- Struct.depcache->Init(0);
+ PyObject *pyCallbackInst = 0;
+ if (PyArg_ParseTuple(Args, "|O", &pyCallbackInst) == 0)
+ return 0;
+
+ if(pyCallbackInst != 0) {
+ PyOpProgress progress;
+ progress.setCallbackInst(pyCallbackInst);
+ Struct.depcache->Init(&progress);
+ } else {
+ Struct.depcache->Init(0);
+ }
return HandleErrors(Py_None);
}
@@ -330,7 +340,8 @@ PyTypeObject PkgDepCacheType =
PyObject *GetDepCache(PyObject *Self,PyObject *Args)
{
PyObject *Owner;
- if (PyArg_ParseTuple(Args,"O!",&PkgCacheType,&Owner) == 0)
+ PyObject *pyCallbackInst = 0;
+ if (PyArg_ParseTuple(Args,"O!|O",&PkgCacheType,&Owner,&pyCallbackInst) == 0)
return 0;
PyObject *DepCachePyObj;
@@ -340,8 +351,13 @@ PyObject *GetDepCache(PyObject *Self,PyObject *Args)
HandleErrors(DepCachePyObj);
PkgDepCacheStruct &Struct = GetCpp<PkgDepCacheStruct>(DepCachePyObj);
- // init without progress obj
- Struct.depcache->Init(0);
+ if(pyCallbackInst != 0) {
+ PyOpProgress progress;
+ progress.setCallbackInst(pyCallbackInst);
+ Struct.depcache->Init(&progress);
+ } else {
+ Struct.depcache->Init(0);
+ }
return DepCachePyObj;
}