]> arthur.barton.de Git - bup.git/commitdiff
columnate: use // not / for division
authorRob Browning <rlb@defaultvalue.org>
Sun, 21 Jan 2018 22:26:24 +0000 (16:26 -0600)
committerRob Browning <rlb@defaultvalue.org>
Sun, 21 Jan 2018 22:31:53 +0000 (16:31 -0600)
Without this, columnate can go off into the weeds because Python 3
changed / to floating point.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/helpers.py

index 0f3df669322fddbf24e4fddc5643be6cce9438e9..a4dc3376c67aac5b0b9c94a7c10822eecbed912a 100644 (file)
@@ -960,14 +960,14 @@ def columnate(l, prefix):
         return ""
     l = l[:]
     clen = max(len(s) for s in l)
-    ncols = (tty_width() - len(prefix)) / (clen + 2)
+    ncols = (tty_width() - len(prefix)) // (clen + 2)
     if ncols <= 1:
         ncols = 1
         clen = 0
     cols = []
     while len(l) % ncols:
         l.append('')
-    rows = len(l)/ncols
+    rows = len(l) // ncols
     for s in range(0, len(l), rows):
         cols.append(l[s:s+rows])
     out = ''