diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2005-11-22 11:45:03 +0000 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2005-11-22 11:45:03 +0000 |
| commit | 86fea3ed91794aa9537a3b197dbaac500b82f2d8 (patch) | |
| tree | 34debb11b9d10d23da39ea362ea841fba669a8fe /python | |
| parent | c1ee07ec049974cf8a54160b52881404b6347f43 (diff) | |
| download | python-apt-86fea3ed91794aa9537a3b197dbaac500b82f2d8.tar.gz | |
* python/sourcelist.cc cleaned up
Diffstat (limited to 'python')
| -rw-r--r-- | python/pkgmanager.cc | 9 | ||||
| -rw-r--r-- | python/sourcelist.cc | 18 | ||||
| -rw-r--r-- | python/sourcelist.h | 6 |
3 files changed, 14 insertions, 19 deletions
diff --git a/python/pkgmanager.cc b/python/pkgmanager.cc index 133db755..ce6d35a8 100644 --- a/python/pkgmanager.cc +++ b/python/pkgmanager.cc @@ -9,11 +9,11 @@ #include "generic.h" #include "apt_pkgmodule.h" #include "acquire.h" -#include "sourcelist.h" #include "pkgrecords.h" #include <apt-pkg/packagemanager.h> #include <apt-pkg/pkgsystem.h> +#include <apt-pkg/sourcelist.h> #include <apt-pkg/error.h> #include <iostream> @@ -31,12 +31,11 @@ static PyObject *PkgManagerGetArchives(PyObject *Self,PyObject *Args) return 0; PkgAcquireStruct &s_fetcher = GetCpp<PkgAcquireStruct>(fetcher); - PkgSourceListStruct &s_list = GetCpp<PkgSourceListStruct>(list); + pkgSourceList *s_list = GetCpp<pkgSourceList*>(list); PkgRecordsStruct &s_records = GetCpp<PkgRecordsStruct>(recs); - bool res = pm->GetArchives(&s_fetcher.fetcher, - &s_list.List, - &s_records.Records); + bool res = pm->GetArchives(&s_fetcher.fetcher, s_list, + &s_records.Records); return HandleErrors(Py_BuildValue("b",res)); } diff --git a/python/sourcelist.cc b/python/sourcelist.cc index 06cf58a2..2d65062c 100644 --- a/python/sourcelist.cc +++ b/python/sourcelist.cc @@ -10,7 +10,8 @@ // Include Files /*{{{*/ #include "generic.h" #include "apt_pkgmodule.h" -#include "sourcelist.h" + +#include <apt-pkg/sourcelist.h> #include <Python.h> /*}}}*/ @@ -22,17 +23,18 @@ static char *doc_PkgSourceListFindIndex = "xxx"; static PyObject *PkgSourceListFindIndex(PyObject *Self,PyObject *Args) { - PkgSourceListStruct &Struct = GetCpp<PkgSourceListStruct>(Self); + pkgSourceList *list = GetCpp<pkgSourceList*>(Self); return Py_BuildValue("i", 1); } static char *doc_PkgSourceListReadMainList = "xxx"; static PyObject *PkgSourceListReadMainList(PyObject *Self,PyObject *Args) { - PkgSourceListStruct &Struct = GetCpp<PkgSourceListStruct>(Self); - Struct.List.ReadMainList(); + // PkgSourceListStruct &Struct = GetCpp<PkgSourceListStruct>(Self); + pkgSourceList *list = GetCpp<pkgSourceList*>(Self); + bool res = list->ReadMainList(); - return Py_None; + return HandleErrors(Py_BuildValue("b",res)); } static PyMethodDef PkgSourceListMethods[] = @@ -51,10 +53,10 @@ PyTypeObject PkgSourceListType = PyObject_HEAD_INIT(&PyType_Type) 0, // ob_size "pkgSourceList", // tp_name - sizeof(CppPyObject<PkgSourceListStruct>), // tp_basicsize + sizeof(CppPyObject<pkgSourceList*>), // tp_basicsize 0, // tp_itemsize // Methods - CppDealloc<PkgSourceListStruct>, // tp_dealloc + CppDealloc<pkgSourceList*>, // tp_dealloc 0, // tp_print PkgSourceListAttr, // tp_getattr 0, // tp_setattr @@ -68,6 +70,6 @@ PyTypeObject PkgSourceListType = PyObject *GetPkgSourceList(PyObject *Self,PyObject *Args) { - return CppPyObject_NEW<PkgSourceListStruct>(&PkgSourceListType); + return CppPyObject_NEW<pkgSourceList*>(&PkgSourceListType,new pkgSourceList()); } diff --git a/python/sourcelist.h b/python/sourcelist.h deleted file mode 100644 index 98684c54..00000000 --- a/python/sourcelist.h +++ /dev/null @@ -1,6 +0,0 @@ -#include <apt-pkg/sourcelist.h> - -struct PkgSourceListStruct -{ - pkgSourceList List; -}; |
