diff --git a/debian/changelog b/debian/changelog index 13b0a3d5..53b3606f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,11 @@ byobu (5.122) unreleased; urgency=medium - * UNRELEASED + [ Tiago Stürmer Daitx ] + * usr/lib/byobu/include/config.py.in, usr/lib/byobu/include/select- + session.py: LP: #1711026 + - Byobu currently FTBFS on artful during pep8 verification due to + the newly introduced E722 - ie. a 'try:/except:' block with a + bare except that should be replaced by a 'try:except Exception:' block. -- Dustin Kirkland Wed, 09 Aug 2017 16:53:48 -0500 diff --git a/usr/lib/byobu/include/config.py.in b/usr/lib/byobu/include/config.py.in index 40f01196..b064b0ec 100755 --- a/usr/lib/byobu/include/config.py.in +++ b/usr/lib/byobu/include/config.py.in @@ -42,7 +42,7 @@ def error(msg): try: import snack from snack import * -except: +except Exception: error("Could not import the python snack module") @@ -81,7 +81,7 @@ def ioctl_GWINSZ(fd): import struct import os cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234')) - except: + except Exception: return None return cr @@ -96,7 +96,7 @@ def reload_required(): f.close() if BYOBU_BACKEND == "screen": subprocess.call([BYOBU_BACKEND, "-X", "at", "0", "source", "%s/profile" % BYOBU_CONFIG_DIR]) - except: + except Exception: True @@ -110,13 +110,13 @@ def terminal_size(): fd = os.open(os.ctermid(), os.O_RDONLY) cr = ioctl_GWINSZ(fd) os.close(fd) - except: + except Exception: pass if not cr: # env vars or finally defaults try: cr = (env['LINES'], env['COLUMNS']) - except: + except Exception: cr = (25, 80) # reverse rows, cols return int(cr[1] - 5), int(cr[0] - 5) @@ -173,7 +173,7 @@ def readstatus(): if os.path.exists(f): try: exec(open(f).read(), glo, loc) - except: + except Exception: error("Invalid configuration [%s]" % f) if BYOBU_BACKEND == "tmux": items = "%s %s" % (loc["tmux_left"], loc["tmux_right"]) @@ -217,13 +217,13 @@ def writestatus(items): if key.startswith(BYOBU_BACKEND): try: f = open(path, "r") - except: + except Exception: f = open(SHARE + '/status/status', "r") lines = f.readlines() f.close() try: f = open(path, "w") - except: + except Exception: f = open(path, "a+") for l in lines: if l.startswith("%s=" % key): @@ -341,7 +341,7 @@ def chgesc(snackScreen, size): try: dummy = int(esc.value()) esc.set(DEF_ESC) - except: + except Exception: # do nothing dummy = "foo" else: @@ -363,7 +363,7 @@ def autolaunch(): for line in open("%s/.profile" % HOME): if "byobu-launch" in line: return 1 - except: + except Exception: return 0 if os.path.exists("/etc/profile.d/Z97-%s.sh" % PKG): return 1 diff --git a/usr/lib/byobu/include/select-session.py b/usr/lib/byobu/include/select-session.py index f0c7b237..78b0ea15 100755 --- a/usr/lib/byobu/include/select-session.py +++ b/usr/lib/byobu/include/select-session.py @@ -27,7 +27,7 @@ import subprocess try: # For Python3, try and import input from builtins from builtins import input -except: +except Exception: # But fall back to using the default input True @@ -156,14 +156,14 @@ if len(sessions) > 1: try: try: user_input = input("\nChoose 1-%d [1]: " % (i - 1)) - except: + except Exception: user_input = "" if not user_input or user_input == "": choice = 1 break try: choice = int(user_input) - except: + except Exception: choice = int(eval(user_input)) if choice >= 1 and choice < i: break @@ -174,7 +174,7 @@ if len(sessions) > 1: except KeyboardInterrupt: sys.stdout.write("\n") sys.exit(0) - except: + except Exception: if choice == "" or choice == -1: choice = 1 break