~debian-lptools/debian/sid/lptools/sid

« back to all changes in this revision

Viewing changes to debian/patches/02_python3

  • Committer: Jelmer Vernooij
  • Date: 2023-09-28 12:07:22 UTC
  • mfrom: (2.18.8)
  • Revision ID: jelmer@jelmer.uk-20230928120722-704pws90v7e943dk
* New upstream snapshot.
 + Drop patches for conversion to python 3 and breezy; now merged upstream.
+ debian/upstream/metadata: Drop unknown Homepage field.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
=== modified file 'setup.py'
2
 
Index: lptools-0.2.0/setup.py
3
 
===================================================================
4
 
--- lptools-0.2.0.orig/setup.py
5
 
+++ lptools-0.2.0/setup.py
6
 
@@ -4,7 +4,8 @@ from glob import glob
7
 
 from distutils.core import setup
8
 
 import os.path
9
 
 
10
 
-description = file(os.path.join(os.path.dirname(__file__), 'README'), 'rb').read()
11
 
+with open(os.path.join(os.path.dirname(__file__), 'README'), 'r') as f:
12
 
+    description = f.read()
13
 
 
14
 
 setup(
15
 
     name='lptools',
16
 
@@ -20,7 +21,7 @@ setup(
17
 
                                              'templates/recipe-status.html'])],
18
 
     packages=['lptools'],
19
 
     scripts=glob('bin/*'),
20
 
