aboutsummaryrefslogtreecommitdiff
path: root/scripts/analyze-migration.py
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2018-06-08 09:29:43 -0300
committerEduardo Habkost <ehabkost@redhat.com>2018-06-08 14:39:24 -0300
commitf03868bd5653265e97b253102d77d83ea85efdea (patch)
treef524a2198bb8492e8502326a112d465892d255b0 /scripts/analyze-migration.py
parent0d2fa03dae4fbe185a082f361342b1e30aed4582 (diff)
downloadqemu-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 'scripts/analyze-migration.py')
-rwxr-xr-xscripts/analyze-migration.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py
index 88ff4ad..5c2010c 100755
--- a/scripts/analyze-migration.py
+++ b/scripts/analyze-migration.py
@@ -17,6 +17,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 numpy as np
import json
import os
@@ -162,7 +163,7 @@ class RamSection(object):
len = self.file.read64()
self.sizeinfo[self.name] = '0x%016x' % len
if self.write_memory:
- print self.name
+ print(self.name)
mkdir_p('./' + os.path.dirname(self.name))
f = open('./' + self.name, "wb")
f.truncate(0)
@@ -588,7 +589,7 @@ if args.extract:
dump = MigrationDump(args.file)
dump.read(desc_only = True)
- print "desc.json"
+ print("desc.json")
f = open("desc.json", "wb")
f.truncate()
f.write(jsonenc.encode(dump.vmsd_desc))
@@ -596,7 +597,7 @@ if args.extract:
dump.read(write_memory = True)
dict = dump.getDict()
- print "state.json"
+ print("state.json")
f = open("state.json", "wb")
f.truncate()
f.write(jsonenc.encode(dict))
@@ -605,10 +606,10 @@ elif args.dump == "state":
dump = MigrationDump(args.file)
dump.read(dump_memory = args.memory)
dict = dump.getDict()
- print jsonenc.encode(dict)
+ print(jsonenc.encode(dict))
elif args.dump == "desc":
dump = MigrationDump(args.file)
dump.read(desc_only = True)
- print jsonenc.encode(dump.vmsd_desc)
+ print(jsonenc.encode(dump.vmsd_desc))
else:
raise Exception("Please specify either -x, -d state or -d dump")