From 8b8a55f10ca47fe297fbb9b16a8e100658c60df3 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 6 Jan 2014 13:24:51 +0100 Subject: Use print_function everywhere This brings the code closer to Python 3. Automatically converted using 2to3 -f print. --- apt/progress/__init__.py | 2 ++ apt/progress/base.py | 4 +++- apt/progress/gtk2.py | 4 +++- apt/progress/text.py | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) (limited to 'apt/progress') diff --git a/apt/progress/__init__.py b/apt/progress/__init__.py index 776a7034..c689de5c 100644 --- a/apt/progress/__init__.py +++ b/apt/progress/__init__.py @@ -23,5 +23,7 @@ This package provides progress reporting for the python-apt package. The module GTK+ applications, and the module 'text' provides classes for terminals, etc. """ +from __future__ import print_function + __all__ = [] diff --git a/apt/progress/base.py b/apt/progress/base.py index 2c80ae29..66d56173 100644 --- a/apt/progress/base.py +++ b/apt/progress/base.py @@ -22,6 +22,8 @@ Custom progress classes should inherit from these classes. They can also be used as dummy progress classes which simply do nothing. """ +from __future__ import print_function + import errno import fcntl import os @@ -217,7 +219,7 @@ class InstallProgress(object): except IOError as err: # resource temporarly unavailable is ignored if err.errno != errno.EAGAIN and err.errno != errno.EWOULDBLOCK: - print err.strerror + print(err.strerror) return pkgname = status = status_str = percent = base = "" diff --git a/apt/progress/gtk2.py b/apt/progress/gtk2.py index b978c34f..7d142399 100644 --- a/apt/progress/gtk2.py +++ b/apt/progress/gtk2.py @@ -22,6 +22,8 @@ # USA """GObject-powered progress classes and a GTK+ status widget.""" +from __future__ import print_function + import pygtk pygtk.require('2.0') import gtk @@ -422,7 +424,7 @@ def _test(): try: cache.commit(apt_progress.acquire, apt_progress.install) except Exception as exc: - print >> sys.stderr, "Exception happened:", exc + print("Exception happened:", exc, file=sys.stderr) if len(sys.argv) > 1: deb = DebPackage(sys.argv[1], cache) deb.install(apt_progress.dpkg_install) diff --git a/apt/progress/text.py b/apt/progress/text.py index 76a4309e..880a112c 100644 --- a/apt/progress/text.py +++ b/apt/progress/text.py @@ -15,6 +15,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA """Progress reporting for text interfaces.""" +from __future__ import print_function + import os import sys -- cgit v1.2.3