On Sat, Feb 27, 2010 at 07:35:37PM +0100, Julian Andres Klode wrote:
> Package: gnome-codec-install
> Tags: patch
> User: [email protected]
> Usertags: python-apt-0-8-api
> 
> As part of the python-apt API transition mass bug filing[1],
> I would like to ask you to update your package for the new
> API using the attached patch.
> 
> The first python-apt upload after the Squeeze release will
> drop the old API and will get a 'Breaks' for all packages
> which have not been adjusted yet. All not-fixed bugs will 
> become release critical then.
> 
> [1] http://lists.debian.org/debian-devel/2010/02/msg00424.html
> 
> -- 
> Julian Andres Klode  - Debian Developer, Ubuntu Member
> 
> See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.

Patch updated, the last one had a few problems.
-- 
Julian Andres Klode  - Debian Developer, Ubuntu Member

See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.
From 3b9cf1cbe0420ceca9e9ed37658bb2b2b77d6537 Mon Sep 17 00:00:00 2001
From: Julian Andres Klode <[email protected]>
Date: Sat, 27 Feb 2010 19:40:00 +0100
Subject: [PATCH] Upgrade to the new python-apt API.

---
 GnomeCodecInstall/MainWindow.py    |   32 ++++++++++++++++++--------------
 GnomeCodecInstall/PackageWorker.py |    4 ++--
 2 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/GnomeCodecInstall/MainWindow.py b/GnomeCodecInstall/MainWindow.py
index 4c78d93..56d8309 100644
--- a/GnomeCodecInstall/MainWindow.py
+++ b/GnomeCodecInstall/MainWindow.py
@@ -52,17 +52,19 @@ class CodecDetailsView(gtk.TextView):
       self.buffer.insert_with_tags_by_name(iter,
                                            _("No package selected"),
                                            "summary")
-      return 
+      return
+
+    assert pkg.candidate
     # now format the description
     self.buffer.insert_with_tags_by_name(iter, 
-                                         pkg.summary,
+                                         pkg.candidate.summary,
                                          "summary")
     self.buffer.insert(iter, "\n\n")
-    if pkg.homepage:
+    if pkg.candidate.homepage:
       self.buffer.insert_with_tags_by_name(iter, 
                                            _("Homepage:")+"\n", 
                                            "homepage")
-      self.buffer.insert(iter, pkg.homepage + "\n\n")
+      self.buffer.insert(iter, pkg.candidate.homepage + "\n\n")
     self.buffer.insert_with_tags_by_name(iter, 
                                          _("Provides:")+"\n", 
                                          "provides")
@@ -72,7 +74,7 @@ class CodecDetailsView(gtk.TextView):
     self.buffer.insert_with_tags_by_name(iter, 
                                          _("Long Description:")+"\n", 
                                          "description")
-    self.buffer.insert(iter, pkg.description + "\n")
+    self.buffer.insert(iter, pkg.candidate.description + "\n")
 
 def set_transient_for_xid(widget, xid):
   try:
@@ -261,15 +263,17 @@ class MainWindow(object):
         progressbar.set_fraction(float(cur_package) / package_count)
 
       self.update_ui()
-      if pkg.isInstalled and not pkg.isUpgradable:
+      if pkg.is_installed and not pkg.is_upgradable:
         continue
 
-      record = pkg.candidateRecord
-      if not record:
+      try:
+        record = pkg.candidate.record
+      except AttributeError:
         continue
-      if not record.has_key("Gstreamer-Version"):
+      try:
+        major, minor = record["Gstreamer-Version"].split(".")
+      except KeyError:
         continue
-      major, minor = pkg.candidateRecord["Gstreamer-Version"].split(".")
 
       if (int(major) != self._requests[0].major or 
           int(minor) != self._requests[0].minor):
@@ -284,7 +288,7 @@ class MainWindow(object):
 
         for (request_str, pkgrecord_str, check_caps, do_split) in requests_map:
           if request.gstkind == request_str:
-            if not record.has_key(pkgrecord_str):
+            if not pkgrecord_str in record:
               continue
             if check_caps:
               caps = gst.Caps(record[pkgrecord_str])
@@ -391,9 +395,9 @@ class MainWindow(object):
 
         Returns True if there is a file missing
     """
-    for metaindex in self.cache._list.List:
-      for m in metaindex.IndexFiles:
-        if m.Label == "Debian Package Index" and not m.Exists:
+    for metaindex in self.cache._list.list:
+      for m in metaindex.index_files:
+        if m.label == "Debian Package Index" and not m.exists:
           print "Missing package list: ", m
           return True
     return False
diff --git a/GnomeCodecInstall/PackageWorker.py b/GnomeCodecInstall/PackageWorker.py
index 01a0a40..da2b6b1 100644
--- a/GnomeCodecInstall/PackageWorker.py
+++ b/GnomeCodecInstall/PackageWorker.py
@@ -98,11 +98,11 @@ class PackageWorker(object):
         result = True
         cache = apt.Cache(GtkOpProgress())
         for pkgname in to_add:
-            if not cache[pkgname].isInstalled:
+            if not cache[pkgname].is_installed:
                 result = False
                 break
         for pkgname in to_rm:
-            if cache[pkgname].isInstalled:
+            if cache[pkgname].is_installed:
                 result = False
                 break
         window_main.set_sensitive(True)
-- 
1.7.0

Attachment: signature.asc
Description: Digital signature

Reply via email to