python: futurize -f libfuturize.fixes.fix_print_with_import

Change all Python code to use print as a function.

This is necessary for Python 3 compatibility.

Done using:

  $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \
    sort -u | grep -v README.sh4)
  $ futurize -w -f libfuturize.fixes.fix_print_with_import $py

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20180608122952.2009-2-ehabkost@redhat.com>
[ehabkost: fixup tests/docker/docker.py]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
Eduardo Habkost 2018-06-08 09:29:43 -03:00
parent 0d2fa03dae
commit f03868bd56
32 changed files with 281 additions and 256 deletions

View file

@ -43,6 +43,7 @@
# This work is licensed under the terms of the GNU GPL, version 2 or later.
# See the COPYING file in the top-level directory.
from __future__ import print_function
import sys
import socket
import struct
@ -110,7 +111,7 @@ class FaultInjectionSocket(object):
for rule in self.rules:
if rule.match(event, io):
if rule.when == 0 or bufsize is None:
print 'Closing connection on rule match %s' % rule.name
print('Closing connection on rule match %s' % rule.name)
sys.exit(0)
if rule.when != -1:
return rule.when
@ -182,7 +183,7 @@ def handle_connection(conn, use_export):
elif req.type == NBD_CMD_DISC:
break
else:
print 'unrecognized command type %#02x' % req.type
print('unrecognized command type %#02x' % req.type)
break
conn.close()
@ -242,7 +243,7 @@ def open_socket(path):
sock = socket.socket(socket.AF_UNIX)
sock.bind(path)
sock.listen(0)
print 'Listening on %s' % path
print('Listening on %s' % path)
sys.stdout.flush() # another process may be waiting, show message now
return sock