summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-07-11 21:16:11 +0200
committerJulian Andres Klode <jak@debian.org>2009-07-11 21:16:11 +0200
commit3c8959ed35b026ae57600c7f0b2ed531a98c7c0b (patch)
tree9dea5af6a188a23ac3d1dfb85ce0b667f9b020d2 /python
parent2d8f74890d6203c669db960c7108cad7f45c3a70 (diff)
downloadpython-apt-3c8959ed35b026ae57600c7f0b2ed531a98c7c0b.tar.gz
python/depcache.cc: Introduce DepCache.policy property.
This property allows you to access the Policy of the DepCache.
Diffstat (limited to 'python')
-rw-r--r--python/depcache.cc13
1 files changed, 13 insertions, 0 deletions
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<pkgDepCache*>(Self);
+ pkgDepCache *DepCache = GetCpp<pkgDepCache*>(Self);
+ pkgPolicy *Policy = (pkgPolicy *)&DepCache->GetPolicy();
+ CppOwnedPyObject<pkgPolicy*> *PyPolicy =
+ CppOwnedPyObject_NEW<pkgPolicy*>(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},