diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2007-09-04 16:28:25 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2007-09-04 16:28:25 +0200 |
| commit | 8ad58480ce8a161519339b41eacefc26059bebf7 (patch) | |
| tree | f0ddb861333b467ecb3cadbc160f6b9bac94ee8b /python/sourcelist.cc | |
| parent | 9d88586c37e9a5702949f90fc589ef941d57f661 (diff) | |
| download | python-apt-8ad58480ce8a161519339b41eacefc26059bebf7.tar.gz | |
* python/metaindex.cc:
- added support for the metaIndex objects
* python/sourceslist.cc:
- support new "List" attribute that returns the list of
metaIndex source entries
Diffstat (limited to 'python/sourcelist.cc')
| -rw-r--r-- | python/sourcelist.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/python/sourcelist.cc b/python/sourcelist.cc index 16e51368..68b764f8 100644 --- a/python/sourcelist.cc +++ b/python/sourcelist.cc @@ -80,7 +80,21 @@ static PyMethodDef PkgSourceListMethods[] = static PyObject *PkgSourceListAttr(PyObject *Self,char *Name) { - return Py_FindMethod(PkgSourceListMethods,Self,Name); + 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 *Obj; + Obj = CppPyObject_NEW<metaIndex*>(&MetaIndexType,*I); + PyList_Append(List,Obj); + } + return List; + } + return Py_FindMethod(PkgSourceListMethods,Self,Name); } PyTypeObject PkgSourceListType = { |