-    classifiers = [
21
 
+    classifiers=[
22
 
         'Development Status :: 4 - Beta',
23
 
         'Intended Audience :: Developers',
24
 
         'License :: OSI Approved :: GNU General Public License v3 (GPL3)'
25
 
Index: lptools-0.2.0/bin/lp-attach
26
 
===================================================================
27
 
--- lptools-0.2.0.orig/bin/lp-attach
28
 
+++ lptools-0.2.0/bin/lp-attach
29
 
@@ -1,4 +1,4 @@
30
 
-#! /usr/bin/python
31
 
+#! /usr/bin/python3
32
 
 #
33
 
 # Copyright (C) 2010 Canonical Ltd
34
 
 
35
 
@@ -35,7 +35,7 @@ from lptools import config
36
 
 def guess_mime_type(attachment_bytes):
37
 
     try:
38
 
         import magic
39
 
-    except ImportError, e:
40
 
+    except ImportError as e:
41
 
         sys.stderr.write("can't guess mime-types without the python-magic library: %s" % e)
42
 
         mimetype = None
43
 
     else:
44
 
@@ -43,13 +43,13 @@ def guess_mime_type(attachment_bytes):
45
 
         mimetype = mime.buffer(attachment_bytes)
46
 
     if mimetype is None:
47
 
         mimetype = 'application/binary'
48
 
-    print 'attachment type %s' % mimetype
49
 
+    print('attachment type %s' % mimetype)
50
 
     return mimetype
51
 
 
52
 
 
53
 
 def main(argv):
54
 
     if len(argv) != 2 or argv[1] == '--help':
55
 
-        print __doc__
56
 
+        print(__doc__)
57
 
         return 3
58
 
 
59
 
     try:
60
 
@@ -59,23 +59,23 @@ def main(argv):
61
 
         return 1
62
 
 
63
 
     lp = config.get_launchpad("attach")
64
 
-    print "getting bug %s" % bugnumber
65
 
+    print("getting bug %s" % bugnumber)
66
 
     bug = lp.bugs[bugnumber]
67
 
-    print 'Attaching to %s' % bug
68
 
+    print('Attaching to %s' % bug)
69
 
 
70
 
     attachment_bytes = sys.stdin.read()
71
 
-    print '%d bytes to attach' % len(attachment_bytes)
72
 
+    print('%d bytes to attach' % len(attachment_bytes))
73
 
 
74
 
     mime_type = guess_mime_type(attachment_bytes)
75
 
 
76
 
     # mime type must be specified otherwise
77
 
     # <https://bugs.edge.launchpad.net/malone/+bug/204560> assumes it's
78
 
     # chemical/x-mopac-input
79
 
-    print bug.addAttachment(comment='',
80
 
+    print(bug.addAttachment(comment='',
81
 
         data=attachment_bytes,
82
 
         description='',
83
 
         filename='attachment',
84
 
-        content_type=mime_type)
85
 
+        content_type=mime_type))
86
 
 
87
 
 
88
 
 if __name__ == '__main__':
89
 
Index: lptools-0.2.0/bin/lp-bug-dupe-properties
90
 
===================================================================
91
 
--- lptools-0.2.0.orig/bin/lp-bug-dupe-properties
92
 
+++ lptools-0.2.0/bin/lp-bug-dupe-properties
93
 
@@ -1,4 +1,4 @@
94
 
-#!/usr/bin/python
95
 
+#!/usr/bin/python3
96
 
 #
97
 
 # Copyright (C) 2012, Canonical Ltd.
98
 
 # Written by Brian Murray
99
 
@@ -99,25 +99,25 @@ def main():
100
 
         key = None
101
 
 
102
 
     if bug.number_of_duplicates == 0:
103
 
-        print('LP: #%s has no duplicates!' % bug_number)
104
 
+        print(('LP: #%s has no duplicates!' % bug_number))
105
 
         sys.exit(1)
106
 
 
107
 
     for dupe in bug.duplicates:
108
 
         dupe_num = dupe.id
109
 
         prop = check_duplicate(dupe, search, key)
110
 
-        if prop in dupe_props.keys():
111
 
+        if prop in list(dupe_props.keys()):
112
 
             dupe_props[prop].append(str(dupe_num))
113
 
         else:
114
 
             dupe_props[prop] = [str(dupe_num)]
115
 
 
116
 
     dupe_count = bug.number_of_duplicates
117
 
     if dupe_count > 1:
118
 
-        print('LP: #%s has %s duplicates' % (bug_number, dupe_count))
119
 
+        print(('LP: #%s has %s duplicates' % (bug_number, dupe_count)))
120
 
     elif dupe_count == 1:
121
 
-        print('LP: #%s has %s duplicate' % (bug_number, dupe_count))
122
 
+        print(('LP: #%s has %s duplicate' % (bug_number, dupe_count)))
123
 
 
124
 
     for prop, bugs in sorted(dupe_props.items()):
125
 
-        print('  %s: %s' % (prop, ' '.join(bugs)))
126
 
+        print(('  %s: %s' % (prop, ' '.join(bugs))))
127
 
 
128
 
 
129
 
 if __name__ == '__main__':
130
 
Index: lptools-0.2.0/bin/lp-capture-bug-counts
131
 
===================================================================
132
 
--- lptools-0.2.0.orig/bin/lp-capture-bug-counts
133
 
+++ lptools-0.2.0/bin/lp-capture-bug-counts
134
 
@@ -1,4 +1,4 @@
135
 
-#! /usr/bin/python
136
 
+#! /usr/bin/python3
137
 
 
138
 
 import sys
139
 
 
140
 
@@ -70,10 +70,10 @@ class CannedQuery(object):
141
 
     def show_text(self):
142
 
         # print self.get_name()
143
 
         for category in self.query_categories():
144
 
-            print '%6d %s %s' % (category.count_bugs(),
145
 
+            print('%6d %s %s' % (category.count_bugs(),
146
 
                 category.get_name(),
147
 
-                category.get_link_url() or '')
148
 
-        print
149
 
+                category.get_link_url() or ''))
150
 
+        print()
151
 
 
152
 
 
153
 
 class PatchCannedQuery(CannedQuery):
154
 
@@ -103,7 +103,7 @@ class StatusCannedQuery(CannedQuery):
155
 
             if bugtask.status not in by_status:
156
 
                 by_status[bugtask.status] = StatusBugCategory(bugtask.status)
157
 
             by_status[bugtask.status].add(bugtask)
158
 
-        return by_status.values()
159
 
+        return list(by_status.values())
160
 
 
161
 
 
162
 
 def show_bug_report(project):
163
 
Index: lptools-0.2.0/bin/lp-check-membership
164
 
===================================================================
165
 
--- lptools-0.2.0.orig/bin/lp-check-membership
166
 
+++ lptools-0.2.0/bin/lp-check-membership
167
 
@@ -1,4 +1,4 @@
168
 
-#! /usr/bin/python
169
 
+#! /usr/bin/python3
170
 
 #
171
 
 # Copyright (C) 2009 Canonical Ltd
172
 
 
173
 
@@ -38,7 +38,7 @@ def main(argv):
174
 
     parser = optparse.OptionParser('%prog [options] PERSON GROUP')
175
 
     opts, args = parser.parse_args()
176
 
     if len(args) != 2:
177
 
-        print __doc__
178
 
+        print(__doc__)
179
 
         return 2
180
 
     user_name = args[0]
181
 
     group_name = args[1]
182
 
@@ -46,10 +46,10 @@ def main(argv):
183
 
     user = lp.people[user_name]
184
 
     for user_team in user.super_teams:
185
 
         if user_team.name == group_name:
186
 
-            print '%s is a member of %s' % (user_name, group_name)
187
 
+            print('%s is a member of %s' % (user_name, group_name))
188
 
             return 0
189
 
     else:
190
 
-        print '%s is not a member of %s' % (user_name, group_name)
191
 
+        print('%s is not a member of %s' % (user_name, group_name))
192
 
         return 1
193
 
 
194
 
 
195
 
Index: lptools-0.2.0/bin/lp-force-branch-mirror
196
 
===================================================================
197
 
--- lptools-0.2.0.orig/bin/lp-force-branch-mirror
198
 
+++ lptools-0.2.0/bin/lp-force-branch-mirror
199
 
@@ -1,4 +1,4 @@
200
 
-#! /usr/bin/python
201
 
+#! /usr/bin/python3
202
 
 # vi: expandtab:sts=4
203
 
 
204
 
 # Copyright (C) 2011 Jelmer Vernooij
205
 
@@ -22,12 +22,12 @@ def main(argv):
206
 
 
207
 
     lp = config.get_launchpad("force-branch-mirror")
208
 
     branches = lp.branches.getByUrls(urls=args)
209
 
-    for url, branch_dict in branches.iteritems():
210
 
+    for url, branch_dict in branches.items():
211
 
         if branch_dict is None:
212
 
-            print "Branch %s not found" % url
213
 
+            print("Branch %s not found" % url)
214
 
         else:
215
 
             branch = lp.load(branch_dict["self_link"])
216
 
-            print "%s: %s" % (branch.bzr_identity, branch.requestMirror())
217
 
+            print("%s: %s" % (branch.bzr_identity, branch.requestMirror()))
218
 
 
219
 
 if __name__ == '__main__':
220
 
     sys.exit(main(sys.argv))
221
 
Index: lptools-0.2.0/bin/lp-get-branches
222
 
===================================================================
223
 
--- lptools-0.2.0.orig/bin/lp-get-branches
224
 
+++ lptools-0.2.0/bin/lp-get-branches
225
 
@@ -1,4 +1,4 @@
226
 
-#!/usr/bin/python
227
 
+#!/usr/bin/python3
228
 
 # -*- coding: utf-8 -*-
229
 
 #
230
 
 # Copyright (C) 2007 Canonical Ltd.
231
 
@@ -79,13 +79,13 @@ def main():
232
 
     try:
233
 
         team = launchpad.people[team]
234
 
     except KeyError:
235
 
-        print >> sys.stderr, "E: The team '%s' doesn't exist." % team
236
 
+        print("E: The team '%s' doesn't exist." % team, file=sys.stderr)
237
 
 
238
 
     # Get a list of branches
239
 
     branches = team.getBranches()
240
 
 
241
 
-    print "Downloading all branches for the '%s' team. This may take some " \
242
 
-        "time." % team.display_name
243
 
+    print("Downloading all branches for the '%s' team. This may take some " \
244
 
+        "time." % team.display_name)
245
 
 
246
 
     try:
247
 
         os.makedirs(team.name)
248
 
@@ -101,11 +101,11 @@ def main():
249
 
         os.chdir(project_name)
250
 
 
251
 
         if not os.path.exists(branch.name):
252
 
-            print "Branching %s ..." % branch.display_name
253
 
+            print("Branching %s ..." % branch.display_name)
254
 
             cmd = ["bzr", operation_type, branch.bzr_identity, branch.name]
255
 
             subprocess.call(cmd)
256
 
         else:
257
 
-            print "Merging %s ..." % branch.display_name
258
 
+            print("Merging %s ..." % branch.display_name)
259
 
             os.chdir(branch.name)
260
 
             subprocess.call(["bzr", "merge", "--pull", "--remember"])
261
 
         os.chdir(os.path.join(directory, team.name))
262
 
@@ -117,4 +117,4 @@ if __name__ == "__main__":
263
 
     try:
264
 
         main()
265
 
     except KeyboardInterrupt:
266
 
-        print "Operation was interrupted by user."
267
 
+        print("Operation was interrupted by user.")
268
 
Index: lptools-0.2.0/bin/lp-grab-attachments
269
 
===================================================================
270
 
--- lptools-0.2.0.orig/bin/lp-grab-attachments
271
 
+++ lptools-0.2.0/bin/lp-grab-attachments
272
 
@@ -1,4 +1,4 @@
273
 
-#!/usr/bin/python
274
 
+#!/usr/bin/python3
275
 
 #
276
 
 # Copyright (C) 2007, Canonical Ltd.
277
 
 # Written by Daniel Holbach,
278
 
@@ -36,7 +36,7 @@ def download_attachments(bug, descriptio
279
 
 
280
 
     try:
281
 
         os.mkdir(bug_folder_name)
282
 
-    except OSError, error:
283
 
+    except OSError as error:
284
 
         if error.errno == errno.EEXIST:
285
 
             return
286
 
 
287
 
Index: lptools-0.2.0/bin/lp-list-bugs
288
 
===================================================================
289
 
--- lptools-0.2.0.orig/bin/lp-list-bugs
290
 
+++ lptools-0.2.0/bin/lp-list-bugs
291
 
@@ -1,4 +1,4 @@
292
 
-#! /usr/bin/python
293
 
+#! /usr/bin/python3
294
 
 # -*- coding: UTF-8 -*-
295
 
 """Briefly list status of Launchpad bugs."""
296
 
 
297
 
@@ -42,18 +42,17 @@ def main():
298
 
     for bugnum in args:
299
 
         try:
300
 
             bug = launchpad.bugs[bugnum]
301
 
-            print "Bug %s: %s" % (bugnum, bug.title)
302
 
+            print("Bug %s: %s" % (bugnum, bug.title))
303
 
             for task in bug.bug_tasks:
304
 
-                print "  %s: %s" % (task.bug_target_name, task.status)
305
 
-        except HTTPError, error:
306
 
+                print("  %s: %s" % (task.bug_target_name, task.status))
307
 
+        except HTTPError as error:
308
 
             if error.response.status == 401:
309
 
-                print >> sys.stderr, \
310
 
-                    ("E: Don't have enough permissions to access bug %s" %
311
 
-                     bugnum)
312
 
-                print >> sys.stderr, error.content
313
 
+                print(("E: Don't have enough permissions to access bug %s" %
314
 
+                     bugnum), file=sys.stderr)
315
 
+                print(error.content, file=sys.stderr)
316
 
                 continue
317
 
             elif error.response.status == 404:
318
 
-                print >> sys.stderr, "E: Bug %s not found" % bugnum
319
 
+                print("E: Bug %s not found" % bugnum, file=sys.stderr)
320
 
             else:
321
 
                 raise
322
 
 
323
 
Index: lptools-0.2.0/bin/lp-milestone2ical
324
 
===================================================================
325
 
--- lptools-0.2.0.orig/bin/lp-milestone2ical
326
 
+++ lptools-0.2.0/bin/lp-milestone2ical
327
 
@@ -1,4 +1,4 @@
328
 
-#!/usr/bin/python
329
 
+#!/usr/bin/python3
330
 
 #
331
 
 # Author: Rodney Dawes <rodney.dawes@canonical.com>
332
 
 #
333
 
@@ -16,7 +16,7 @@
334
 
 # You should have received a copy of the GNU General Public License along
335
 
 # with this program.  If not, see <http://www.gnu.org/licenses/>.
336
 
 
337
 
-from __future__ import with_statement
338
 
+
339
 
 
340
 
 import os
341
 
 import sys
342
 
@@ -84,7 +84,7 @@ class MSMain(object):
343
 
         finally:
344
 
             self.__convert_to_ical(lp_project)
345
 
             self.__end_calendar()
346
 
-            print self.calendar()
347
 
+            print(self.calendar())
348
 
 
349
 
     def run(self):
350
 
         self.thread = Thread(target=self.__login_and_go).start()
351
 
@@ -99,7 +99,7 @@ if __name__ == "__main__":
352
 
     try:
353
 
         project = sys.argv[1]
354
 
     except IndexError:
355
 
-        print "Usage: %s <project>" % sys.argv[0]
356
 
+        print("Usage: %s <project>" % sys.argv[0])
357
 
         exit(1)
358
 
 
359
 
     try:
360
 
Index: lptools-0.2.0/bin/lp-milestones
361
 
===================================================================
362
 
--- lptools-0.2.0.orig/bin/lp-milestones
363
 
+++ lptools-0.2.0/bin/lp-milestones
364
 
@@ -1,4 +1,4 @@
365
 
-#!/usr/bin/python
366
 
+#!/usr/bin/python3
367
 
 #
368
 
 # Author: Robert Collins <robert.collins@canonical.com>
369
 
 #
370
 
@@ -74,7 +74,7 @@ class cmd_delete(LaunchpadCommand):
371
 
         m = self.launchpad.load('%s/+milestone/%s' % tuple(components))
372
 
         try:
373
 
             m.delete()
374
 
-        except HTTPError, e:
375
 
+        except HTTPError as e:
376
 
             if e.response.status == 404:
377
 
                 pass
378
 
             elif e.response.status == 500:
379
 
Index: lptools-0.2.0/bin/lp-project
380
 
===================================================================
381
 
--- lptools-0.2.0.orig/bin/lp-project
382
 
+++ lptools-0.2.0/bin/lp-project
383
 
@@ -1,4 +1,4 @@
384
 
-#!/usr/bin/python
385
 
+#!/usr/bin/python3
386
 
 #
387
 
 # Author: Robert Collins <robert.collins@canonical.com>
388
 
 #
389
 
Index: lptools-0.2.0/bin/lp-project-upload
390
 
===================================================================
391
 
--- lptools-0.2.0.orig/bin/lp-project-upload
392
 
+++ lptools-0.2.0/bin/lp-project-upload
393
 
@@ -1,4 +1,4 @@
394
 
-#!/usr/bin/python
395
 
+#!/usr/bin/python3
396
 
 
397
 
 # Copyright (c) 2009 Canonical Ltd.
398
 
 #
399
 
@@ -34,8 +34,8 @@ from lptools import config
400
 
 def create_release(project, version):
401
 
     '''Create new release and milestone for LP project.'''
402
 
 
403
 
-    print 'Release %s could not be found for project. Create it? (Y/n)' % \
404
 
-          version
405
 
+    print('Release %s could not be found for project. Create it? (Y/n)' % \
406
 
+          version)
407
 
     answer = sys.stdin.readline().strip()
408
 
     if answer.startswith('n'):
409
 
         sys.exit(0)
410
 
@@ -46,21 +46,21 @@ def create_release(project, version):
411
 
     elif n_series > 1:
412
 
         msg = 'More than one series exist. Which one would you like to ' \
413
 
               'upload to? Possible series are (listed as index, name):'
414
 
-        print msg
415
 
+        print(msg)
416
 
         for idx, serie in enumerate(project.series):
417
 
-            print '\t%i - %s' % (idx, serie.name)
418
 
-        print 'Enter series index: '
419
 
+            print('\t%i - %s' % (idx, serie.name))
420
 
+        print('Enter series index: ')
421
 
         answer = sys.stdin.readline().strip()
422
 
         try:
423
 
             series = project.series[int(answer)]
424
 
         except (ValueError, IndexError):
425
 
-            print >> sys.stderr, 'The series index is invalid (%s).' % answer
426
 
+            print('The series index is invalid (%s).' % answer, file=sys.stderr)
427
 
             sys.exit(3)
428
 
         else:
429
 
-            print "Using series named '%s'" % series.name
430
 
+            print("Using series named '%s'" % series.name)
431
 
     else:
432
 
-        print >> sys.stderr, ('Does not support creating releases if no '
433
 
-                              'series exists.')
434
 
+        print(('Does not support creating releases if no '
435
 
+                              'series exists.'), file=sys.stderr)
436
 
         sys.exit(3)
437
 
 
438
 
     release_date = datetime.date.today().strftime('%Y-%m-%d')
439
 
@@ -86,9 +86,9 @@ def cat_file(f):
440
 
 
441
 
 def main():
442
 
     if len(sys.argv) < 4 or len(sys.argv) > 7:
443
 
-        print >> sys.stderr, '''Upload a release tarball to a Launchpad project.
444
 
+        print('''Upload a release tarball to a Launchpad project.
445
 
 
446
 
-    Usage: %s <project name> <version> <tarball> [new milestone] [changelog file] [releasenotes file]''' % sys.argv[0]
447
 
+    Usage: %s <project name> <version> <tarball> [new milestone] [changelog file] [releasenotes file]''' % sys.argv[0], file=sys.stderr)
448
 
         sys.exit(1)
449
 
 
450
 
     new_milestone = None
451
 
@@ -127,10 +127,10 @@ def main():
452
 
         # Get the signature, if available.
453
 
         signature = tarball + '.asc'
454
 
         if not os.path.exists(signature):
455
 
-            print 'Calling GPG to create tarball signature...'
456
 
+            print('Calling GPG to create tarball signature...')
457
 
             cmd = ['gpg', '--armor', '--sign', '--detach-sig', tarball]
458
 
             if subprocess.call(cmd) != 0:
459
 
-                print >> sys.stderr, 'gpg failed, aborting'
460
 
+                print('gpg failed, aborting', file=sys.stderr)
461
 
 
462
 
         if os.path.exists(signature):
463
 
             signature_content = open(signature, 'r').read()
464
 
@@ -167,8 +167,8 @@ def main():
465
 
                 if mil.name in [milestone.name for milestone in series.all_milestones]:
466
 
                     series.newMilestone(name=new_milestone)
467
 
 
468
 
-    except HTTPError, error:
469
 
-        print 'An error happened in the upload:', error.content
470
 
+    except HTTPError as error:
471
 
+        print('An error happened in the upload:', error.content)
472
 
         sys.exit(1)
473
 
 
474
 
 if __name__ == '__main__':
475
 
Index: lptools-0.2.0/bin/lp-recipe-status
476
 
===================================================================
477
 
--- lptools-0.2.0.orig/bin/lp-recipe-status
478
 
+++ lptools-0.2.0/bin/lp-recipe-status
479
 
@@ -1,4 +1,4 @@
480
 
-#!/usr/bin/python
481
 
+#!/usr/bin/python3
482
 
 # vi: expandtab:sts=4
483
 
 
484
 
 # Copyright (C) 2011 Jelmer Vernooij <jelmer@samba.org>
485
 
@@ -22,13 +22,13 @@
486
 
 """Show the status of the recipes owned by a particular user.
487
 
 """
488
 
 
489
 
-from cStringIO import StringIO
490
 
+from io import StringIO
491
 
 import gzip
492
 
 import optparse
493
 
 import os
494
 
 import re
495
 
 import sys
496
 
-import urllib
497
 
+import urllib.request, urllib.parse, urllib.error
498
 
 
499
 
 from lptools import config
500
 
 
501
 
@@ -70,7 +70,7 @@ def source_build_find_version(source_bui
502
 
     if cached_version:
503
 
         return tuple(cached_version.split(" "))
504
 
     # FIXME: Find a more efficient way to retrieve the package/version that was built
505
 
-    build_log_gz = urllib.urlopen(source_build.build_log_url)
506
 
+    build_log_gz = urllib.request.urlopen(source_build.build_log_url)
507
 
     build_log = gzip.GzipFile(fileobj=StringIO(build_log_gz.read()))
508
 
     version = None
509
 
     source_name = None
510
 
@@ -172,10 +172,10 @@ def recipe_status_html(launchpad, person
511
 
         last_per_distroseries = gather_per_distroseries_source_builds(recipe)
512
 
         source_builds[recipe.name] = last_per_distroseries
513
 
         relevant_distroseries.update(set(last_per_distroseries))
514
 
-        (sp_success, sp_failures) = filter_source_builds(last_per_distroseries.values())
515
 
+        (sp_success, sp_failures) = filter_source_builds(list(last_per_distroseries.values()))
516
 
         binary_builds[recipe.name] = find_binary_builds(recipe, sp_success)
517
 
         all_binary_builds_ok[recipe.name] = {}
518
 
-        for distroseries, recipe_binary_builds in binary_builds[recipe.name].iteritems():
519
 
+        for distroseries, recipe_binary_builds in binary_builds[recipe.name].items():
520
 
             all_binary_builds_ok[recipe.name][distroseries] = all(
521
 
                 [bb.buildstate == "Successfully built" for bb in recipe_binary_builds])
522
 
     relevant_distroseries = list(relevant_distroseries)
523
 
@@ -201,7 +201,7 @@ def recipe_status_text(recipes, outf):
524
 
     for recipe in recipes:
525
 
         last_per_distroseries = gather_per_distroseries_source_builds(recipe)
526
 
         (sp_success, sp_failures) = filter_source_builds(
527
 
-            last_per_distroseries.values())
528
 
+            list(last_per_distroseries.values()))
529
 
         sp_success_distroseries = [build.distro_series.name for build in sp_success]
530
 
         if sp_failures:
531
 
             outf.write("%s source build failures (%s successful):\n" % (
532
 
Index: lptools-0.2.0/bin/lp-remove-team-members
533
 
===================================================================
534
 
--- lptools-0.2.0.orig/bin/lp-remove-team-members
535
 
+++ lptools-0.2.0/bin/lp-remove-team-members
536
 
@@ -1,4 +1,4 @@
537
 
-#!/usr/bin/python
538
 
+#!/usr/bin/python3
539
 
 #
540
 
 # Copyright 2011 Canonical Ltd.
541
 
 #
542
 
@@ -28,21 +28,21 @@ from lptools.config import (
543
 
 
544
 
 def main(args):
545
 
     if len(args) < 3:
546
 
-        print __doc__
547
 
+        print(__doc__)
548
 
         return 1
549
 
     lp = get_launchpad('lptools on %s' % (socket.gethostname(),))
550
 
     team_name = args[1]
551
 
     team = lp.people[team_name]
552
 
     members_details = team.members_details
553
 
     for exile_name in args[2:]:
554
 
-        print 'remove %s from %s...' % (exile_name, team_name),
555
 
+        print('remove %s from %s...' % (exile_name, team_name), end=' ')
556
 
         for m in members_details:
557
 
             if m.member.name == exile_name:
558
 
                 m.setStatus(status='Deactivated')
559
 
-                print 'done'
560
 
+                print('done')
561
 
                 break
562
 
         else:
563
 
-            print 'not a member?'
564
 
+            print('not a member?')
565
 
                 
566
 
 
567
 
 if __name__ == '__main__':
568
 
Index: lptools-0.2.0/bin/lp-review-list
569
 
===================================================================
570
 
--- lptools-0.2.0.orig/bin/lp-review-list
571
 
+++ lptools-0.2.0/bin/lp-review-list
572
 
@@ -1,4 +1,4 @@
573
 
-#!/usr/bin/python
574
 
+#!/usr/bin/python3
575
 
 #
576
 
 # Author: Rodney Dawes <rodney.dawes@canonical.com>
577
 
 #
578
 
@@ -16,7 +16,7 @@
579
 
 # You should have received a copy of the GNU General Public License along
580
 
 # with this program.  If not, see <http://www.gnu.org/licenses/>.
581
 
 
582
 
-from __future__ import with_statement
583
 
+
584
 
 import re
585
 
 import subprocess
586
 
 from threading import Thread
587
 
@@ -87,7 +87,7 @@ class Window(gtk.Window):
588
 
 
589
 
             self.me = self.launchpad.me
590
 
 
591
 
-            print "Allo, %s" % self.me.name
592
 
+            print("Allo, %s" % self.me.name)
593
 
             gtk.gdk.threads_enter()
594
 
             self.__refresh(None)
595
 
             gtk.gdk.threads_leave()
596
 
@@ -114,18 +114,18 @@ class Window(gtk.Window):
597
 
 
598
 
       def __load_merges(self):
599
 
             merges = []
600
 
-            mine = self.me.getRequestedReviews(status=[u'Needs review'])
601
 
+            mine = self.me.getRequestedReviews(status=['Needs review'])
602
 
             for merge in mine:
603
 
                   merges.append(merge)
604
 
 
605
 
             for team in self.me.super_teams:
606
 
-                  for merge in team.getRequestedReviews(status=[u'Needs review']):
607
 
+                  for merge in team.getRequestedReviews(status=['Needs review']):
608
 
                         if merge not in merges:
609
 
                               merges.append(merge)
610
 
 
611
 
             for merge in merges:
612
 
                   votes = {}
613
 
-                  for key in VOTES.keys():
614
 
+                  for key in list(VOTES.keys()):
615
 
                         votes[key] = 0
616
 
 
617
 
                   for vote in merge.votes:
618
 
@@ -134,14 +134,14 @@ class Window(gtk.Window):
619
 
                         else:
620
 
                               votes[vote.comment.vote] += 1
621
 
 
622
 
-                  for key in votes.keys():
623
 
+                  for key in list(votes.keys()):
624
 
                         if votes[key] == 0:
625
 
                               votes.pop(key, None)
626
 
 
627
 
                   vstr = ", ".join(
628
 
                         ["<span color='%s'>%s</span>: %d" \
629
 
                                % (VOTES[key], key, votes[key]) \
630
 
-                               for key in votes.keys()]
631
 
+                               for key in list(votes.keys())]
632
 
                         )
633
 
                   if vstr == "":
634
 
                         vstr = "No Reviews"
635
 
Index: lptools-0.2.0/bin/lp-review-notifier
636
 
===================================================================
637
 
--- lptools-0.2.0.orig/bin/lp-review-notifier
638
 
+++ lptools-0.2.0/bin/lp-review-notifier
639
 
@@ -1,4 +1,4 @@
640
 
-#!/usr/bin/python
641
 
+#!/usr/bin/python3
642
 
 #
643
 
 # Author: Rodney Dawes <rodney.dawes@canonical.com>
644
 
 #
645
 
@@ -16,7 +16,7 @@
646
 
 # You should have received a copy of the GNU General Public License along
647
 
 # with this program.  If not, see <http://www.gnu.org/licenses/>.
648
 
 
649
 
-from __future__ import with_statement
650
 
+
651
 
 import os
652
 
 import sys
653
 
 
654
 
@@ -25,7 +25,7 @@ import gtk
655
 
 import pygtk
656
 
 import pynotify
657
 
 
658
 
-from ConfigParser import ConfigParser
659
 
+from configparser import ConfigParser
660
 
 import subprocess
661
 
 
662
 
 from xdg.BaseDirectory import (
663
 
@@ -182,7 +182,7 @@ class Main(object):
664
 
         self.config = Preferences()
665
 
 
666
 
         if len(self.config.projects) == 0:
667
 
-            print "No Projects specified"
668
 
+            print("No Projects specified")
669
 
             sys.exit(1)
670
 
 
671
 
         for project in self.config.projects:
672
 
@@ -209,14 +209,14 @@ class Main(object):
673
 
             lp_project = self.launchpad.projects[project]
674
 
             focus = lp_project.development_focus.branch
675
 
         except AttributeError:
676
 
-            print "Project %s has no development focus." % project
677
 
+            print("Project %s has no development focus." % project)
678
 
             return False
679
 
         except KeyError:
680
 
-            print "Project %s not found." % project
681
 
+            print("Project %s not found." % project)
682
 
             return False
683
 
 
684
 
         if not focus:
685
 
-            print "Project %s has no development focus." % project
686
 
+            print("Project %s has no development focus." % project)
687
 
             return False
688
 
 
689
 
         trunk = focus
690
 
@@ -280,7 +280,7 @@ class Main(object):
691
 
                      ICON_NAME)
692
 
             updated = True
693
 
         else:
694
 
-            print "%s status is %s." % (source, c.queue_status)
695
 
+            print("%s status is %s." % (source, c.queue_status))
696
 
 
697
 
         if updated:
698
 
             n.set_urgency(pynotify.URGENCY_LOW)
699
 
Index: lptools-0.2.0/bin/lp-set-dup
700
 
===================================================================
701
 
--- lptools-0.2.0.orig/bin/lp-set-dup
702
 
+++ lptools-0.2.0/bin/lp-set-dup
703
 
@@ -1,4 +1,4 @@
704
 
-#!/usr/bin/python
705
 
+#!/usr/bin/python3
706
 
 # -*- coding: UTF-8 -*-
707
 
 """Sets the "duplicate of" bug of a bug and its dups."""
708
 
 
709
 
@@ -30,7 +30,7 @@ from launchpadlib.errors import HTTPErro
710
 
 from lptools import config
711
 
 
712
 
 def die(message):
713
 
-    print >> sys.stderr, "Fatal: " + message
714
 
+    print("Fatal: " + message, file=sys.stderr)
715
 
     sys.exit(1)
716
 
 
717
 
 def main():
718
 
@@ -57,10 +57,10 @@ def main():
719
 
     # check that the new main bug isn't a duplicate
720
 
     try:
721
 
         new_main_bug = launchpad.bugs[args[0]]
722
 
-    except HTTPError, error:
723
 
+    except HTTPError as error:
724
 
         if error.response.status == 401:
725
 
-            print >> sys.stderr, ("E: Don't have enough permissions to access "
726
 
-                                  "bug %s") % (args[0])
727
 
+            print(("E: Don't have enough permissions to access "
728
 
+                                  "bug %s") % (args[0]), file=sys.stderr)
729
 
             die(error.content)
730
 
         else:
731
 
             raise
732
 
@@ -68,7 +68,7 @@ def main():
733
 
     if new_main_dup_of is not None:
734
 
         answer = None
735
 
         try:
736
 
-            answer = raw_input("Bug %s is a duplicate of %s; would you like to "
737
 
+            answer = input("Bug %s is a duplicate of %s; would you like to "
738
 
                                "use %s as the new main bug instead? [y/N]" % \
739
 
                                (new_main_bug.id, new_main_dup_of.id,
740
 
                                 new_main_dup_of.id))
741
 
@@ -81,38 +81,38 @@ def main():
742
 
     # build list of bugs to process, first the dups then the bug
743
 
     bugs_to_process = []
744
 
     for bug_number in args[1:]:
745
 
-        print "Processing %s" % (bug_number)
746
 
+        print("Processing %s" % (bug_number))
747
 
         try:
748
 
             bug = launchpad.bugs[bug_number]
749
 
-        except HTTPError, error:
750
 
+        except HTTPError as error:
751
 
             if error.response.status == 401:
752
 
-                print >> sys.stderr, ("W: Don't have enough permissions to "
753
 
-                                      "access bug %s") % (bug_number)
754
 
-                print >> sys.stderr, "W: %s" % (error.content)
755
 
+                print(("W: Don't have enough permissions to "
756
 
+                                      "access bug %s") % (bug_number), file=sys.stderr)
757
 
+                print("W: %s" % (error.content), file=sys.stderr)
758
 
                 continue
759
 
             else:
760
 
                 raise
761
 
         dups = bug.duplicates
762
 
         if dups is not None:
763
 
             bugs_to_process.extend(dups)
764
 
-            print "Found %i dups for %s" % (len(dups), bug_number)
765
 
+            print("Found %i dups for %s" % (len(dups), bug_number))
766
 
         bugs_to_process.append(bug)
767
 
 
768
 
     # process dups first, then their main bug
769
 
-    print "Would set the following bugs as duplicates of %s: %s" % \
770
 
-          (new_main_bug.id, " ".join([str(b.id) for b in bugs_to_process]))
771
 
+    print("Would set the following bugs as duplicates of %s: %s" % \
772
 
+          (new_main_bug.id, " ".join([str(b.id) for b in bugs_to_process])))
773
 
 
774
 
     if not options.force:
775
 
         answer = None
776
 
         try:
777
 
-            answer = raw_input("Proceed? [y/N]")
778
 
+            answer = input("Proceed? [y/N]")
779
 
         except:
780
 
             die("Aborted")
781
 
         if answer.lower() not in ("y", "yes"):
782
 
             die("User aborted")
783
 
 
784
 
     for bug in bugs_to_process:
785
 
-        print "Marking bug %s as a duplicate of %s" % (bug.id, new_main_bug.id)
786
 
+        print("Marking bug %s as a duplicate of %s" % (bug.id, new_main_bug.id))
787
 
         bug.duplicate_of = new_main_bug
788
 
         bug.lp_save()
789
 
 
790
 
Index: lptools-0.2.0/bin/lp-shell
791
 
===================================================================
792
 
--- lptools-0.2.0.orig/bin/lp-shell
793
 
+++ lptools-0.2.0/bin/lp-shell
794
 
@@ -1,4 +1,4 @@
795
 
-#!/usr/bin/python
796
 
+#!/usr/bin/python3
797
 
 
798
 
 # Open an interactive launchpadlib Python shell.
799
 
 # It supports all known LP service instances and API versions. The login
800
 
@@ -52,16 +52,16 @@ def main():
801
 
     if len(args) >= 1:
802
 
         try:
803
 
             instance = lookup_service_root(args[0])
804
 
-        except ValueError, err:
805
 
-            print 'E: %s' % (err)
806
 
-            print 'I: Falling back to "production".'
807
 
+        except ValueError as err:
808
 
+            print('E: %s' % (err))
809
 
+            print('I: Falling back to "production".')
810
 
 
811
 
     if len(args) >= 2:
812
 
         if args[1] in valid_api_versions:
813
 
             api_version = args[1]
814
 
         else:
815
 
-            print 'E: "%s" is not a valid LP API version.' % (args[1])
816
 
-            print 'I: Falling back to "1.0".'
817
 
+            print('E: "%s" is not a valid LP API version.' % (args[1]))
818
 
+            print('I: Falling back to "1.0".')
819
 
 
820
 
     if options.anonymous:
821
 
         launchpad = Launchpad.login_anonymously('lp-shell', instance,
822
 
@@ -94,7 +94,7 @@ def main():
823
 
                 sh.set_banner(sh.IP.BANNER + '\n' + banner)
824
 
             sh.excepthook = sys.__excepthook__
825
 
         except ImportError:
826
 
-            print "E: ipython not available. Using normal python shell."
827
 
+            print("E: ipython not available. Using normal python shell.")
828
 
 
829
 
     if sh:
830
 
         sh()
831
 
@@ -106,7 +106,7 @@ def main():
832
 
                 try:
833
 
                     import readline
834
 
                 except ImportError:
835
 
-                    print 'I: readline module not available.'
836
 
+                    print('I: readline module not available.')
837
 
                 else:
838
 
                     import rlcompleter
839
 
                     readline.parse_and_bind("tab: complete")