Skip to content

Commit

Permalink
tools: hv: update lsvmbus to be compatible with python3
Browse files Browse the repository at this point in the history
Python3 changed the way how 'print' works.
Adjust the code to a syntax that is understood by python2 and python3.

Signed-off-by: Olaf Hering <[email protected]>
Acked-by: Dexuan Cui <[email protected]>
Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
olafhering authored and gregkh committed Jul 3, 2018
1 parent 619a4c8 commit 8a99c92
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tools/hv/lsvmbus
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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))

0 comments on commit 8a99c92

Please sign in to comment.