From 6d42024c88d207c35718f4f8458e58fc44951830 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 9 Mar 2005 14:57:55 +0000 Subject: * experimental progress callback is back, not too usefull now --- doc/examples/depcache.py | 10 +++++++++- python/progress.h | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/examples/depcache.py b/doc/examples/depcache.py index a5ecc240..76487b1d 100644 --- a/doc/examples/depcache.py +++ b/doc/examples/depcache.py @@ -2,15 +2,23 @@ # example how to deal with the depcache import apt_pkg +import sys + +def progress(percent, data): + print "%s %s" % (data, percent) + # init apt_pkg.init() -cache = apt_pkg.GetCache() +cache = apt_pkg.GetCache(progress,None) print "Available packages: %s " % cache.PackageCount +sys.exit() + iter = cache["base-config"] print "example package iter: %s" % iter + # get depcache depcache = apt_pkg.GetDepCache(cache) depcache.ReadPinFile() diff --git a/python/progress.h b/python/progress.h index d653b42d..5859eea0 100644 --- a/python/progress.h +++ b/python/progress.h @@ -1,6 +1,8 @@ #ifndef PROGRESS_H #define PROGRESS_H +#include + struct PyOpProgressStruct : public OpProgress { @@ -12,7 +14,7 @@ struct PyOpProgressStruct : public OpProgress return; // Build up the argument list... - PyObject *arglist = Py_BuildValue("(fO)", Percent, py_update_callback_args); + PyObject *arglist = Py_BuildValue("fO", Percent,py_update_callback_args); // ...for calling the Python compare function. PyObject *result = PyEval_CallObject(py_update_callback_func,arglist); -- cgit v1.2.3