summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-03-31 11:41:46 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-03-31 11:41:46 +0000
commit67b5de8d0564a0f349766ffa26ffbcc5a6fdab6e (patch)
tree08615cf788458e351c108b71141a4414b6226164 /python
parente85acde9ac66221e7dae0ead2bb9d79140a1826b (diff)
downloadpython-apt-67b5de8d0564a0f349766ffa26ffbcc5a6fdab6e.tar.gz
* debcache has a "Packages" attribute now too (like the cache)
Diffstat (limited to 'python')
-rw-r--r--python/cache.cc10
-rw-r--r--python/depcache.cc7
2 files changed, 7 insertions, 10 deletions
diff --git a/python/cache.cc b/python/cache.cc
index aff5854a..9ad558da 100644
--- a/python/cache.cc
+++ b/python/cache.cc
@@ -20,17 +20,9 @@
#include <Python.h>
#include "progress.h"
-
+#include "cache.h"
/*}}}*/
-struct PkgListStruct
-{
- pkgCache::PkgIterator Iter;
- unsigned long LastIndex;
-
- PkgListStruct(pkgCache::PkgIterator const &I) : Iter(I), LastIndex(0) {}
- PkgListStruct() {abort();}; // G++ Bug..
-};
struct RDepListStruct
{
diff --git a/python/depcache.cc b/python/depcache.cc
index 4bd1f390..9c302b40 100644
--- a/python/depcache.cc
+++ b/python/depcache.cc
@@ -21,6 +21,7 @@
#include <iostream>
#include "progress.h"
+#include "cache.h"
// DepCache Class /*{{{*/
// ---------------------------------------------------------------------
@@ -295,8 +296,12 @@ static PyObject *DepCacheAttr(PyObject *Self,char *Name)
{
PkgDepCacheStruct &Struct = GetCpp<PkgDepCacheStruct>(Self);
+ // look like a cache
+ if (strcmp("Packages",Name) == 0)
+ return CppOwnedPyObject_NEW<PkgListStruct>(Self,&PkgListType,
+ Struct.depcache->PkgBegin());
// size querries
- if(strcmp("KeepCount",Name) == 0)
+ else if(strcmp("KeepCount",Name) == 0)
return Py_BuildValue("l", Struct.depcache->KeepCount());
else if(strcmp("InstCount",Name) == 0)
return Py_BuildValue("l", Struct.depcache->InstCount());