--- Begin Message ---
Package: apt-xapian-index
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/.
From 9d50cd36f87541222fd21ee27b49a16ea6d3a9c0 Mon Sep 17 00:00:00 2001
From: Julian Andres Klode <[email protected]>
Date: Mon, 1 Mar 2010 12:15:45 +0100
Subject: [PATCH 1/2] Upgrade to the new python-apt API.
---
examples/aptxapianindex.py | 3 ++-
examples/axi-query-pkgtype.py | 3 ++-
examples/axi-query-simple.py | 5 +++--
examples/axi-query.py | 3 ++-
examples/axi-searchasyoutype.py | 5 +++--
examples/axi-searchcloud.py | 8 +++++++-
plugins/apttags.py | 2 +-
plugins/descriptions.py | 2 +-
plugins/sections.py | 2 +-
plugins/sizes.py | 2 +-
10 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/examples/aptxapianindex.py b/examples/aptxapianindex.py
index 75ddfbf..a425b62 100644
--- a/examples/aptxapianindex.py
+++ b/examples/aptxapianindex.py
@@ -97,7 +97,8 @@ def show_mset(mset):
pkg = cache[name]
# Print the match, together with the short description
- print "%i%% %s - %s" % (m[xapian.MSET_PERCENT], name, pkg.summary)
+ if pkg.candidate:
+ print "%i%% %s - %s" % (m[xapian.MSET_PERCENT], name, pkg.candidate.summary)
def readValueDB(pathname):
"""
diff --git a/examples/axi-query-pkgtype.py b/examples/axi-query-pkgtype.py
index b434607..0d0c34c 100755
--- a/examples/axi-query-pkgtype.py
+++ b/examples/axi-query-pkgtype.py
@@ -101,7 +101,8 @@ for m in matches:
# description
pkg = cache[name]
+ if pkg.candidate:
# Print the match, together with the short description
- print "%i%% %s - %s" % (m[xapian.MSET_PERCENT], name, pkg.summary)
+ print "%i%% %s - %s" % (m[xapian.MSET_PERCENT], name, pkg.candidate.summary)
sys.exit(0)
diff --git a/examples/axi-query-simple.py b/examples/axi-query-simple.py
index ce0f88f..5eb33d5 100755
--- a/examples/axi-query-simple.py
+++ b/examples/axi-query-simple.py
@@ -117,7 +117,8 @@ for m in matches:
# description
pkg = cache[name]
- # Print the match, together with the short description
- print "%i%% %s - %s" % (m[xapian.MSET_PERCENT], name, pkg.summary)
+ if pkg.candidate:
+ # Print the match, together with the short description
+ print "%i%% %s - %s" % (m[xapian.MSET_PERCENT], name, pkg.candidate.summary)
sys.exit(0)
diff --git a/examples/axi-query.py b/examples/axi-query.py
index fb4e8bd..5b4cc08 100755
--- a/examples/axi-query.py
+++ b/examples/axi-query.py
@@ -101,6 +101,7 @@ print "Results 1-%i:" % matches.size()
for m in matches:
name = m[xapian.MSET_DOCUMENT].get_data()
pkg = cache[name]
- print "%i%% %s - %s" % (m[xapian.MSET_PERCENT], name, pkg.summary)
+ if pkg.candidate:
+ print "%i%% %s - %s" % (m[xapian.MSET_PERCENT], name, pkg.candidate.summary)
sys.exit(0)
diff --git a/examples/axi-searchasyoutype.py b/examples/axi-searchasyoutype.py
index 39b61bb..3b6b1bc 100755
--- a/examples/axi-searchasyoutype.py
+++ b/examples/axi-searchasyoutype.py
@@ -152,8 +152,9 @@ class Results:
# description
pkg = cache[name]
- # Print the match, together with the short description
- self.win.addstr(y+1, 0, "%i%% %s - %s" % (m[xapian.MSET_PERCENT], name, pkg.summary))
+ if pkg.candidate:
+ # Print the match, together with the short description
+ self.win.addstr(y+1, 0, "%i%% %s - %s" % (m[xapian.MSET_PERCENT], name, pkg.candidate.summary))
self.win.refresh()
diff --git a/examples/axi-searchcloud.py b/examples/axi-searchcloud.py
index 863de2c..42e0fce 100755
--- a/examples/axi-searchcloud.py
+++ b/examples/axi-searchcloud.py
@@ -132,7 +132,13 @@ def SimpleOrQuery(input_terms):
pkg = cache[name]
except KeyError:
continue
- shortdesc = pkg.summary
+
+ # pkg.candidate may be none
+ try:
+ shortdesc = pkg.candidate.summary
+ except AttributeError:
+ continue
+
packages.append((score, name, shortdesc))
class Filter(xapian.ExpandDecider):
diff --git a/plugins/apttags.py b/plugins/apttags.py
index d12e733..b8b221d 100644
--- a/plugins/apttags.py
+++ b/plugins/apttags.py
@@ -25,7 +25,7 @@ class AptTags:
"""
self.re_expand = re.compile(r"\b([^{]+)\{([^}]+)\}")
self.re_split = re.compile(r"\s*,\s*")
- file = apt.apt_pkg.Config.find_file("Dir::Cache::pkgcache")
+ file = apt.apt_pkg.config.find_file("Dir::Cache::pkgcache")
return dict(timestamp = os.path.getmtime(file))
def init(self, info, progress):
diff --git a/plugins/descriptions.py b/plugins/descriptions.py
index 57d9155..6126e64 100644
--- a/plugins/descriptions.py
+++ b/plugins/descriptions.py
@@ -22,7 +22,7 @@ class Descriptions:
the timestamp shows that this plugin is currently not needed, then the
long initialisation can just be skipped.
"""
- file = apt.apt_pkg.Config.find_file("Dir::Cache::pkgcache")
+ file = apt.apt_pkg.config.find_file("Dir::Cache::pkgcache")
return dict(timestamp = os.path.getmtime(file))
def init(self, info, progress):
diff --git a/plugins/sections.py b/plugins/sections.py
index 78cd02a..197efb9 100644
--- a/plugins/sections.py
+++ b/plugins/sections.py
@@ -21,7 +21,7 @@ class Sections:
the timestamp shows that this plugin is currently not needed, then the
long initialisation can just be skipped.
"""
- file = apt.apt_pkg.Config.find_file("Dir::Cache::pkgcache")
+ file = apt.apt_pkg.config.find_file("Dir::Cache::pkgcache")
return dict(timestamp = os.path.getmtime(file))
def init(self, info, progress):
diff --git a/plugins/sizes.py b/plugins/sizes.py
index d0c79bb..26da747 100644
--- a/plugins/sizes.py
+++ b/plugins/sizes.py
@@ -21,7 +21,7 @@ class Sizes:
the timestamp shows that this plugin is currently not needed, then the
long initialisation can just be skipped.
"""
- file = apt.apt_pkg.Config.find_file("Dir::Cache::pkgcache")
+ file = apt.apt_pkg.config.find_file("Dir::Cache::pkgcache")
return dict(
timestamp = os.path.getmtime(file),
values = [
--
1.7.0
From cf4739d617d2b0a4311aae25f3e24f51ea5e1dbe Mon Sep 17 00:00:00 2001
From: Julian Andres Klode <[email protected]>
Date: Mon, 1 Mar 2010 12:19:41 +0100
Subject: [PATCH 2/2] plugins: Import apt_pkg directly instead of using apt.apt_pkg.
---
plugins/apttags.py | 4 ++--
plugins/descriptions.py | 3 ++-
plugins/sections.py | 3 ++-
plugins/sizes.py | 3 ++-
4 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/plugins/apttags.py b/plugins/apttags.py
index b8b221d..ecf4501 100644
--- a/plugins/apttags.py
+++ b/plugins/apttags.py
@@ -1,6 +1,6 @@
# Add debtags tags to the index
-import re, os, os.path, apt
+import re, os, os.path, apt, apt_pkg
DEBTAGSDB = "/var/lib/debtags/package-tags"
@@ -25,7 +25,7 @@ class AptTags:
"""
self.re_expand = re.compile(r"\b([^{]+)\{([^}]+)\}")
self.re_split = re.compile(r"\s*,\s*")
- file = apt.apt_pkg.config.find_file("Dir::Cache::pkgcache")
+ file = apt_pkg.config.find_file("Dir::Cache::pkgcache")
return dict(timestamp = os.path.getmtime(file))
def init(self, info, progress):
diff --git a/plugins/descriptions.py b/plugins/descriptions.py
index 6126e64..fb892a7 100644
--- a/plugins/descriptions.py
+++ b/plugins/descriptions.py
@@ -1,4 +1,5 @@
import apt
+import apt_pkg
import xapian
import re
import os, os.path
@@ -22,7 +23,7 @@ class Descriptions:
the timestamp shows that this plugin is currently not needed, then the
long initialisation can just be skipped.
"""
- file = apt.apt_pkg.config.find_file("Dir::Cache::pkgcache")
+ file = apt_pkg.config.find_file("Dir::Cache::pkgcache")
return dict(timestamp = os.path.getmtime(file))
def init(self, info, progress):
diff --git a/plugins/sections.py b/plugins/sections.py
index 197efb9..36801b3 100644
--- a/plugins/sections.py
+++ b/plugins/sections.py
@@ -1,4 +1,5 @@
import apt
+import apt_pkg
import xapian
import os, os.path
@@ -21,7 +22,7 @@ class Sections:
the timestamp shows that this plugin is currently not needed, then the
long initialisation can just be skipped.
"""
- file = apt.apt_pkg.config.find_file("Dir::Cache::pkgcache")
+ file = apt_pkg.config.find_file("Dir::Cache::pkgcache")
return dict(timestamp = os.path.getmtime(file))
def init(self, info, progress):
diff --git a/plugins/sizes.py b/plugins/sizes.py
index 26da747..5d13aec 100644
--- a/plugins/sizes.py
+++ b/plugins/sizes.py
@@ -1,4 +1,5 @@
import apt
+import apt_pkg
import xapian
import os, os.path
@@ -21,7 +22,7 @@ class Sizes:
the timestamp shows that this plugin is currently not needed, then the
long initialisation can just be skipped.
"""
- file = apt.apt_pkg.config.find_file("Dir::Cache::pkgcache")
+ file = apt_pkg.config.find_file("Dir::Cache::pkgcache")
return dict(
timestamp = os.path.getmtime(file),
values = [
--
1.7.0
pgpSM4zC9B1An.pgp
Description: PGP signature
--- End Message ---