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>
diff --git a/scripts/replay-dump.py b/scripts/replay-dump.py
index e274086..5ae77c8 100755
--- a/scripts/replay-dump.py
+++ b/scripts/replay-dump.py
@@ -18,6 +18,7 @@
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, see <http://www.gnu.org/licenses/>.
+from __future__ import print_function
import argparse
import struct
from collections import namedtuple
@@ -89,9 +90,9 @@
"Search decode table for next step"
decoder = next((d for d in table if d.eid == index), None)
if not decoder:
- print "Could not decode index: %d" % (index)
- print "Entry is: %s" % (decoder)
- print "Decode Table is:\n%s" % (table)
+ print("Could not decode index: %d" % (index))
+ print("Entry is: %s" % (decoder))
+ print("Decode Table is:\n%s" % (table))
return False
else:
return decoder.fn(decoder.eid, decoder.name, dumpfile)
@@ -103,23 +104,23 @@
event_count = replay_state.event_count
if string:
- print "%d:%s(%d) %s" % (event_count, name, eid, string)
+ print("%d:%s(%d) %s" % (event_count, name, eid, string))
else:
- print "%d:%s(%d)" % (event_count, name, eid)
+ print("%d:%s(%d)" % (event_count, name, eid))
# Decoders for each event type
def decode_unimp(eid, name, _unused_dumpfile):
"Unimplimented decoder, will trigger exit"
- print "%s not handled - will now stop" % (name)
+ print("%s not handled - will now stop" % (name))
return False
# Checkpoint decoder
def swallow_async_qword(eid, name, dumpfile):
"Swallow a qword of data without looking at it"
step_id = read_qword(dumpfile)
- print " %s(%d) @ %d" % (name, eid, step_id)
+ print(" %s(%d) @ %d" % (name, eid, step_id))
return True
async_decode_table = [ Decoder(0, "REPLAY_ASYNC_EVENT_BH", swallow_async_qword),
@@ -139,8 +140,8 @@
async_event_checkpoint = read_byte(dumpfile)
if async_event_checkpoint != replay_state.current_checkpoint:
- print " mismatch between checkpoint %d and async data %d" % (
- replay_state.current_checkpoint, async_event_checkpoint)
+ print(" mismatch between checkpoint %d and async data %d" % (
+ replay_state.current_checkpoint, async_event_checkpoint))
return True
return call_decode(async_decode_table, async_event_kind, dumpfile)
@@ -283,7 +284,7 @@
version = read_dword(dumpfile)
junk = read_qword(dumpfile)
- print "HEADER: version 0x%x" % (version)
+ print("HEADER: version 0x%x" % (version))
if version == 0xe02007:
event_decode_table = v7_event_table