diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2009-01-13 17:50:30 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2009-01-13 17:50:30 +0100 |
| commit | 8b46b0c4bdfbaa07972311b1cf19616d5c5aff04 (patch) | |
| tree | 59167b2b8c1d331bfebf072d5ba84dd154f0b373 /python/pkgrecords.cc | |
| parent | 6c1711a80a8a7d011f4d5f49618ff396ad2f5722 (diff) | |
| parent | 85839f4f241c99f9e4ebb0a6a8847a2d433f1160 (diff) | |
| download | python-apt-8b46b0c4bdfbaa07972311b1cf19616d5c5aff04.tar.gz | |
merge from the debian experimental branch
Diffstat (limited to 'python/pkgrecords.cc')
| -rw-r--r-- | python/pkgrecords.cc | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/python/pkgrecords.cc b/python/pkgrecords.cc index 93bc54d9..5359ee6f 100644 --- a/python/pkgrecords.cc +++ b/python/pkgrecords.cc @@ -16,20 +16,20 @@ #include <Python.h> /*}}}*/ - + // PkgRecords Class /*{{{*/ // --------------------------------------------------------------------- static PyObject *PkgRecordsLookup(PyObject *Self,PyObject *Args) -{ +{ PkgRecordsStruct &Struct = GetCpp<PkgRecordsStruct>(Self); - + PyObject *PkgFObj; long int Index; if (PyArg_ParseTuple(Args,"(O!l)",&PackageFileType,&PkgFObj,&Index) == 0) return 0; - + // Get the index and check to make sure it is reasonable pkgCache::PkgFileIterator &PkgF = GetCpp<pkgCache::PkgFileIterator>(PkgFObj); pkgCache *Cache = PkgF.Cache(); @@ -39,15 +39,15 @@ static PyObject *PkgRecordsLookup(PyObject *Self,PyObject *Args) PyErr_SetNone(PyExc_IndexError); return 0; } - + // Do the lookup Struct.Last = &Struct.Records.Lookup(pkgCache::VerFileIterator(*Cache,Cache->VerFileP+Index)); // always return true (to make it consistent with the pkgsrcrecords object return Py_BuildValue("i", 1); } - -static PyMethodDef PkgRecordsMethods[] = + +static PyMethodDef PkgRecordsMethods[] = { {"Lookup",PkgRecordsLookup,METH_VARARGS,"Changes to a new package"}, {} @@ -65,6 +65,8 @@ static PyObject *PkgRecordsAttr(PyObject *Self,char *Name) return CppPyString(Struct.Last->MD5Hash()); else if (strcmp("SHA1Hash",Name) == 0) return CppPyString(Struct.Last->SHA1Hash()); + else if (strcmp("SHA256Hash",Name) == 0) + return CppPyString(Struct.Last->SHA256Hash()); else if (strcmp("SourcePkg",Name) == 0) return CppPyString(Struct.Last->SourcePkg()); else if (strcmp("SourceVer",Name) == 0) @@ -79,14 +81,14 @@ static PyObject *PkgRecordsAttr(PyObject *Self,char *Name) return CppPyString(Struct.Last->Name()); else if (strcmp("Homepage",Name) == 0) return CppPyString(Struct.Last->Homepage()); - else if (strcmp("Record", Name) == 0) + 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); } PyTypeObject PkgRecordsType = |
