Re: [Qemu-block] [RFC 01/10] python: futurize -f libfuturize.fixes.fix_print_with_import

2018-05-14 Thread Stefan Hajnoczi
On Fri, May 11, 2018 at 07:20:43PM -0300, Eduardo Habkost wrote:
> 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
> 
> Signed-off-by: Eduardo Habkost 
> ---
>  scripts/analyse-9p-simpletrace.py| 89 
> 
>  scripts/analyse-locks-simpletrace.py |  1 +
>  scripts/analyze-migration.py | 11 ++--
>  scripts/dump-guest-memory.py |  1 +
>  scripts/replay-dump.py   | 21 
>  scripts/signrom.py   |  1 +
>  scripts/simpletrace.py   |  3 +-
>  scripts/vmstate-static-checker.py| 85 +++---
>  scripts/device-crash-test|  3 +-
>  scripts/kvm/kvm_flightrecorder   | 21 
>  scripts/kvm/vmxcap   |  1 +
>  scripts/qmp/qemu-ga-client   |  1 +
>  scripts/qmp/qmp  | 17 +++---
>  scripts/qmp/qmp-shell| 35 +++--
>  scripts/qmp/qom-get  |  7 +--
>  scripts/qmp/qom-list | 11 ++--
>  scripts/qmp/qom-set  |  5 +-
>  scripts/qmp/qom-tree | 11 ++--
>  tests/docker/docker.py   | 11 ++--
>  tests/docker/travis.py   | 15 +++---
>  tests/guest-debug/test-gdbstub.py|  1 +
>  tests/image-fuzzer/runner.py | 38 ++
>  tests/migration/guestperf/engine.py  | 29 ++-
>  tests/migration/guestperf/plot.py| 17 +++---
>  tests/migration/guestperf/shell.py   | 19 +++
>  tests/qemu-iotests/149   |  3 +-
>  tests/qemu-iotests/165   |  3 +-
>  tests/qemu-iotests/iotests.py|  5 +-
>  tests/qemu-iotests/nbd-fault-injector.py |  7 +--
>  tests/qemu-iotests/qcow2.py  | 39 +++---
>  tests/qemu-iotests/qed.py| 17 +++---
>  tests/vm/basevm.py   |  3 +-
>  32 files changed, 278 insertions(+), 253 deletions(-)

Reviewed-by: Stefan Hajnoczi 


signature.asc
Description: PGP signature


[Qemu-block] [RFC 01/10] python: futurize -f libfuturize.fixes.fix_print_with_import

2018-05-11 Thread Eduardo Habkost
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

Signed-off-by: Eduardo Habkost 
---
 scripts/analyse-9p-simpletrace.py| 89 
 scripts/analyse-locks-simpletrace.py |  1 +
 scripts/analyze-migration.py | 11 ++--
 scripts/dump-guest-memory.py |  1 +
 scripts/replay-dump.py   | 21 
 scripts/signrom.py   |  1 +
 scripts/simpletrace.py   |  3 +-
 scripts/vmstate-static-checker.py| 85 +++---
 scripts/device-crash-test|  3 +-
 scripts/kvm/kvm_flightrecorder   | 21 
 scripts/kvm/vmxcap   |  1 +
 scripts/qmp/qemu-ga-client   |  1 +
 scripts/qmp/qmp  | 17 +++---
 scripts/qmp/qmp-shell| 35 +++--
 scripts/qmp/qom-get  |  7 +--
 scripts/qmp/qom-list | 11 ++--
 scripts/qmp/qom-set  |  5 +-
 scripts/qmp/qom-tree | 11 ++--
 tests/docker/docker.py   | 11 ++--
 tests/docker/travis.py   | 15 +++---
 tests/guest-debug/test-gdbstub.py|  1 +
 tests/image-fuzzer/runner.py | 38 ++
 tests/migration/guestperf/engine.py  | 29 ++-
 tests/migration/guestperf/plot.py| 17 +++---
 tests/migration/guestperf/shell.py   | 19 +++
 tests/qemu-iotests/149   |  3 +-
 tests/qemu-iotests/165   |  3 +-
 tests/qemu-iotests/iotests.py|  5 +-
 tests/qemu-iotests/nbd-fault-injector.py |  7 +--
 tests/qemu-iotests/qcow2.py  | 39 +++---
 tests/qemu-iotests/qed.py| 17 +++---
 tests/vm/basevm.py   |  3 +-
 32 files changed, 278 insertions(+), 253 deletions(-)

diff --git a/scripts/analyse-9p-simpletrace.py 
b/scripts/analyse-9p-simpletrace.py
index 3c3dee4337..710e01adba 100755
--- a/scripts/analyse-9p-simpletrace.py
+++ b/scripts/analyse-9p-simpletrace.py
@@ -3,6 +3,7 @@
 # Usage: ./analyse-9p-simpletrace  
 #
 # Author: Harsh Prateek Bora
+from __future__ import print_function
 import os
 import simpletrace
 
@@ -79,135 +80,135 @@ symbol_9p = {
 
 class VirtFSRequestTracker(simpletrace.Analyzer):
 def begin(self):
-print "Pretty printing 9p simpletrace log ..."
+print("Pretty printing 9p simpletrace log ...")
 
 def v9fs_rerror(self, tag, id, err):
-print "RERROR (tag =", tag, ", id =", symbol_9p[id], ", err = 
\"", os.strerror(err), "\")"
+print("RERROR (tag =", tag, ", id =", symbol_9p[id], ", err = 
\"", os.strerror(err), "\")")
 
 def v9fs_version(self, tag, id, msize, version):
-print "TVERSION (tag =", tag, ", msize =", msize, ", version 
=", version, ")"
+print("TVERSION (tag =", tag, ", msize =", msize, ", version 
=", version, ")")
 
 def v9fs_version_return(self, tag, id, msize, version):
-print "RVERSION (tag =", tag, ", msize =", msize, ", version 
=", version, ")"
+print("RVERSION (tag =", tag, ", msize =", msize, ", version 
=", version, ")")
 
 def v9fs_attach(self, tag, id, fid, afid, uname, aname):
-print "TATTACH (tag =", tag, ", fid =", fid, ", afid =", afid, 
", uname =", uname, ", aname =", aname, ")"
+print("TATTACH (tag =", tag, ", fid =", fid, ", afid =", afid, 
", uname =", uname, ", aname =", aname, ")")
 
 def v9fs_attach_return(self, tag, id, type, version, path):
-print "RATTACH (tag =", tag, ", qid={type =", type, ", version 
=", version, ", path =", path, "})"
+print("RATTACH (tag =", tag, ", qid={type =", type, ", version 
=", version, ", path =", path, "})")
 
 def v9fs_stat(self, tag, id, fid):
-print "TSTAT (tag =", tag, ", fid =", fid, ")"
+print("TSTAT (tag =", tag, ", fid =", fid, ")")
 
 def v9fs_stat_return(self, tag, id, mode, atime, mtime, length):
-print "RSTAT (tag =", tag, ", mode =", mode, ", atime =", 
atime, ", mtime =", mtime, ", length =", length, ")"
+print("RSTAT (tag =", tag, ", mode =", mode, ", atime =", 
atime, ", mtime =", mtime, ", length =", length, ")")
 
 def v9fs_getattr(self, tag, id, fid, request_mask):
-print "TGETATTR (tag =", tag, ", fid =", fid, ", request_mask 
=", hex(request_mask), ")"
+print("TGETATTR (tag =", tag, ", fid =", fid, ", request_mask 
=", hex(request_mask), ")")
 
 def v9fs_getattr_return(self, tag, id, result_mask, mode, uid, gid):
-