diff options
| author | Michael Vogt <egon@bottom> | 2006-07-26 16:59:37 +0200 |
|---|---|---|
| committer | Michael Vogt <egon@bottom> | 2006-07-26 16:59:37 +0200 |
| commit | 70c850f4910cfcb6a825c67f577d8bc554612044 (patch) | |
| tree | 5321c9aa207b8743c7cca63e2b7b05609fbcddf7 /python/pkgrecords.cc | |
| parent | f701fc174a88d8f2b418a032571ff40ed6fd56e6 (diff) | |
| parent | 6fc084d34105f336fdf090e2dd45e402e25cfc57 (diff) | |
| download | python-apt-70c850f4910cfcb6a825c67f577d8bc554612044.tar.gz | |
* merged from the auto-mark branch
Diffstat (limited to 'python/pkgrecords.cc')
| -rw-r--r-- | python/pkgrecords.cc | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/python/pkgrecords.cc b/python/pkgrecords.cc index 7f5aa0e2..ec78f554 100644 --- a/python/pkgrecords.cc +++ b/python/pkgrecords.cc @@ -10,20 +10,12 @@ // Include Files /*{{{*/ #include "generic.h" #include "apt_pkgmodule.h" +#include "pkgrecords.h" -#include <apt-pkg/pkgrecords.h> #include <Python.h> /*}}}*/ -struct PkgRecordsStruct -{ - pkgRecords Records; - pkgRecords::Parser *Last; - - PkgRecordsStruct(pkgCache *Cache) : Records(*Cache), Last(0) {}; - PkgRecordsStruct() : Records(*(pkgCache *)0) {abort();}; // G++ Bug.. -}; // PkgRecords Class /*{{{*/ // --------------------------------------------------------------------- @@ -54,7 +46,7 @@ static PyObject *PkgRecordsLookup(PyObject *Self,PyObject *Args) // always return true (to make it consistent with the pkgsrcrecords object return Py_BuildValue("i", 1); } - + static PyMethodDef PkgRecordsMethods[] = { {"Lookup",PkgRecordsLookup,METH_VARARGS,"Changes to a new package"}, @@ -81,6 +73,12 @@ static PyObject *PkgRecordsAttr(PyObject *Self,char *Name) return CppPyString(Struct.Last->LongDesc()); else if (strcmp("Name",Name) == 0) return CppPyString(Struct.Last->Name()); + else if (strcmp("Record", Name) == 0) + { + const char *start, *stop; + Struct.Last->GetRec(start, stop); + return PyString_FromStringAndSize(start,stop-start); + } } return Py_FindMethod(PkgRecordsMethods,Self,Name); |
