Merge lp:~bladernr/checkbox/1180496-fix-cpuinfo-parser into lp:checkbox

Proposed by Jeff Lane 
Status: Merged
Approved by: Daniel Manrique
Approved revision: 2124
Merged at revision: 2124
Proposed branch: lp:~bladernr/checkbox/1180496-fix-cpuinfo-parser
Merge into: lp:checkbox
Diff against target: 37 lines (+7/-3)
2 files modified
checkbox/parsers/cpuinfo.py (+2/-3)
debian/changelog (+5/-0)
To merge this branch: bzr merge lp:~bladernr/checkbox/1180496-fix-cpuinfo-parser
Reviewer Review Type Date Requested Status
Daniel Manrique (community) Approve
Review via email: mp+164021@code.launchpad.net

Description of the change

Fixed issue in cpuinfo parser that caused it to traceback when a line had more than one ':'
pep8 fix of a minor issue found while cleaning this up for submission.

To post a comment you must log in.
Revision history for this message
Daniel Manrique (roadmr) wrote :

Looks good, thanks for fixing this!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'checkbox/parsers/cpuinfo.py'
2--- checkbox/parsers/cpuinfo.py 2012-05-31 20:14:26 +0000
3+++ checkbox/parsers/cpuinfo.py 2013-05-15 18:49:24 +0000
4@@ -46,8 +46,7 @@
5 for line in block.split("\n"):
6 if not line:
7 continue
8-
9- key, value = line.split(":")
10+ key, value = line.split(":", 1)
11 key, value = key.strip(), value.strip()
12
13 # Handle bogomips on sparc
14@@ -135,7 +134,7 @@
15 for pkey, ckey in conversion.items():
16 if isinstance(ckey, (list, tuple)):
17 processor[pkey] = "/".join([attributes[k]
18- for k in ckey])
19+ for k in ckey])
20 elif ckey in attributes:
21 processor[pkey] = attributes[ckey]
22
23
24=== modified file 'debian/changelog'
25--- debian/changelog 2013-05-14 22:26:39 +0000
26+++ debian/changelog 2013-05-15 18:49:24 +0000
27@@ -12,6 +12,11 @@
28 [ Daniel Manrique ]
29 * Ensured that button strings from the "continue" dialog are translatable
30 (LP: #1176695)
31+
32+ [ Jeff Lane ]
33+ * checkbox/parsers/cpuinfo.py - split on first instance of ':' in cpuinfo
34+ output lines to avoid splitting into more than 2 items. Also fixed a pep8
35+ issue discovered while working on this. (LP: #1180496)
36
37 -- Brendan Donegan <brendan.donegan@canonical.com> Tue, 07 May 2013 19:21:05 +0100
38

Subscribers

People subscribed via source and target branches