diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2018-06-08 09:29:43 -0300 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2018-06-08 14:39:24 -0300 |
commit | f03868bd5653265e97b253102d77d83ea85efdea (patch) | |
tree | f524a2198bb8492e8502326a112d465892d255b0 /tests/qemu-iotests/nbd-fault-injector.py | |
parent | 0d2fa03dae4fbe185a082f361342b1e30aed4582 (diff) | |
download | qemu-f03868bd5653265e97b253102d77d83ea85efdea.zip qemu-f03868bd5653265e97b253102d77d83ea85efdea.tar.gz qemu-f03868bd5653265e97b253102d77d83ea85efdea.tar.bz2 |
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>
Diffstat (limited to 'tests/qemu-iotests/nbd-fault-injector.py')
-rwxr-xr-x | tests/qemu-iotests/nbd-fault-injector.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/qemu-iotests/nbd-fault-injector.py b/tests/qemu-iotests/nbd-fault-injector.py index 8a04d97..f9193c0 100755 --- a/tests/qemu-iotests/nbd-fault-injector.py +++ b/tests/qemu-iotests/nbd-fault-injector.py @@ -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 |