summaryrefslogtreecommitdiff
path: root/python/sourcelist.cc
diff options
context:
space:
mode:
Diffstat (limited to 'python/sourcelist.cc')
-rw-r--r--python/sourcelist.cc47
1 files changed, 32 insertions, 15 deletions
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)