summaryrefslogtreecommitdiff
path: root/python/acquire.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-11-22 11:52:23 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-11-22 11:52:23 +0000
commitf505ecbf86d6ab30208c579a5e25c819c3733d89 (patch)
treedc803bcb82c624f2481b9786fe6bae57c89034d1 /python/acquire.cc
parent86fea3ed91794aa9537a3b197dbaac500b82f2d8 (diff)
downloadpython-apt-f505ecbf86d6ab30208c579a5e25c819c3733d89.tar.gz
* fixes in the acquire interface code (use CppPyObject with pkgAcquire* directly instead of using a PkgAcquireStruct)
Diffstat (limited to 'python/acquire.cc')
-rw-r--r--python/acquire.cc29
1 files changed, 14 insertions, 15 deletions
diff --git a/python/acquire.cc b/python/acquire.cc
index 87f2717a..1bbed72a 100644
--- a/python/acquire.cc
+++ b/python/acquire.cc
@@ -8,7 +8,6 @@
#include "generic.h"
#include "apt_pkgmodule.h"
-#include "acquire.h"
#include "progress.h"
#include <apt-pkg/acquire-item.h>
@@ -93,25 +92,25 @@ PyTypeObject AcquireItemType =
static PyObject *PkgAcquireRun(PyObject *Self,PyObject *Args)
{
- PkgAcquireStruct &Struct = GetCpp<PkgAcquireStruct>(Self);
+ pkgAcquire *fetcher = GetCpp<pkgAcquire*>(Self);
if (PyArg_ParseTuple(Args, "") == 0)
return 0;
//FIXME: add pulse interval here
- pkgAcquire::RunResult run = Struct.fetcher.Run();
+ pkgAcquire::RunResult run = fetcher->Run();
return HandleErrors(Py_BuildValue("i",run));
}
static PyObject *PkgAcquireShutdown(PyObject *Self,PyObject *Args)
{
- PkgAcquireStruct &Struct = GetCpp<PkgAcquireStruct>(Self);
+ pkgAcquire *fetcher = GetCpp<pkgAcquire*>(Self);
if (PyArg_ParseTuple(Args, "") == 0)
return 0;
- Struct.fetcher.Shutdown();
+ fetcher->Shutdown();
Py_INCREF(Py_None);
return HandleErrors(Py_None);
@@ -126,19 +125,19 @@ static PyMethodDef PkgAcquireMethods[] =
static PyObject *AcquireAttr(PyObject *Self,char *Name)
{
- PkgAcquireStruct &Struct = GetCpp<PkgAcquireStruct>(Self);
+ pkgAcquire *fetcher = GetCpp<pkgAcquire*>(Self);
if(strcmp("TotalNeeded",Name) == 0)
- return Py_BuildValue("l", Struct.fetcher.TotalNeeded());
+ return Py_BuildValue("l", fetcher->TotalNeeded());
if(strcmp("FetchNeeded",Name) == 0)
- return Py_BuildValue("l", Struct.fetcher.FetchNeeded());
+ return Py_BuildValue("l", fetcher->FetchNeeded());
if(strcmp("PartialPresent",Name) == 0)
- return Py_BuildValue("l", Struct.fetcher.PartialPresent());
+ return Py_BuildValue("l", fetcher->PartialPresent());
if(strcmp("Items",Name) == 0)
{
PyObject *List = PyList_New(0);
- for (pkgAcquire::ItemIterator I = Struct.fetcher.ItemsBegin();
- I != Struct.fetcher.ItemsEnd(); I++)
+ for (pkgAcquire::ItemIterator I = fetcher->ItemsBegin();
+ I != fetcher->ItemsEnd(); I++)
{
PyObject *Obj;
Obj = CppOwnedPyObject_NEW<pkgAcquire::ItemIterator>(Self,&AcquireItemType,I);
@@ -167,10 +166,10 @@ PyTypeObject PkgAcquireType =
PyObject_HEAD_INIT(&PyType_Type)
0, // ob_size
"Acquire", // tp_name
- sizeof(CppOwnedPyObject<PkgAcquireStruct>), // tp_basicsize
+ sizeof(CppPyObject<pkgAcquire*>), // tp_basicsize
0, // tp_itemsize
// Methods
- CppOwnedDealloc<PkgAcquireStruct>, // tp_dealloc
+ CppDealloc<pkgAcquire*>, // tp_dealloc
0, // tp_print
AcquireAttr, // tp_getattr
0, // tp_setattr
@@ -199,8 +198,8 @@ PyObject *GetAcquire(PyObject *Self,PyObject *Args)
fetcher = new pkgAcquire();
}
- CppOwnedPyObject<pkgAcquire> *FetcherObj =
- CppOwnedPyObject_NEW<pkgAcquire>(0,&PkgAcquireType, *fetcher);
+ CppPyObject<pkgAcquire*> *FetcherObj =
+ CppPyObject_NEW<pkgAcquire*>(&PkgAcquireType, fetcher);
return FetcherObj;
}