From 3c8959ed35b026ae57600c7f0b2ed531a98c7c0b Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 11 Jul 2009 21:16:11 +0200 Subject: python/depcache.cc: Introduce DepCache.policy property. This property allows you to access the Policy of the DepCache. --- python/depcache.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'python') diff --git a/python/depcache.cc b/python/depcache.cc index 2ce7a595..17e2bc30 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -621,6 +621,18 @@ static PyObject *PkgDepCacheGetDebSize(PyObject *Self,void*) { } #undef depcache +static PyObject *PkgDepCacheGetPolicy(PyObject *Self,void*) { + PyObject *Owner = GetOwner(Self); + pkgDepCache *DepCache = GetCpp(Self); + pkgPolicy *Policy = (pkgPolicy *)&DepCache->GetPolicy(); + CppOwnedPyObject *PyPolicy = + CppOwnedPyObject_NEW(Owner,&PyPolicy_Type,Policy); + // Policy should not be deleted, it is managed by CacheFile. + PyPolicy->NoDelete = true; + return PyPolicy; +} + + static PyGetSetDef PkgDepCacheGetSet[] = { {"broken_count",PkgDepCacheGetBrokenCount}, {"deb_size",PkgDepCacheGetDebSize}, @@ -628,6 +640,7 @@ static PyGetSetDef PkgDepCacheGetSet[] = { {"inst_count",PkgDepCacheGetInstCount}, {"keep_count",PkgDepCacheGetKeepCount}, {"usr_size",PkgDepCacheGetUsrSize}, + {"policy",PkgDepCacheGetPolicy}, #ifdef COMPAT_0_7 {"BrokenCount",PkgDepCacheGetBrokenCount}, {"DebSize",PkgDepCacheGetDebSize}, -- cgit v1.2.3