summaryrefslogtreecommitdiff
path: root/python/apt_pkgmodule.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2010-03-10 15:01:18 +0100
committerJulian Andres Klode <jak@debian.org>2010-03-10 15:01:18 +0100
commitab48075a8c46d8006337754dea80bf8e8930a4b0 (patch)
tree47adb4942fd730dd10a008f2b264f0aaa92d6d7a /python/apt_pkgmodule.cc
parent5dcb4f67ca94d79f05cbd0940bbb5a7796a05bca (diff)
downloadpython-apt-ab48075a8c46d8006337754dea80bf8e8930a4b0.tar.gz
* python/apt_pkgmodule.cc:
- Treat '>>' and '>', '<<' and '<' as identical in check_dep (LP: #535667). * tests: - test_deps: Add tests for apt_pkg.CheckDep, apt_pkg.check_dep, apt_pkg.parse_depends and apt_pkg.parse_src_depends.
Diffstat (limited to 'python/apt_pkgmodule.cc')
-rw-r--r--python/apt_pkgmodule.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc
index e3da1820..1885a84a 100644
--- a/python/apt_pkgmodule.cc
+++ b/python/apt_pkgmodule.cc
@@ -93,6 +93,35 @@ static PyObject *CheckDep(PyObject *Self,PyObject *Args)
if (PyArg_ParseTuple(Args,"sss",&A,&OpStr,&B) == 0)
return 0;
+
+ if (strcmp(OpStr, ">") == 0) OpStr = ">>";
+ if (strcmp(OpStr, "<") == 0) OpStr = "<<";
+ if (*debListParser::ConvertRelation(OpStr,Op) != 0)
+ {
+ PyErr_SetString(PyExc_ValueError,"Bad comparision operation");
+ return 0;
+ }
+
+ if (_system == 0)
+ {
+ PyErr_SetString(PyExc_ValueError,"_system not initialized");
+ return 0;
+ }
+
+ return Py_BuildValue("i",_system->VS->CheckDep(A,Op,B));
+// return Py_BuildValue("i",pkgCheckDep(B,A,Op));
+}
+
+static char *doc_CheckDepOld = "CheckDep(PkgVer,DepOp,DepVer) -> int";
+static PyObject *CheckDepOld(PyObject *Self,PyObject *Args)
+{
+ char *A;
+ char *B;
+ char *OpStr;
+ unsigned int Op = 0;
+
+ if (PyArg_ParseTuple(Args,"sss",&A,&OpStr,&B) == 0)
+ return 0;
if (*debListParser::ConvertRelation(OpStr,Op) != 0)
{
PyErr_SetString(PyExc_ValueError,"Bad comparision operation");
@@ -473,6 +502,7 @@ static PyMethodDef methods[] =
// DEPRECATED
#ifdef COMPAT_0_7
+ {"CheckDep",CheckDepOld,METH_VARARGS,doc_CheckDepOld},
{"newConfiguration",newConfiguration,METH_VARARGS,doc_newConfiguration},
{"InitConfig",InitConfig,METH_VARARGS,doc_InitConfig},
{"InitSystem",InitSystem,METH_VARARGS,doc_InitSystem},