diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2012-08-14 14:58:25 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2012-08-14 14:58:25 +0200 |
| commit | c1ad8a0fbc0adfebdb847f28da92b3d5a1f90582 (patch) | |
| tree | 80225148a1c1d0d4283fb76e827c6ccc9ca206bf /python/cache.cc | |
| parent | c736d5c9290a2ffdb8802a4ac62e521cf1218b54 (diff) | |
| parent | dfd6bacface878eecf3fec4876bdae2f0491a646 (diff) | |
| download | python-apt-c1ad8a0fbc0adfebdb847f28da92b3d5a1f90582.tar.gz | |
merged from the debian-sid tree
Diffstat (limited to 'python/cache.cc')
| -rw-r--r-- | python/cache.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/python/cache.cc b/python/cache.cc index b263d320..c51bd4af 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -198,11 +198,13 @@ static PyObject *PkgCacheOpen(PyObject *Self,PyObject *Args) } //std::cout << "new cache is " << (pkgCache*)(*Cache) << std::endl; + + // ensure that the states are correct (LP: #659438) + pkgApplyStatus(*Cache); // update the cache pointer after the cache was rebuild ((CppPyObject<pkgCache*> *)Self)->Object = (pkgCache*)(*Cache); - Py_INCREF(Py_None); return HandleErrors(Py_None); } @@ -229,6 +231,12 @@ static PyObject *PkgCacheGetGroups(PyObject *Self, void*) { return CppPyObject_NEW<GrpListStruct>(Self,&PyGroupList_Type,Cache->GrpBegin()); } +static PyObject *PkgCacheGetPolicy(PyObject *Self, void*) { + pkgCacheFile *CacheFile = GetCpp<pkgCacheFile *>(Self); + std::cerr << "policy: " << CacheFile->Policy << std::endl; + return CppPyObject_NEW<pkgPolicy*>(Self,&PyPolicy_Type,CacheFile->Policy); +} + static PyObject *PkgCacheGetPackages(PyObject *Self, void*) { pkgCache *Cache = GetCpp<pkgCache *>(Self); return CppPyObject_NEW<PkgListStruct>(Self,&PyPackageList_Type,Cache->PkgBegin()); @@ -289,6 +297,7 @@ static PyGetSetDef PkgCacheGetSet[] = { {"group_count",PkgCacheGetGroupCount,0, "The number of apt_pkg.Group objects stored in the cache."}, {"groups", PkgCacheGetGroups, 0, "A list of Group objects in the cache"}, + {"policy", PkgCacheGetPolicy, 0, "The PkgPolicy for the cache"}, {"is_multi_arch", PkgCacheGetIsMultiArch, 0, "Whether the cache supports multi-arch."}, {"package_count",PkgCacheGetPackageCount,0, @@ -394,6 +403,9 @@ static PyObject *PkgCacheNew(PyTypeObject *type,PyObject *Args,PyObject *kwds) return HandleErrors(); } + // ensure that the states are correct (LP: #659438) + pkgApplyStatus(*Cache); + CppPyObject<pkgCacheFile*> *CacheFileObj = CppPyObject_NEW<pkgCacheFile*>(0,&PyCacheFile_Type, Cache); |
