[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#733489: [PATCH] Added dependency comparison type /relation in Debian notation.



This commit added an additional dependency comparison type / relation in Debian
notation in contrast to the existing one in mathematical notation.
---
 apt/package.py  | 16 +++++++++++++++-
 python/cache.cc | 13 ++++++++++++-
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/apt/package.py b/apt/package.py
index 943c1a8..1bc73c8 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -97,7 +97,7 @@ class BaseDependency(object):
 
     @property
     def relation(self):
-        """The relation (<, <=, !=, =, >=, >, ).
+        """The relation (<, <=, =, !=, >=, >, ) in mathematical notation.
 
         Note that the empty string is a valid string as well, if no version
         is specified.
@@ -105,6 +105,20 @@ class BaseDependency(object):
         return self.__dstr(self._dep.comp_type)
 
     @property
+    def relation_deb(self):
+        """The relation (<<, <=, =, !=, >=, >>, ) in Debian notation.
+
+        See the Debian Policy Manual under Syntax of relationship fields:
+        http://www.debian.org/doc/debian-policy/ch-relationships.html
+
+        Note that the empty string is a valid string as well, if no version
+        is specified.
+
+        .. versionadded:: 0.9.4
+        """
+        return self._dep.comp_type_deb
+
+    @property
     def version(self):
         """The target version or None.
 
diff --git a/python/cache.cc b/python/cache.cc
index c0f1ede..c69391c 100644
--- a/python/cache.cc
+++ b/python/cache.cc
@@ -1431,6 +1431,12 @@ static PyObject *DependencyGetCompType(PyObject *Self,void*)
    return PyString_FromString(Dep.CompType());
 }
 
+static PyObject *DependencyGetCompTypeDeb(PyObject *Self,void*)
+{
+   pkgCache::DepIterator &Dep = GetCpp<pkgCache::DepIterator>(Self);
+   return PyString_FromString(pkgCache::CompTypeDeb(Dep->CompareOp));
+}
+
 static PyObject *DependencyGetDepType(PyObject *Self,void*)
 {
    pkgCache::DepIterator &Dep = GetCpp<pkgCache::DepIterator>(Self);
@@ -1457,8 +1463,13 @@ static PyObject *DependencyGetID(PyObject *Self,void*)
 
 static PyGetSetDef DependencyGetSet[] = {
    {"comp_type",DependencyGetCompType,0,
-    "The type of comparison, as a string, namely one of:\n"
+    "The type of comparison in mathematical notation, as a string, namely one of:\n"
     "'<', '<=', '=', '!=', '>=', '>', ''."},
+   {"comp_type_deb",DependencyGetCompTypeDeb,0,
+    "The type of comparison in Debian notation, as a string, namely one of:\n"
+    "'<<', '<=', '=', '!=', '>=', '>>', ''.\n"
+    "For details see the Debian Policy Manual on relationship fields:\n"
+    "http://www.debian.org/doc/debian-policy/ch-relationships.html"},
    {"dep_type",DependencyGetDepType,0,
     "The type of the dependency; may be translated"},
    {"dep_type_untranslated",DependencyGetDepTypeUntranslated,0,
-- 
1.8.3.2


Reply to: