Description: Switch to Python 3.
Author: Barry Warsaw <barry@debian.org>
Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=804099

Index: apt-xapian-index-0.47ubuntu10/axi-cache
===================================================================
--- apt-xapian-index-0.47ubuntu10.orig/axi-cache
+++ apt-xapian-index-0.47ubuntu10/axi-cache
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 # coding: utf-8
 
 #
Index: apt-xapian-index-0.47ubuntu10/examples/axi-query-adaptivecutoff.py
===================================================================
--- apt-xapian-index-0.47ubuntu10.orig/examples/axi-query-adaptivecutoff.py
+++ apt-xapian-index-0.47ubuntu10/examples/axi-query-adaptivecutoff.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 # axi-query-adaptivecutoff - Use an adaptive cutoff to select results
 #
Index: apt-xapian-index-0.47ubuntu10/examples/axi-query-expand.py
===================================================================
--- apt-xapian-index-0.47ubuntu10.orig/examples/axi-query-expand.py
+++ apt-xapian-index-0.47ubuntu10/examples/axi-query-expand.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 # axi-query-expand - Query and show possible expansions
 #
Index: apt-xapian-index-0.47ubuntu10/examples/axi-query-pkgtype.py
===================================================================
--- apt-xapian-index-0.47ubuntu10.orig/examples/axi-query-pkgtype.py
+++ apt-xapian-index-0.47ubuntu10/examples/axi-query-pkgtype.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 # axi-query-pkgtype - Like axi-query-simple.py, but with a simple
 #                     result filter
Index: apt-xapian-index-0.47ubuntu10/examples/axi-query-similar.py
===================================================================
--- apt-xapian-index-0.47ubuntu10.orig/examples/axi-query-similar.py
+++ apt-xapian-index-0.47ubuntu10/examples/axi-query-similar.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 # axi-query-similar - Show packages similar to a given one
 #
Index: apt-xapian-index-0.47ubuntu10/examples/axi-query-simple.py
===================================================================
--- apt-xapian-index-0.47ubuntu10.orig/examples/axi-query-simple.py
+++ apt-xapian-index-0.47ubuntu10/examples/axi-query-simple.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 # axi-query-simple - apt-cache search replacement using apt-xapian-index
 #
Index: apt-xapian-index-0.47ubuntu10/examples/axi-query-tags.py
===================================================================
--- apt-xapian-index-0.47ubuntu10.orig/examples/axi-query-tags.py
+++ apt-xapian-index-0.47ubuntu10/examples/axi-query-tags.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 # axi-query-tags - Look for Debtags tags by keyword
 #
Index: apt-xapian-index-0.47ubuntu10/examples/axi-query.py
===================================================================
--- apt-xapian-index-0.47ubuntu10.orig/examples/axi-query.py
+++ apt-xapian-index-0.47ubuntu10/examples/axi-query.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 #
 # axi-query - Example program to query the apt-xapian-index
Index: apt-xapian-index-0.47ubuntu10/examples/axi-searchasyoutype.py
===================================================================
--- apt-xapian-index-0.47ubuntu10.orig/examples/axi-searchasyoutype.py
+++ apt-xapian-index-0.47ubuntu10/examples/axi-searchasyoutype.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 # axi-searchasyoutype - Search-as-you-type demo
 #
Index: apt-xapian-index-0.47ubuntu10/examples/axi-searchcloud.py
===================================================================
--- apt-xapian-index-0.47ubuntu10.orig/examples/axi-searchcloud.py
+++ apt-xapian-index-0.47ubuntu10/examples/axi-searchcloud.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 # axi-searchasyoutype - Search-as-you-type demo
 #
Index: apt-xapian-index-0.47ubuntu10/runtests
===================================================================
--- apt-xapian-index-0.47ubuntu10.orig/runtests
+++ apt-xapian-index-0.47ubuntu10/runtests
@@ -15,6 +15,6 @@ case "$1" in
 		rm -rf test/test-coverage test/.coverage testdb
 		;;
 	*)
-		python -m nose -w test "$@"
+		python3 -m nose -w test "$@"
 		;;
 esac
Index: apt-xapian-index-0.47ubuntu10/tests/dbus-update-apt-xapian-index.py
===================================================================
--- apt-xapian-index-0.47ubuntu10.orig/tests/dbus-update-apt-xapian-index.py
+++ apt-xapian-index-0.47ubuntu10/tests/dbus-update-apt-xapian-index.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 from __future__ import print_function
 
Index: apt-xapian-index-0.47ubuntu10/update-apt-xapian-index
===================================================================
--- apt-xapian-index-0.47ubuntu10.orig/update-apt-xapian-index
+++ apt-xapian-index-0.47ubuntu10/update-apt-xapian-index
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 # -*- coding: utf-8 -*-
 
 #
@@ -110,4 +110,6 @@ if opts.update:
 else:
     indexer.rebuild(opts.pkgfile)
 
+# Free the resources explicitly.  See LP: #1530518
+del indexer
 sys.exit(0)
Index: apt-xapian-index-0.47ubuntu10/update-apt-xapian-index-dbus
===================================================================
--- apt-xapian-index-0.47ubuntu10.orig/update-apt-xapian-index-dbus
+++ apt-xapian-index-0.47ubuntu10/update-apt-xapian-index-dbus
@@ -2,7 +2,6 @@
 
 import logging
 import os
-import string
 import subprocess
 
 try:
@@ -56,7 +55,8 @@ class AptXapianIndexDBusService(dbus.ser
         logging.debug("Emitting UpdateProgress: %s" % percent)
 
     def _update_apt_xapian_index(self, cmd):
-        p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+        p = subprocess.Popen(cmd, stdout=subprocess.PIPE,
+                             universal_newlines=True)
         self._active_axi = p
         while True:
             while gobject.main_context_default().pending():
@@ -68,7 +68,7 @@ class AptXapianIndexDBusService(dbus.ser
             if not line:
                 continue
             try:
-                (op, progress) = string.split(line, sep=":", maxsplit=1)
+                (op, progress) = line.split(sep=":", maxsplit=1)
                 if op == "progress":
                     percent = int(progress.split("/")[0])
                     self.UpdateProgress(percent)
