summaryrefslogtreecommitdiff
path: root/python/apt_pkgmodule.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2010-03-10 15:57:58 +0100
committerJulian Andres Klode <jak@debian.org>2010-03-10 15:57:58 +0100
commitb7a0d64a8037535fdb43785105ffce07b5d6089b (patch)
tree333eaa8eac6289ba3853b86a7773b66c5c34eac6 /python/apt_pkgmodule.cc
parentab48075a8c46d8006337754dea80bf8e8930a4b0 (diff)
downloadpython-apt-b7a0d64a8037535fdb43785105ffce07b5d6089b.tar.gz
python/apt_pkgmodule.cc: Fix apt_pkg.CompType to use CompTypeOld.
Diffstat (limited to 'python/apt_pkgmodule.cc')
-rw-r--r--python/apt_pkgmodule.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc
index 1885a84a..3d40832b 100644
--- a/python/apt_pkgmodule.cc
+++ b/python/apt_pkgmodule.cc
@@ -83,7 +83,14 @@ static PyObject *VersionCompare(PyObject *Self,PyObject *Args)
return Py_BuildValue("i",_system->VS->DoCmpVersion(A,A+LenA,B,B+LenB));
}
-static char *doc_CheckDep = "CheckDep(PkgVer,DepOp,DepVer) -> int";
+static char *doc_CheckDep =
+ "check_dep(pkg_ver: str, dep_op: str, dep_ver: str) -> bool\n\n"
+ "Check that the given requirement is fulfilled; i.e. that the version\n"
+ "string given by 'pkg_ver' matches the version string 'dep_ver' under\n"
+ "the condition specified by the operator 'dep_op' (<,<=,=,>=,>).\n\n"
+ "This functions returns True if 'pkg_ver' matches 'dep_ver' under the\n"
+ "condition 'dep_op'; e.g. this returns True:\n\n"
+ " apt_pkg.check_dep('1', '<=', '2')";
static PyObject *CheckDep(PyObject *Self,PyObject *Args)
{
char *A;
@@ -108,11 +115,11 @@ static PyObject *CheckDep(PyObject *Self,PyObject *Args)
return 0;
}
- return Py_BuildValue("i",_system->VS->CheckDep(A,Op,B));
-// return Py_BuildValue("i",pkgCheckDep(B,A,Op));
+ return PyBool_FromLong(_system->VS->CheckDep(A,Op,B));
}
-static char *doc_CheckDepOld = "CheckDep(PkgVer,DepOp,DepVer) -> int";
+#ifdef COMPAT_0_7
+static char *doc_CheckDepOld = "CheckDep(PkgVer,DepOp,DepVer) -> bool";
static PyObject *CheckDepOld(PyObject *Self,PyObject *Args)
{
char *A;
@@ -134,9 +141,9 @@ static PyObject *CheckDepOld(PyObject *Self,PyObject *Args)
return 0;
}
- return Py_BuildValue("i",_system->VS->CheckDep(A,Op,B));
-// return Py_BuildValue("i",pkgCheckDep(B,A,Op));
+ return PyBool_FromLong(_system->VS->CheckDep(A,Op,B));
}
+#endif
static char *doc_UpstreamVersion = "UpstreamVersion(a) -> string";
static PyObject *UpstreamVersion(PyObject *Self,PyObject *Args)
@@ -521,7 +528,6 @@ static PyMethodDef methods[] =
{"ParseCommandLine",ParseCommandLine,METH_VARARGS,doc_ParseCommandLine},
{"VersionCompare",VersionCompare,METH_VARARGS,doc_VersionCompare},
- {"CheckDep",CheckDep,METH_VARARGS,doc_CheckDep},
{"UpstreamVersion",UpstreamVersion,METH_VARARGS,doc_UpstreamVersion},
{"ParseDepends",ParseDepends_old,METH_VARARGS,doc_ParseDepends},