* [PATCH] tools: hv: lsvmbus: convert to Python3
@ 2018-05-22 8:45 Vitaly Kuznetsov
2018-05-22 18:29 ` Dexuan Cui
0 siblings, 1 reply; 2+ messages in thread
From: Vitaly Kuznetsov @ 2018-05-22 8:45 UTC (permalink / raw)
To: devel
Cc: Dexuan Cui, K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger,
linux-kernel
Use '2to3' tool to make lsvmbus work with both Python2 and Python3.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
tools/hv/lsvmbus | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/hv/lsvmbus b/tools/hv/lsvmbus
index 353e56768df8..c184aac33d5c 100644
--- a/tools/hv/lsvmbus
+++ b/tools/hv/lsvmbus
@@ -17,7 +17,7 @@ if options.verbose is not None:
vmbus_sys_path = '/sys/bus/vmbus/devices'
if not os.path.isdir(vmbus_sys_path):
- print "%s doesn't exist: exiting..." % vmbus_sys_path
+ print("%s doesn't exist: exiting..." % vmbus_sys_path)
exit(-1)
vmbus_dev_dict = {
@@ -93,11 +93,11 @@ format2 = '%2s: Class_ID = %s - %s\n\tDevice_ID = %s\n\tSysfs path: %s\n%s'
for d in vmbus_dev_list:
if verbose == 0:
- print ('VMBUS ID ' + format0) % (d.vmbus_id, d.dev_desc)
+ print(('VMBUS ID ' + format0) % (d.vmbus_id, d.dev_desc))
elif verbose == 1:
- print ('VMBUS ID ' + format1) % \
- (d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping)
+ print(('VMBUS ID ' + format1) % \
+ (d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping))
else:
- print ('VMBUS ID ' + format2) % \
+ print(('VMBUS ID ' + format2) % \
(d.vmbus_id, d.class_id, d.dev_desc, \
- d.device_id, d.sysfs_path, d.chn_vp_mapping)
+ d.device_id, d.sysfs_path, d.chn_vp_mapping))
--
2.14.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH] tools: hv: lsvmbus: convert to Python3
2018-05-22 8:45 [PATCH] tools: hv: lsvmbus: convert to Python3 Vitaly Kuznetsov
@ 2018-05-22 18:29 ` Dexuan Cui
0 siblings, 0 replies; 2+ messages in thread
From: Dexuan Cui @ 2018-05-22 18:29 UTC (permalink / raw)
To: Vitaly Kuznetsov, devel
Cc: KY Srinivasan, Haiyang Zhang, Stephen Hemminger, linux-kernel
> From: Vitaly Kuznetsov <vkuznets@redhat.com>
> Sent: Tuesday, May 22, 2018 01:45
>
> Use '2to3' tool to make lsvmbus work with both Python2 and Python3.
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
> tools/hv/lsvmbus | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/tools/hv/lsvmbus b/tools/hv/lsvmbus
> index 353e56768df8..c184aac33d5c 100644
> --- a/tools/hv/lsvmbus
> +++ b/tools/hv/lsvmbus
> @@ -17,7 +17,7 @@ if options.verbose is not None:
>
> vmbus_sys_path = '/sys/bus/vmbus/devices'
> if not os.path.isdir(vmbus_sys_path):
> - print "%s doesn't exist: exiting..." % vmbus_sys_path
> + print("%s doesn't exist: exiting..." % vmbus_sys_path)
> exit(-1)
>
> vmbus_dev_dict = {
> @@ -93,11 +93,11 @@ format2 = '%2s: Class_ID = %s - %s\n\tDevice_ID
> = %s\n\tSysfs path: %s\n%s'
>
> for d in vmbus_dev_list:
> if verbose == 0:
> - print ('VMBUS ID ' + format0) % (d.vmbus_id, d.dev_desc)
> + print(('VMBUS ID ' + format0) % (d.vmbus_id, d.dev_desc))
> elif verbose == 1:
> - print ('VMBUS ID ' + format1) % \
> - (d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping)
> + print(('VMBUS ID ' + format1) % \
> + (d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping))
> else:
> - print ('VMBUS ID ' + format2) % \
> + print(('VMBUS ID ' + format2) % \
> (d.vmbus_id, d.class_id, d.dev_desc, \
> - d.device_id, d.sysfs_path, d.chn_vp_mapping)
> + d.device_id, d.sysfs_path, d.chn_vp_mapping))
> --
> 2.14.3
Looks good to me. Thanks!
Acked-by: Dexuan Cui <decui@microsoft.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-22 18:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-22 8:45 [PATCH] tools: hv: lsvmbus: convert to Python3 Vitaly Kuznetsov
2018-05-22 18:29 ` Dexuan Cui
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).