From f03868bd5653265e97b253102d77d83ea85efdea Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Fri, 8 Jun 2018 09:29:43 -0300 Subject: 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 Acked-by: Fam Zheng Signed-off-by: Eduardo Habkost Message-Id: <20180608122952.2009-2-ehabkost@redhat.com> [ehabkost: fixup tests/docker/docker.py] Signed-off-by: Eduardo Habkost --- scripts/kvm/kvm_flightrecorder | 21 +++++++++++---------- scripts/kvm/vmxcap | 1 + 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'scripts/kvm') diff --git a/scripts/kvm/kvm_flightrecorder b/scripts/kvm/kvm_flightrecorder index 7fb1c2d..54a5674 100755 --- a/scripts/kvm/kvm_flightrecorder +++ b/scripts/kvm/kvm_flightrecorder @@ -32,6 +32,7 @@ # consuming CPU cycles. No disk I/O is performed since the ring buffer holds a # fixed-size in-memory trace. +from __future__ import print_function import sys import os @@ -77,8 +78,8 @@ def tail_trace(): pass def usage(): - print 'Usage: %s start [buffer_size_kb] | stop | dump | tail' % sys.argv[0] - print 'Control the KVM flight recorder tracing.' + print('Usage: %s start [buffer_size_kb] | stop | dump | tail' % sys.argv[0]) + print('Control the KVM flight recorder tracing.') sys.exit(0) def main(): @@ -87,15 +88,15 @@ def main(): cmd = sys.argv[1] if cmd == '--version': - print 'kvm_flightrecorder version 1.0' + print('kvm_flightrecorder version 1.0') sys.exit(0) if not os.path.isdir(tracing_dir): - print 'Unable to tracing debugfs directory, try:' - print 'mount -t debugfs none /sys/kernel/debug' + print('Unable to tracing debugfs directory, try:') + print('mount -t debugfs none /sys/kernel/debug') sys.exit(1) if not os.access(tracing_dir, os.W_OK): - print 'Unable to write to tracing debugfs directory, please run as root' + print('Unable to write to tracing debugfs directory, please run as root') sys.exit(1) if cmd == 'start': @@ -105,16 +106,16 @@ def main(): try: buffer_size_kb = int(sys.argv[2]) except ValueError: - print 'Invalid per-cpu trace buffer size in KB' + print('Invalid per-cpu trace buffer size in KB') sys.exit(1) write_file(trace_path('buffer_size_kb'), str(buffer_size_kb)) - print 'Per-CPU ring buffer size set to %d KB' % buffer_size_kb + print('Per-CPU ring buffer size set to %d KB' % buffer_size_kb) start_tracing() - print 'KVM flight recorder enabled' + print('KVM flight recorder enabled') elif cmd == 'stop': stop_tracing() - print 'KVM flight recorder disabled' + print('KVM flight recorder disabled') elif cmd == 'dump': dump_trace() elif cmd == 'tail': diff --git a/scripts/kvm/vmxcap b/scripts/kvm/vmxcap index d9a6db0..99a8146 100755 --- a/scripts/kvm/vmxcap +++ b/scripts/kvm/vmxcap @@ -10,6 +10,7 @@ # This work is licensed under the terms of the GNU GPL, version 2. See # the COPYING file in the top-level directory. +from __future__ import print_function MSR_IA32_VMX_BASIC = 0x480 MSR_IA32_VMX_PINBASED_CTLS = 0x481 MSR_IA32_VMX_PROCBASED_CTLS = 0x482 -- cgit v1.1