summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/acquire.cc19
-rw-r--r--python/apt_pkgmodule.cc1
-rw-r--r--python/sourcelist.cc47
3 files changed, 34 insertions, 33 deletions
diff --git a/python/acquire.cc b/python/acquire.cc
index 1ecf55a5..eb1f7418 100644
--- a/python/acquire.cc
+++ b/python/acquire.cc
@@ -205,23 +205,6 @@ PyObject *GetAcquire(PyObject *Self,PyObject *Args)
return FetcherObj;
}
-
-
-
-
-// pkgAcquireFile
-
-static PyObject *AcquireFileAttr(PyObject *Self,char *Name)
-{
- pkgAcqFile *acqFile = GetCpp<pkgAcqFile*>(Self);
-
- PyErr_SetString(PyExc_AttributeError,Name);
- return 0;
-}
-
-
-
-
PyTypeObject PkgAcquireFileType =
{
PyObject_HEAD_INIT(&PyType_Type)
@@ -232,7 +215,7 @@ PyTypeObject PkgAcquireFileType =
// Methods
CppDealloc<pkgAcqFile*>, // tp_dealloc
0, // tp_print
- AcquireFileAttr, // tp_getattr
+ 0, // tp_getattr
0, // tp_setattr
0, // tp_compare
0, // tp_repr
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc
index 145a2bab..b2b20c20 100644
--- a/python/apt_pkgmodule.cc
+++ b/python/apt_pkgmodule.cc
@@ -481,6 +481,7 @@ extern "C" void initapt_pkg()
if (PyType_Ready(&PkgCdromType) == -1) return;
if (PyType_Ready(&PkgProblemResolverType) == -1) return;
if (PyType_Ready(&PkgActionGroupType) == -1) return;
+ if (PyType_Ready(&PkgSourceListType) == -1) return;
// Initialize the module
diff --git a/python/sourcelist.cc b/python/sourcelist.cc
index 5dcaf86b..9f8f8878 100644
--- a/python/sourcelist.cc
+++ b/python/sourcelist.cc
@@ -74,28 +74,29 @@ static PyMethodDef PkgSourceListMethods[] =
{
{"FindIndex",PkgSourceListFindIndex,METH_VARARGS,doc_PkgSourceListFindIndex},
{"ReadMainList",PkgSourceListReadMainList,METH_VARARGS,doc_PkgSourceListReadMainList},
- {"GetIndexes",PkgSourceListGetIndexes,METH_VARARGS,doc_PkgSourceListReadMainList},
+ {"GetIndexes",PkgSourceListGetIndexes,METH_VARARGS,doc_PkgSourceListGetIndexes},
{}
};
-static PyObject *PkgSourceListAttr(PyObject *Self,char *Name)
+static PyObject *PkgSourceListGetList(PyObject *Self,void*)
{
pkgSourceList *list = GetCpp<pkgSourceList*>(Self);
-
- if (strcmp("List",Name) == 0)
+ PyObject *List = PyList_New(0);
+ for (vector<metaIndex *>::const_iterator I = list->begin();
+ I != list->end(); I++)
{
- PyObject *List = PyList_New(0);
- for (vector<metaIndex *>::const_iterator I = list->begin();
- I != list->end(); I++)
- {
- PyObject *Obj;
- Obj = CppPyObject_NEW<metaIndex*>(&MetaIndexType,*I);
- PyList_Append(List,Obj);
- }
- return List;
+ PyObject *Obj;
+ Obj = CppPyObject_NEW<metaIndex*>(&MetaIndexType,*I);
+ PyList_Append(List,Obj);
}
- return Py_FindMethod(PkgSourceListMethods,Self,Name);
+ return List;
}
+
+static PyGetSetDef PkgSourceListGetSet[] = {
+ {"List",PkgSourceListGetList,0,"A list of MetaIndex() objects.",0},
+ {}
+};
+
PyTypeObject PkgSourceListType =
{
PyObject_HEAD_INIT(&PyType_Type)
@@ -106,7 +107,7 @@ PyTypeObject PkgSourceListType =
// Methods
CppDealloc<pkgSourceList*>, // tp_dealloc
0, // tp_print
- PkgSourceListAttr, // tp_getattr
+ 0, // tp_getattr
0, // tp_setattr
0, // tp_compare
0, // tp_repr
@@ -114,6 +115,22 @@ PyTypeObject PkgSourceListType =
0, // tp_as_sequence
0, // tp_as_mapping
0, // tp_hash
+ 0, // tp_call
+ 0, // tp_str
+ 0, // tp_getattro
+ 0, // tp_setattro
+ 0, // tp_as_buffer
+ Py_TPFLAGS_DEFAULT, // tp_flags
+ "pkgSourceList Object", // tp_doc
+ 0, // tp_traverse
+ 0, // tp_clear
+ 0, // tp_richcompare
+ 0, // tp_weaklistoffset
+ 0, // tp_iter
+ 0, // tp_iternext
+ PkgSourceListMethods, // tp_methods
+ 0, // tp_members
+ PkgSourceListGetSet, // tp_getset
};
PyObject *GetPkgSourceList(PyObject *Self,PyObject *Args)