summaryrefslogtreecommitdiff
path: root/python/acquire.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2010-01-23 19:34:53 +0100
committerJulian Andres Klode <jak@debian.org>2010-01-23 19:34:53 +0100
commit70609e1f497832502cd25e874190d13c8ff628f0 (patch)
tree9a6fba3a01c4434756e0bc74b9cf1d8d76449786 /python/acquire.cc
parent89752fb6d465c78026befcc5a61e8af655587ad7 (diff)
downloadpython-apt-70609e1f497832502cd25e874190d13c8ff628f0.tar.gz
python: Export a PyAcquire_FromCpp which sets up a correct PyAcquireObject.
Diffstat (limited to 'python/acquire.cc')
-rw-r--r--python/acquire.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/python/acquire.cc b/python/acquire.cc
index ef8b10b6..789f994e 100644
--- a/python/acquire.cc
+++ b/python/acquire.cc
@@ -379,6 +379,17 @@ static PyObject *PkgAcquireNew(PyTypeObject *type,PyObject *Args,PyObject *kwds)
return FetcherObj;
}
+/**
+ * Create a new apt_pkg.Acquire Python object from the pkgAcquire object.
+ */
+PyObject *PyAcquire_FromCpp(pkgAcquire *fetcher, bool Delete) {
+ PyAcquireObject *FetcherObj = (PyAcquireObject *)CppPyObject_NEW<pkgAcquire*>(&PyAcquire_Type, fetcher);
+ new (&FetcherObj->items) item_map();
+ new (&FetcherObj->workers) worker_map();
+ FetcherObj->NoDelete = (!Delete);
+ return FetcherObj;
+}
+
static char *doc_PkgAcquire =
"Acquire(progress: apt_pkg.AcquireProgress) -> Acquire() object.\n\n"
"Create a new acquire object. The parameter *progress* can be used to\n"