summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-07-07 17:00:38 +0200
committerJulian Andres Klode <jak@debian.org>2009-07-07 17:00:38 +0200
commit2a2d636ca765e737bdbd36ed6b39b2319a466ce9 (patch)
treeccb5a2bee8a59559a2ce8a285fc164247ded8da2 /python
parentca5913fc53580b29034d56dd7942c5cdf5207afe (diff)
downloadpython-apt-2a2d636ca765e737bdbd36ed6b39b2319a466ce9.tar.gz
python/policy.cc: Add Policy_ReadPinDir() [APT 0.7.22]
Diffstat (limited to 'python')
-rw-r--r--python/policy.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/python/policy.cc b/python/policy.cc
index 91ed5454..46d73a1a 100644
--- a/python/policy.cc
+++ b/python/policy.cc
@@ -96,6 +96,18 @@ static PyObject *Policy_ReadPinFile(PyObject *self, PyObject *arg) {
return PyBool_FromLong(ReadPinFile(*policy, PyString_AsString(arg)));
}
+static char *Policy_ReadPinDir_doc = "read_pindir(dirname: str) -> bool\n\n"
+ "Read the pin files in the given dir (e.g. '/etc/apt/preferences.d') and\n"
+ "add them to the policy.";
+
+static PyObject *Policy_ReadPinDir(PyObject *self, PyObject *arg) {
+ if (!PyString_Check(arg))
+ return 0;
+ pkgPolicy *policy = GetCpp<pkgPolicy *>(self);
+
+ return PyBool_FromLong(ReadPinDir(*policy, PyString_AsString(arg)));
+}
+
static char *Policy_CreatePin_doc = "create_pin(type: str, pkg: str, "
"data: str, priority: int)\n\n"
"Create a pin for the policy. The parameter 'type' refers to one of the\n"
@@ -131,6 +143,8 @@ static PyMethodDef Policy_Methods[] = {
Policy_GetCandidateVer_doc},
{"read_pinfile",(PyCFunction)Policy_ReadPinFile,METH_O,
Policy_ReadPinFile_doc},
+ {"read_pindir",(PyCFunction)Policy_ReadPinDir,METH_O,
+ Policy_ReadPinFile_doc},
{"create_pin",Policy_CreatePin,METH_VARARGS,Policy_CreatePin_doc},
{"get_match",(PyCFunction)Policy_GetMatch,METH_O, Policy_GetMatch_doc},
{}