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

Bug#733489: [PATCH] apt/package.py: Replaced pre_depend with rawtype in BaseDependency.__repr__ as rawtype gives more information including the information from pre_depend.




On 06/28/2015 10:39 PM, Julian Andres Klode wrote:
> On Sun, Jun 28, 2015 at 01:49:17PM +0200, Michael Schaller wrote:
>
> I reworded it a bit:
> - Dropped the filename to make the subject shorter
> - Dropped the '.' at the end of the subject
> - Changed from past to present tense
> - Made one sentence out of the paragraph
>
> and applied it to the debian/sid branch.
>

Thanks. The following patches hopefully go smoother...

The next patch is what previously patch 3/5 was. Please let me know what you think of the added constructor argument. If you think that this change could break third-party code then the rawtype could also be inferred by going through the list of BaseDependency objects, getting their rawtype and ensuring that they all have the same rawtype.

>From 79c618073cb21f94544299501a147331dab39332 Mon Sep 17 00:00:00 2001
From: Michael Schaller <michael@5challer.de>
Date: Mon, 29 Jun 2015 14:51:03 +0200
Subject: [PATCH 1/1] apt/package.py: Add rawtype property to Dependency class

---
 apt/package.py    | 22 ++++++++++++++++++----
 po/python-apt.pot | 32 ++++++++++++++------------------
 2 files changed, 32 insertions(+), 22 deletions(-)

diff --git a/apt/package.py b/apt/package.py
index 391ee4f..57c89b3 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -139,16 +139,30 @@ class Dependency(list):
 
     Attributes defined here:
         or_dependencies - The possible choices
+        rawtype - The type of the dependencies in the Or-group
     """
 
-    def __init__(self, alternatives):
-        super(Dependency, self).__init__()
-        self.extend(alternatives)
+    def __init__(self, base_deps, rawtype):
+        super(Dependency, self).__init__(base_deps)
+        self._rawtype = rawtype
 
     @property
     def or_dependencies(self):
         return self
 
+    @property
+    def rawtype(self):
+        """Type of the Or-group of dependency.
+
+        This should be one of 'Breaks', 'Conflicts', 'Depends', 'Enhances',
+        'PreDepends', 'Recommends', 'Replaces', 'Suggests'.
+
+        Additional types might be added in the future.
+
+        .. versionadded:: 1.0.0
+        """
+        return self._rawtype
+
 
 class Origin(object):
     """The origin of a version.
@@ -468,7 +482,7 @@ class Version(object):
                     base_deps = []
                     for dep_or in dep_ver_list:
                         base_deps.append(BaseDependency(dep_or))
-                    depends_list.append(Dependency(base_deps))
+                    depends_list.append(Dependency(base_deps, type_))
             except KeyError:
                 pass
         return depends_list
diff --git a/po/python-apt.pot b/po/python-apt.pot
index dab5717..6138211 100644
--- a/po/python-apt.pot
+++ b/po/python-apt.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-06-10 15:57+0200\n"
+"POT-Creation-Date: 2015-06-29 14:44+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -512,16 +512,16 @@ msgstr ""
 msgid "Custom servers"
 msgstr ""
 
-#: ../apt/package.py:380
+#: ../apt/package.py:396
 #, python-format
 msgid "Invalid unicode in description for '%s' (%s). Please report."
 msgstr ""
 
-#: ../apt/package.py:951 ../apt/package.py:1057
+#: ../apt/package.py:974 ../apt/package.py:1080 ../apt/package.py:1094
 msgid "The list of changes is not available"
 msgstr ""
 
-#: ../apt/package.py:1063
+#: ../apt/package.py:1087
 #, python-format
 msgid ""
 "The list of changes is not available yet.\n"
@@ -530,7 +530,7 @@ msgid ""
 "until the changes become available or try again later."
 msgstr ""
 
-#: ../apt/package.py:1070
+#: ../apt/package.py:1097
 msgid ""
 "Failed to download the list of changes. \n"
 "Please check your Internet connection."
@@ -577,44 +577,44 @@ msgid ""
 "the '%(debfile)s' provides it via: '%(provides)s'"
 msgstr ""
 
-#: ../apt/debfile.py:488
+#: ../apt/debfile.py:493
 msgid "No Architecture field in the package"
 msgstr ""
 
-#: ../apt/debfile.py:498
+#: ../apt/debfile.py:503
 #, python-format
 msgid "Wrong architecture '%s'"
 msgstr ""
 
-#: ../apt/debfile.py:506
+#: ../apt/debfile.py:512
 msgid "A later version is already installed"
 msgstr ""
 
-#: ../apt/debfile.py:531
+#: ../apt/debfile.py:537
 msgid "Failed to satisfy all dependencies (broken cache)"
 msgstr ""
 
-#: ../apt/debfile.py:560
+#: ../apt/debfile.py:566
 #, python-format
 msgid "Cannot install '%s'"
 msgstr ""
 
-#: ../apt/debfile.py:636
+#: ../apt/debfile.py:642
 msgid ""
 "Automatically decompressed:\n"
 "\n"
 msgstr ""
 
-#: ../apt/debfile.py:642
+#: ../apt/debfile.py:648
 msgid "Automatically converted to printable ascii:\n"
 msgstr ""
 
-#: ../apt/debfile.py:746
+#: ../apt/debfile.py:753
 #, python-format
 msgid "Install Build-Dependencies for source package '%s' that builds %s\n"
 msgstr ""
 
-#: ../apt/debfile.py:757
+#: ../apt/debfile.py:764
 msgid "An essential package would be removed"
 msgstr ""
 
@@ -664,7 +664,3 @@ msgstr ""
 #: ../apt/progress/text.py:263
 msgid "Please insert a Disc in the drive and press enter"
 msgstr ""
-
-#: ../apt/cache.py:163
-msgid "Building data structures"
-msgstr ""
-- 
2.1.4


Reply to: