Merge lp:~lool/launchpad-work-items-tracker/fix-line-wrap-breakage into lp:~linaro-automation/launchpad-work-items-tracker/linaro

Proposed by Loïc Minier
Status: Merged
Merged at revision: 340
Proposed branch: lp:~lool/launchpad-work-items-tracker/fix-line-wrap-breakage
Merge into: lp:~linaro-automation/launchpad-work-items-tracker/linaro
Diff against target: 179 lines (+48/-22)
1 file modified
collect (+48/-22)
To merge this branch: bzr merge lp:~lool/launchpad-work-items-tracker/fix-line-wrap-breakage
Reviewer Review Type Date Requested Status
Milo Casagrande (community) Approve
Review via email: mp+118092@code.launchpad.net

Description of the change

Latest changes have broken ./collect due to some copy-paste regression between staging and main linaro branch (sorry); this fixes it and also makes collect entirely PEP8 clean (some line too long warnings remained).

To post a comment you must log in.
Revision history for this message
Milo Casagrande (milo) wrote :

Looks good, merging now.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'collect'
2--- collect 2012-07-10 16:24:31 +0000
3+++ collect 2012-08-03 13:24:24 +0000
4@@ -209,6 +209,7 @@
5
6
7 def lp_import_blueprint_workitems(collector, bp, distro_release,
8+ people_cache=None, projects=None):
9 '''Collect work items from a Launchpad blueprint.
10
11 This includes work items from the whiteboard as well as linked bugs.
12@@ -333,7 +334,8 @@
13 member.name, team.name)
14 if recursive or team.name in cfg.get('recursive_teams', []):
15 _import_teams_recurse(
16- collector, cfg, member, top_level_team_names + [member.name],
17+ collector, cfg, member,
18+ top_level_team_names + [member.name],
19 people_cache=people_cache, recursive=True)
20
21
22@@ -371,12 +373,14 @@
23 blueprint.status = lp_project.summary or name
24 collector.store_blueprint(blueprint)
25
26- for task in lp_project.searchTasks(status=bug_wi_states.keys(), **cfg['work_item_bugs']):
27+ for task in lp_project.searchTasks(status=bug_wi_states.keys(),
28+ **cfg['work_item_bugs']):
29 id = task.self_link.split('/')[-1]
30 title = task.title.split('"', 1)[1].rstrip('"')
31 state = bug_wi_states[task.status]
32 if state is None:
33- dbg('lp_import_bug_workitems: ignoring #%s: %s (status: %s)' % (id, title, task.status))
34+ dbg('lp_import_bug_workitems: ignoring #%s: %s (status: %s)' % (
35+ id, title, task.status))
36 continue
37 dbg('lp_import_bug_workitems: #%s: %s (%s)' % (id, title, state))
38
39@@ -409,14 +413,17 @@
40 milestones.extend([ms for ms in project.all_milestones])
41
42 if 'release' in cfg:
43- lp_project = collector.lp.distributions['ubuntu'].getSeries(name_or_version=cfg['release'])
44+ lp_project = collector.lp.distributions['ubuntu'].getSeries(
45+ name_or_version=cfg['release'])
46 projects.append((lp_project, None))
47 add_milestones(lp_project)
48 else:
49- assert 'project' in cfg, 'Configuration needs to specify project or release'
50+ assert 'project' in cfg, \
51+ 'Configuration needs to specify project or release'
52 lp_project = collector.lp.projects[cfg['project']]
53 if 'project_series' in cfg:
54- lp_project_series = lp_project.getSeries(name=cfg['project_series'])
55+ lp_project_series = lp_project.getSeries(
56+ name=cfg['project_series'])
57 add_milestones(lp_project_series)
58 else:
59 lp_project_series = None
60@@ -482,10 +489,12 @@
61
62 for project, series in projects:
63 # XXX: should this be valid_ or all_specifications?
64- project_spec_group_matcher = spec_group_matchers.get(project.name, None)
65+ project_spec_group_matcher = spec_group_matchers.get(project.name,
66+ None)
67 project_bps = project.valid_specifications
68 for bp in project_bps:
69- if name_pattern is not None and re.search(name_pattern, bp.name) is None:
70+ if name_pattern is not None and \
71+ re.search(name_pattern, bp.name) is None:
72 continue
73 if project_spec_group_matcher is not None:
74 match = re.search(project_spec_group_matcher, bp.name)
75@@ -500,7 +509,8 @@
76 add_blueprint(bp)
77 if series is not None:
78 for bp in series.valid_specifications:
79- if name_pattern is not None and re.search(name_pattern, bp.name) is None:
80+ if name_pattern is not None and \
81+ re.search(name_pattern, bp.name) is None:
82 continue
83 if project_spec_group_matcher is not None:
84 match = re.search(project_spec_group_matcher, bp.name)
85@@ -596,7 +606,8 @@
86 else:
87 status_search = fields[2:]
88 for f in status_search:
89- if u'DONE' in f or u'POSTPONED' in f or u'TODO' in f or u'INPROGRESS' in f or u'BLOCKED' in f:
90+ if u'DONE' in f or u'POSTPONED' in f or u'TODO' in f or \
91+ u'INPROGRESS' in f or u'BLOCKED' in f:
92 ff = f.split()
93 if len(ff) == 2:
94 assignee = ff[1]
95@@ -645,14 +656,17 @@
96 for url, default_assignee in cfg.get('moin_pages', {}).iteritems():
97 url = unicode_or_None(url)
98 default_assignee = unicode_or_None(default_assignee)
99- dbg('moin_import(): processing %s (default assignee: %s)' % (url, default_assignee))
100- for group, status, items in get_moin_workitems_group(url, default_assignee):
101+ dbg('moin_import(): processing %s (default assignee: %s)' % (
102+ url, default_assignee))
103+ for group, status, items in get_moin_workitems_group(url,
104+ default_assignee):
105 url_clean = url.replace('?action=raw', '')
106 name = url_clean.split('://', 1)[1].split('/', 1)[1]
107 if group:
108 name += u' ' + group
109 spec_url = u'%s#%s' % (url_clean, escape_url(group))
110- dbg(' got group %s: name="%s", url="%s"' % (group, name, spec_url))
111+ dbg(' got group %s: name="%s", url="%s"' % (
112+ group, name, spec_url))
113 else:
114 spec_url = url_clean
115 dbg(' no group: name="%s", url="%s"' % (name, spec_url))
116@@ -691,7 +705,8 @@
117 optparser.add_option('-c', '--config',
118 help='Path to configuration file', dest='config', metavar='PATH')
119 optparser.add_option('-p', '--pattern', metavar='REGEX',
120- help='Regex pattern for blueprint name (optional, mainly for testing)', dest='pattern')
121+ help='Regex pattern for blueprint name (optional, mainly for testing)',
122+ dest='pattern')
123 optparser.add_option('--debug', action='store_true', default=False,
124 help='Enable debugging output in parsing routines')
125 optparser.add_option('--mail', action='store_true', default=False,
126@@ -729,24 +744,30 @@
127 project_name = error.get_project_name()
128 if project_name is not None:
129 addresses = cfg['project_notification_addresses'][project_name]
130- dbg('spec %s is targetted to "%s", mailing to %s' % (error.get_blueprint_name(),
131- project_name, ', '.join(addresses)))
132+ dbg('spec %s is targetted to "%s", mailing to %s' % (
133+ error.get_blueprint_name(), project_name,
134+ ', '.join(addresses)))
135 for a in addresses:
136 emails.setdefault(a, '')
137 emails[a] += error.format_for_display() + '\n'
138 else:
139- print >> sys.stderr, error.format_for_display(), '(no error_contact pattern)'
140+ print >> sys.stderr, error.format_for_display(), \
141+ '(no error_contact pattern)'
142
143 # send mails
144 for addr, contents in emails.iteritems():
145 msg = MIMEText(contents.encode('ascii', 'replace'))
146 msg['Subject'] = 'Errors in work item definitions'
147- msg['From'] = 'Launchpad work item tracker <work-items-tracker-hackers@lists.launchpad.net>'
148+ msg['From'] = 'Launchpad work item tracker ' + \
149+ '<work-items-tracker-hackers@lists.launchpad.net>'
150 msg['To'] = addr
151 s = smtplib.SMTP()
152 s.connect()
153- s.sendmail(os.environ.get('EMAIL', pwd.getpwuid(os.geteuid()).pw_name + '@localhost'),
154- addr, msg.as_string())
155+ s.sendmail(os.environ.get(
156+ 'EMAIL',
157+ pwd.getpwuid(os.geteuid()).pw_name + '@localhost'),
158+ addr,
159+ msg.as_string())
160 s.quit()
161
162
163@@ -793,9 +814,14 @@
164 sys.exit(0)
165
166 if "beta" in EDGE_SERVICE_ROOT:
167- lp = Launchpad.login_with('ubuntu-work-items', service_root=EDGE_SERVICE_ROOT.replace("edge.", "").replace("beta", "devel"))
168+ service_root = EDGE_SERVICE_ROOT
169+ service_root = service_root.replace("edge.", "")
170+ service_root = service_root.replace("beta", "devel")
171+ lp = Launchpad.login_with('ubuntu-work-items',
172+ service_root=service_root)
173 else:
174- lp = Launchpad.login_with('ubuntu-work-items', service_root="production", version="devel")
175+ lp = Launchpad.login_with('ubuntu-work-items',
176+ service_root="production", version="devel")
177
178 store = get_store(opts.database)
179 collector = CollectorStore(store, lp, error_collector)

Subscribers

People subscribed via source and target branches