Merge lp:~tdaitx/byobu/lp-1711026-fix-pep8-E722 into lp:byobu

Proposed by Tiago Stürmer Daitx
Status: Merged
Merged at revision: 2561
Proposed branch: lp:~tdaitx/byobu/lp-1711026-fix-pep8-E722
Merge into: lp:byobu
Diff against target: 128 lines (+14/-14)
2 files modified
usr/lib/byobu/include/config.py.in (+10/-10)
usr/lib/byobu/include/select-session.py (+4/-4)
To merge this branch: bzr merge lp:~tdaitx/byobu/lp-1711026-fix-pep8-E722
Reviewer Review Type Date Requested Status
Dustin Kirkland  Pending
Review via email: mp+329168@code.launchpad.net

Description of the change

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.

This patch fixes all bare except: currently in use in byobu.

Log error from build [1]:

# Check python syntax
pep8 --verbose --repeat --ignore W191,E501 usr/lib/byobu/include/config.py usr/lib/byobu/include/select-session.py
checking usr/lib/byobu/include/config.py
usr/lib/byobu/include/config.py:45:1: E722 do not use bare except'
usr/lib/byobu/include/config.py:84:2: E722 do not use bare except'
usr/lib/byobu/include/config.py:99:2: E722 do not use bare except'
usr/lib/byobu/include/config.py:113:3: E722 do not use bare except'
usr/lib/byobu/include/config.py:119:3: E722 do not use bare except'
usr/lib/byobu/include/config.py:176:4: E722 do not use bare except'
usr/lib/byobu/include/config.py:220:4: E722 do not use bare except'
usr/lib/byobu/include/config.py:226:4: E722 do not use bare except'
usr/lib/byobu/include/config.py:344:4: E722 do not use bare except'
usr/lib/byobu/include/config.py:366:2: E722 do not use bare except'
checking usr/lib/byobu/include/select-session.py
usr/lib/byobu/include/select-session.py:30:1: E722 do not use bare except'
usr/lib/byobu/include/select-session.py:159:4: E722 do not use bare except'
usr/lib/byobu/include/select-session.py:166:4: E722 do not use bare except'
usr/lib/byobu/include/select-session.py:177:3: E722 do not use bare except'
debian/rules:6: recipe for target 'override_dh_auto_build' failed
make[1]: *** [override_dh_auto_build] Error 1
make[1]: Leaving directory '/<<PKGBUILDDIR>>'

[1] https://launchpadlibrarian.net/332635385/buildlog_ubuntu-artful-amd64.byobu_5.121-0ubuntu1_BUILDING.txt.gz

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'usr/lib/byobu/include/config.py.in'
2--- usr/lib/byobu/include/config.py.in 2016-04-07 22:07:52 +0000
3+++ usr/lib/byobu/include/config.py.in 2017-08-17 04:13:44 +0000
4@@ -42,7 +42,7 @@
5 try:
6 import snack
7 from snack import *
8-except:
9+except Exception:
10 error("Could not import the python snack module")
11
12
13@@ -81,7 +81,7 @@
14 import struct
15 import os
16 cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234'))
17- except:
18+ except Exception:
19 return None
20 return cr
21
22@@ -96,7 +96,7 @@
23 f.close()
24 if BYOBU_BACKEND == "screen":
25 subprocess.call([BYOBU_BACKEND, "-X", "at", "0", "source", "%s/profile" % BYOBU_CONFIG_DIR])
26- except:
27+ except Exception:
28 True
29
30
31@@ -110,13 +110,13 @@
32 fd = os.open(os.ctermid(), os.O_RDONLY)
33 cr = ioctl_GWINSZ(fd)
34 os.close(fd)
35- except:
36+ except Exception:
37 pass
38 if not cr:
39 # env vars or finally defaults
40 try:
41 cr = (env['LINES'], env['COLUMNS'])
42- except:
43+ except Exception:
44 cr = (25, 80)
45 # reverse rows, cols
46 return int(cr[1] - 5), int(cr[0] - 5)
47@@ -173,7 +173,7 @@
48 if os.path.exists(f):
49 try:
50 exec(open(f).read(), glo, loc)
51- except:
52+ except Exception:
53 error("Invalid configuration [%s]" % f)
54 if BYOBU_BACKEND == "tmux":
55 items = "%s %s" % (loc["tmux_left"], loc["tmux_right"])
56@@ -217,13 +217,13 @@
57 if key.startswith(BYOBU_BACKEND):
58 try:
59 f = open(path, "r")
60- except:
61+ except Exception:
62 f = open(SHARE + '/status/status', "r")
63 lines = f.readlines()
64 f.close()
65 try:
66 f = open(path, "w")
67- except:
68+ except Exception:
69 f = open(path, "a+")
70 for l in lines:
71 if l.startswith("%s=" % key):
72@@ -341,7 +341,7 @@
73 try:
74 dummy = int(esc.value())
75 esc.set(DEF_ESC)
76- except:
77+ except Exception:
78 # do nothing
79 dummy = "foo"
80 else:
81@@ -363,7 +363,7 @@
82 for line in open("%s/.profile" % HOME):
83 if "byobu-launch" in line:
84 return 1
85- except:
86+ except Exception:
87 return 0
88 if os.path.exists("/etc/profile.d/Z97-%s.sh" % PKG):
89 return 1
90
91=== modified file 'usr/lib/byobu/include/select-session.py'
92--- usr/lib/byobu/include/select-session.py 2017-01-26 14:39:31 +0000
93+++ usr/lib/byobu/include/select-session.py 2017-08-17 04:13:44 +0000
94@@ -27,7 +27,7 @@
95 try:
96 # For Python3, try and import input from builtins
97 from builtins import input
98-except:
99+except Exception:
100 # But fall back to using the default input
101 True
102
103@@ -156,14 +156,14 @@
104 try:
105 try:
106 user_input = input("\nChoose 1-%d [1]: " % (i - 1))
107- except:
108+ except Exception:
109 user_input = ""
110 if not user_input or user_input == "":
111 choice = 1
112 break
113 try:
114 choice = int(user_input)
115- except:
116+ except Exception:
117 choice = int(eval(user_input))
118 if choice >= 1 and choice < i:
119 break
120@@ -174,7 +174,7 @@
121 except KeyboardInterrupt:
122 sys.stdout.write("\n")
123 sys.exit(0)
124- except:
125+ except Exception:
126 if choice == "" or choice == -1:
127 choice = 1
128 break

Subscribers

People subscribed via source and target branches