summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-07-08 17:43:01 +0200
committerJulian Andres Klode <jak@debian.org>2009-07-08 17:43:01 +0200
commit3770906714c5e73b844514c431ce07fd9ac416fb (patch)
treeddad38c732c6b39d3beea704184b7581b7636607 /python
parent2a2d636ca765e737bdbd36ed6b39b2319a466ce9 (diff)
downloadpython-apt-3770906714c5e73b844514c431ce07fd9ac416fb.tar.gz
python/apt_pkgmodule.cc: Unify dep handling -- part 1: parse_depends()
apt_pkg.parse_[src_]depends() now use CompType instead of CompTypeDeb (i.e. < instead of <<) to match the interface of Version.depends_list_str.
Diffstat (limited to 'python')
-rw-r--r--python/apt_pkgmodule.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc
index 9f750996..3f4aae37 100644
--- a/python/apt_pkgmodule.cc
+++ b/python/apt_pkgmodule.cc
@@ -104,9 +104,10 @@ static char *doc_ParseDepends =
"The resulting tuples are (Pkg,Ver,Operation). Each anded dependency is a\n"
"list of or'd dependencies\n"
"Source depends are evaluated against the curernt arch and only those that\n"
-"Match are returned.";
+"Match are returned.\n\n"
+"apt_pkg.Parse{,Src}Depends() are old forms which return >>,<< instead of >,<";
static PyObject *RealParseDepends(PyObject *Self,PyObject *Args,
- bool ParseArchFlags)
+ bool ParseArchFlags, bool debStyle=false)
{
string Package;
string Version;
@@ -143,7 +144,7 @@ static PyObject *RealParseDepends(PyObject *Self,PyObject *Args,
PyObject *Obj;
PyList_Append(LastRow,Obj = Py_BuildValue("sss",Package.c_str(),
Version.c_str(),
- pkgCache::CompTypeDeb(Op)));
+ debStyle ? pkgCache::CompTypeDeb(Op) : pkgCache::CompType(Op)));
Py_DECREF(Obj);
}
@@ -166,6 +167,14 @@ static PyObject *ParseSrcDepends(PyObject *Self,PyObject *Args)
{
return RealParseDepends(Self,Args,true);
}
+static PyObject *ParseDepends_old(PyObject *Self,PyObject *Args)
+{
+ return RealParseDepends(Self,Args,false, true);
+}
+static PyObject *ParseSrcDepends_old(PyObject *Self,PyObject *Args)
+{
+ return RealParseDepends(Self,Args,true, true);
+}
/*}}}*/
// md5sum - Compute the md5sum of a file or string /*{{{*/
// ---------------------------------------------------------------------
@@ -444,8 +453,8 @@ static PyMethodDef methods[] =
{"parse_depends",ParseDepends,METH_VARARGS,doc_ParseDepends},
{"parse_src_depends",ParseSrcDepends,METH_VARARGS,doc_ParseDepends},
#ifdef COMPAT_0_7
- {"ParseDepends",ParseDepends,METH_VARARGS,doc_ParseDepends},
- {"ParseSrcDepends",ParseSrcDepends,METH_VARARGS,doc_ParseDepends},
+ {"ParseDepends",ParseDepends_old,METH_VARARGS,doc_ParseDepends},
+ {"ParseSrcDepends",ParseSrcDepends_old,METH_VARARGS,doc_ParseDepends},
#endif
// Stuff