summaryrefslogtreecommitdiff
path: root/python/cache.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2010-01-15 15:20:23 +0100
committerJulian Andres Klode <jak@debian.org>2010-01-15 15:20:23 +0100
commit52cca77b8179a7f625673f19cb132686c0d416c9 (patch)
tree2b554f1669754dc68ec112b16d6081fd60dfb5e3 /python/cache.cc
parent2ccb7545bb8c869f5f6192569a47a7522b6fbc83 (diff)
parent71aad7e28bbaf1ee8efdad77ebfb4e4c0fd0ec26 (diff)
downloadpython-apt-52cca77b8179a7f625673f19cb132686c0d416c9.tar.gz
Merge 0.7.13.5 pre.
Diffstat (limited to 'python/cache.cc')
-rw-r--r--python/cache.cc37
1 files changed, 26 insertions, 11 deletions
diff --git a/python/cache.cc b/python/cache.cc
index 084f6d8c..6bbf0766 100644
--- a/python/cache.cc
+++ b/python/cache.cc
@@ -27,6 +27,17 @@
class pkgSourceList;
+// must be in sync with pkgCache::DepType in libapt
+// it sucks to have it here duplicated, but we get it
+// translated from libapt and that is certainly not what
+// we want in a programing interface
+const char *UntranslatedDepTypes[] =
+{
+ "", "Depends","PreDepends","Suggests",
+ "Recommends","Conflicts","Replaces",
+ "Obsoletes", "Breaks", "Enhances"
+};
+
/*}}}*/
struct PkgListStruct
{
@@ -683,17 +694,7 @@ static PyObject *MakeDepends(PyObject *Owner,pkgCache::VerIterator &Ver,
// Switch/create a new dict entry
if (LastDepType != Start->Type || LastDep != 0)
{
- // must be in sync with pkgCache::DepType in libapt
- // it sucks to have it here duplicated, but we get it
- // translated from libapt and that is certainly not what
- // we want in a programing interface
- const char *Types[] =
- {
- "", "Depends","PreDepends","Suggests",
- "Recommends","Conflicts","Replaces",
- "Obsoletes", "Breaks", "Enhances"
- };
- PyObject *Dep = PyString_FromString(Types[Start->Type]);
+ PyObject *Dep = PyString_FromString(UntranslatedDepTypes[Start->Type]);
LastDepType = Start->Type;
LastDep = PyDict_GetItem(Dict,Dep);
if (LastDep == 0)
@@ -1194,6 +1195,18 @@ static PyObject *DependencyGetDepType(PyObject *Self,void*)
return PyString_FromString(Dep.DepType());
}
+static PyObject *DependencyGetDepTypeUntranslated(PyObject *Self,void*)
+{
+ pkgCache::DepIterator &Dep = GetCpp<pkgCache::DepIterator>(Self);
+ return PyString_FromString(UntranslatedDepTypes[Dep->Type]);
+}
+
+static PyObject *DependencyGetDepTypeEnum(PyObject *Self,void*)
+{
+ pkgCache::DepIterator &Dep = GetCpp<pkgCache::DepIterator>(Self);
+ return Py_BuildValue("i", Dep->Type);
+}
+
static PyObject *DependencyGetID(PyObject *Self,void*)
{
pkgCache::DepIterator &Dep = GetCpp<pkgCache::DepIterator>(Self);
@@ -1203,6 +1216,8 @@ static PyObject *DependencyGetID(PyObject *Self,void*)
static PyGetSetDef DependencyGetSet[] = {
{"comp_type",DependencyGetCompType},
{"dep_type",DependencyGetDepType},
+ {"dep_type_untranslated",DependencyGetDepTypeUntranslated},
+ {"dep_type_enum",DependencyGetDepTypeEnum},
{"id",DependencyGetID},
{"parent_pkg",DependencyGetParentPkg},
{"parent_ver",DependencyGetParentVer},