Commit 58f33cfe authored by Stefan Raspl's avatar Stefan Raspl Committed by Radim Krčmář

tools/kvm_stat: fix python3 issues

Python3 returns a float for a regular division - switch to a division
operator that returns an integer.
Furthermore, filters return a generator object instead of the actual
list - wrap result in yet another list, which makes it still work in
both, Python2 and 3.
Signed-off-by: default avatarStefan Raspl <raspl@linux.ibm.com>
Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
parent c60658d1
...@@ -759,7 +759,7 @@ class DebugfsProvider(Provider): ...@@ -759,7 +759,7 @@ class DebugfsProvider(Provider):
if len(vms) == 0: if len(vms) == 0:
self.do_read = False self.do_read = False
self.paths = filter(lambda x: "{}-".format(pid) in x, vms) self.paths = list(filter(lambda x: "{}-".format(pid) in x, vms))
else: else:
self.paths = [] self.paths = []
...@@ -1219,10 +1219,10 @@ class Tui(object): ...@@ -1219,10 +1219,10 @@ class Tui(object):
(x, term_width) = self.screen.getmaxyx() (x, term_width) = self.screen.getmaxyx()
row = 2 row = 2
for line in text: for line in text:
start = (term_width - len(line)) / 2 start = (term_width - len(line)) // 2
self.screen.addstr(row, start, line) self.screen.addstr(row, start, line)
row += 1 row += 1
self.screen.addstr(row + 1, (term_width - len(hint)) / 2, hint, self.screen.addstr(row + 1, (term_width - len(hint)) // 2, hint,
curses.A_STANDOUT) curses.A_STANDOUT)
self.screen.getkey() self.screen.getkey()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment