Merge lp:~vorlon/lpltk/python3 into lp:lpltk

Proposed by Steve Langasek
Status: Merged
Merged at revision: 202
Proposed branch: lp:~vorlon/lpltk/python3
Merge into: lp:lpltk
Diff against target: 726 lines (+127/-118)
33 files modified
debian/changelog (+8/-0)
debian/control (+10/-9)
debian/rules (+1/-1)
lpltk/LaunchpadService.py (+8/-8)
lpltk/attachment.py (+3/-3)
lpltk/attachments.py (+3/-3)
lpltk/bug.py (+9/-9)
lpltk/bug_activity.py (+2/-2)
lpltk/bug_target.py (+1/-1)
lpltk/bug_task.py (+5/-5)
lpltk/bug_tasks.py (+2/-2)
lpltk/bugs.py (+2/-2)
lpltk/debug.py (+5/-5)
lpltk/distribution.py (+7/-7)
lpltk/distribution_source_package.py (+4/-4)
lpltk/distributions.py (+1/-1)
lpltk/distro_series.py (+4/-4)
lpltk/message.py (+2/-2)
lpltk/messages.py (+2/-2)
lpltk/milestone.py (+1/-1)
lpltk/milestones.py (+2/-2)
lpltk/nomination.py (+5/-5)
lpltk/nominations.py (+1/-1)
lpltk/person.py (+2/-2)
lpltk/project.py (+3/-3)
lpltk/project_series.py (+2/-2)
lpltk/projects.py (+1/-1)
lpltk/publication.py (+1/-1)
lpltk/specification.py (+4/-4)
lpltk/specifications.py (+2/-2)
lpltk/tkcollection.py (+5/-5)
lpltk/tkentry.py (+16/-16)
lpltk/utils.py (+3/-3)
To merge this branch: bzr merge lp:~vorlon/lpltk/python3
Reviewer Review Type Date Requested Status
Brian Murray Approve
Brad Figg Pending
Bryce Harrington Pending
Review via email: mp+376292@code.launchpad.net

Description of the change

This is an attempt to move launchpadlib-toolkit to python3 so that the python2 python-launchpadlib binary can be removed from Ubuntu focal. It is incomplete and fails at build time with:

dh_auto_test: Compatibility levels before 9 are deprecated (level 5 in use)
I: pybuild base:217: cd /tmp/python-launchpadlib-toolkit/.pybuild/cpython3_3.8/build; python3.8 -m unittest discover -v
lpltk (unittest.loader._FailedTest) ... ERROR

======================================================================
ERROR: lpltk (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: lpltk
Traceback (most recent call last):
  File "/usr/lib/python3.8/unittest/loader.py", line 470, in _find_test_path
    package = self._get_module_from_name(name)
  File "/usr/lib/python3.8/unittest/loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "/tmp/python-launchpadlib-toolkit/.pybuild/cpython3_3.8/build/lpltk/__init__.py", line 1, in <module>
    from lpltk.LaunchpadService import (LaunchpadService, LaunchpadServiceError)
  File "/tmp/python-launchpadlib-toolkit/.pybuild/cpython3_3.8/build/lpltk/LaunchpadService.py", line 11, in <module>
    from .bug import Bug
  File "/tmp/python-launchpadlib-toolkit/.pybuild/cpython3_3.8/build/lpltk/bug.py", line 8, in <module>
    from .attachments import Attachments
  File "/tmp/python-launchpadlib-toolkit/.pybuild/cpython3_3.8/build/lpltk/attachments.py", line 21, in <module>
    class LocalAttachment(object):
  File "/tmp/python-launchpadlib-toolkit/.pybuild/cpython3_3.8/build/lpltk/attachments.py", line 22, in LocalAttachment
    class Data:
  File "/tmp/python-launchpadlib-toolkit/.pybuild/cpython3_3.8/build/lpltk/attachments.py", line 23, in Data
    class Fd(file):
NameError: name 'file' is not defined

----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)

If someone wants to carry this over the finish line, feel free; in the meantime the python2-only package will be removed from focal.

To post a comment you must log in.
Revision history for this message
Bryce Harrington (bryce) wrote :

I suspect it's fine to drop the python2 package from focal. Adding Brad as a reviewer, he might know more about remaining users of this library.

Glad to see the work towards moving this to python3, certainly going forward anything needing this lib would want python3 support.

Revision history for this message
Brian Murray (brian-murray) wrote :

Thanks for all your work here. I've picked up the ball and carried it over the finish line.

https://bazaar.launchpad.net/~arsenal-devel/lpltk/2.x/revision/202

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2013-01-03 02:59:09 +0000
3+++ debian/changelog 2019-12-03 16:36:05 +0000
4@@ -1,3 +1,11 @@
5+python-launchpadlib-toolkit (2.4) UNRELEASED; urgency=medium
6+
7+ * Move to python3.
8+ * Add missing dep on python3-httplib2.
9+ * Add other build-deps on python modules needed for build-time testing.
10+
11+ -- Steve Langasek <steve.langasek@ubuntu.com> Mon, 02 Dec 2019 22:45:09 -0800
12+
13 python-launchpadlib-toolkit (2.3) raring; urgency=low
14
15 [Brendan Donegan]
16
17=== modified file 'debian/control'
18--- debian/control 2012-05-21 22:24:57 +0000
19+++ debian/control 2019-12-03 16:36:05 +0000
20@@ -4,22 +4,23 @@
21 Maintainer: Arsenal Developers <arsenal-devel@lists.launchpad.net>
22 Build-Depends:
23 debhelper (>= 7.0.50~),
24- python (>= 2.6.6-3~),
25- python-all,
26- python-distutils-extra (>= 2.28),
27+ python3-all,
28+ python3-distutils-extra (>= 2.28),
29+ python3-httplib2,
30+ python3-launchpadlib
31 Standards-Version: 3.9.2
32 Vcs-Bzr: https://code.launchpad.net/~arsenal-devel/lpltk/2.x
33
34-Package: python-launchpadlib-toolkit
35+Package: python3-launchpadlib-toolkit
36 Section: python
37 Architecture: all
38 Depends:
39 ${misc:Depends},
40- ${python:Depends},
41- python (>= 2.4),
42- python-launchpadlib,
43- python-feedparser
44-XB-Python-Version: ${python:Versions}
45+ ${python3:Depends},
46+ python3,
47+ python3-httplib2,
48+ python3-launchpadlib,
49+ python3-feedparser
50 Description: convenience library for launchpadlib
51 Classes to manage credentials and access bug information
52 in Launchpad using the Launchpad API.
53
54=== modified file 'debian/rules'
55--- debian/rules 2012-05-21 22:24:57 +0000
56+++ debian/rules 2019-12-03 16:36:05 +0000
57@@ -1,4 +1,4 @@
58 #!/usr/bin/make -f
59
60 %:
61- dh "$@" --with python2 --buildsystem python_distutils
62+ dh "$@" --with python3 --buildsystem pybuild
63
64=== modified file 'lpltk/LaunchpadService.py'
65--- lpltk/LaunchpadService.py 2013-01-03 02:54:58 +0000
66+++ lpltk/LaunchpadService.py 2019-12-03 16:36:05 +0000
67@@ -7,11 +7,11 @@
68 import launchpadlib
69 from xml.etree.ElementTree import ParseError
70 from launchpadlib.launchpad import *
71-from debug import *
72-from bug import Bug
73-from distributions import Distributions
74-from projects import Projects
75-from person import Person
76+from .debug import *
77+from .bug import Bug
78+from .distributions import Distributions
79+from .projects import Projects
80+from .person import Person
81
82 class LaunchpadServiceError(Exception):
83 """LaunchpadServiceError
84@@ -83,7 +83,7 @@
85 # The config dictionary passed into this method override all config parameters.
86 #
87 if config != None:
88- for k in config.keys():
89+ for k in list(config.keys()):
90 self.config[k] = config[k]
91
92 # So that we can use any change a user may have made via their
93@@ -114,7 +114,7 @@
94 '-'.join(filename_parts))
95
96 if not os.path.exists(self.config['launchpad_creddir']):
97- os.makedirs(self.config['launchpad_creddir'],0700)
98+ os.makedirs(self.config['launchpad_creddir'],0o700)
99
100 self.reset()
101 return
102@@ -232,7 +232,7 @@
103 if os.path.exists(cfg_path):
104 with open(cfg_path, 'r') as f:
105 user_config = json.load(f)
106- for k in user_config.keys():
107+ for k in list(user_config.keys()):
108 self.config[k] = user_config[k]
109
110 #--------------------------------------------------------------------------
111
112=== modified file 'lpltk/attachment.py'
113--- lpltk/attachment.py 2012-07-12 02:57:13 +0000
114+++ lpltk/attachment.py 2019-12-03 16:36:05 +0000
115@@ -1,8 +1,8 @@
116 #!/usr/bin/python
117
118-from message import Message
119+from .message import Message
120 from fnmatch import fnmatch
121-from utils import (
122+from .utils import (
123 o2str,
124 typecheck_Entry
125 )
126@@ -63,7 +63,7 @@
127 return self.__attachment != other.__attachment
128
129 def __find_mimetype(self):
130- for pattern, mimetype in self.MIMETYPES.iteritems():
131+ for pattern, mimetype in self.MIMETYPES.items():
132 if fnmatch(self.title, pattern):
133 return mimetype
134
135
136=== modified file 'lpltk/attachments.py'
137--- lpltk/attachments.py 2010-08-09 19:46:01 +0000
138+++ lpltk/attachments.py 2019-12-03 16:36:05 +0000
139@@ -9,7 +9,7 @@
140 from locale import getpreferredencoding
141 from zipfile import ZipFile
142
143-from attachment import Attachment
144+from .attachment import Attachment
145 from fnmatch import fnmatch
146
147 # Attachments
148@@ -117,7 +117,7 @@
149
150 def __gzip_if_needed(self, attachment):
151 filters = dict(self.__filters)
152- if not filters.has_key(filter_size_between):
153+ if filter_size_between not in filters:
154 return attachment
155
156 minsize, maxsize = filters[filter_size_between]
157@@ -140,7 +140,7 @@
158 return attachment
159
160 def __find_mime_type(self, attachment):
161- for pattern, mimetype in self.MIMETYPES.iteritems():
162+ for pattern, mimetype in self.MIMETYPES.items():
163 if fnmatch(attachment.title, pattern):
164 return mimetype
165
166
167=== modified file 'lpltk/bug.py'
168--- lpltk/bug.py 2013-12-02 17:49:07 +0000
169+++ lpltk/bug.py 2019-12-03 16:36:05 +0000
170@@ -2,17 +2,17 @@
171
172 import re
173 import sys
174-from utils import o2str
175+from .utils import o2str
176 from datetime import datetime
177-from tags import BugTags
178-from attachments import Attachments
179-from person import Person
180-from messages import Messages
181-from nominations import Nominations
182-from bug_activity import Activity
183+from .tags import BugTags
184+from .attachments import Attachments
185+from .person import Person
186+from .messages import Messages
187+from .nominations import Nominations
188+from .bug_activity import Activity
189
190 def fix_time(t):
191- if type(t) is unicode:
192+ if type(t) is str:
193 t = t.split(".")[0]
194 t = t.split("+")[0]
195 return datetime.strptime(t, "%Y-%m-%dT%H:%M:%S")
196@@ -341,7 +341,7 @@
197 # The following import is done here to work around a circular import
198 # issue. bug_tasks imports bug.
199 #
200- from bug_tasks import BugTasks
201+ from .bug_tasks import BugTasks
202
203 return BugTasks(self.service, self.lpbug.bug_tasks_collection)
204
205
206=== modified file 'lpltk/bug_activity.py'
207--- lpltk/bug_activity.py 2011-05-26 22:15:38 +0000
208+++ lpltk/bug_activity.py 2019-12-03 16:36:05 +0000
209@@ -1,7 +1,7 @@
210 #!/usr/bin/python
211
212-from person import Person
213-from utils import (
214+from .person import Person
215+from .utils import (
216 o2str,
217 typecheck_Entry
218 )
219
220=== modified file 'lpltk/bug_target.py'
221--- lpltk/bug_target.py 2011-05-26 22:15:38 +0000
222+++ lpltk/bug_target.py 2019-12-03 16:36:05 +0000
223@@ -1,6 +1,6 @@
224 #!/usr/bin/python
225
226-from utils import typecheck_Entry
227+from .utils import typecheck_Entry
228
229 class BugTarget(object):
230 # __init__
231
232=== modified file 'lpltk/bug_task.py'
233--- lpltk/bug_task.py 2013-10-23 16:31:17 +0000
234+++ lpltk/bug_task.py 2019-12-03 16:36:05 +0000
235@@ -2,10 +2,10 @@
236
237 import datetime
238
239-from person import Person
240-from bug import Bug
241-from milestone import Milestone
242-from utils import (o2str, typecheck_Entry)
243+from .person import Person
244+from .bug import Bug
245+from .milestone import Milestone
246+from .utils import (o2str, typecheck_Entry)
247
248 # BugTask
249 #
250@@ -329,7 +329,7 @@
251 # The following import is done here to work around a circular import
252 # issue. bug_tasks imports bug.
253 #
254- from bug_tasks import BugTasks
255+ from .bug_tasks import BugTasks
256
257 return BugTasks(self.__service, self.lp_bug_task.related_tasks_collection)
258
259
260=== modified file 'lpltk/bug_tasks.py'
261--- lpltk/bug_tasks.py 2012-07-16 19:33:49 +0000
262+++ lpltk/bug_tasks.py 2019-12-03 16:36:05 +0000
263@@ -2,8 +2,8 @@
264
265 import sys
266 from datetime import timedelta, datetime
267-from bug_task import BugTask
268-from utils import (
269+from .bug_task import BugTask
270+from .utils import (
271 typecheck_Collection,
272 typecheck_Entry,
273 )
274
275=== modified file 'lpltk/bugs.py'
276--- lpltk/bugs.py 2012-01-07 02:41:17 +0000
277+++ lpltk/bugs.py 2019-12-03 16:36:05 +0000
278@@ -1,7 +1,7 @@
279 #!/usr/bin/python
280
281-from bug import Bug
282-from utils import typecheck_Collection
283+from .bug import Bug
284+from .utils import typecheck_Collection
285
286 class Bugs(object):
287 # __init__
288
289=== modified file 'lpltk/debug.py'
290--- lpltk/debug.py 2012-07-10 00:02:33 +0000
291+++ lpltk/debug.py 2019-12-03 16:36:05 +0000
292@@ -36,9 +36,9 @@
293 return getattr(StdOut, name)
294
295 def dump_launchpad_object(i):
296- print(repr(i))
297- print(" attr: ", sorted(i.lp_attributes))
298- print(" ops: ", sorted(i.lp_operations))
299- print(" coll: ", sorted(i.lp_collections))
300- print(" entr: ", sorted(i.lp_entries))
301+ print((repr(i)))
302+ print((" attr: ", sorted(i.lp_attributes)))
303+ print((" ops: ", sorted(i.lp_operations)))
304+ print((" coll: ", sorted(i.lp_collections)))
305+ print((" entr: ", sorted(i.lp_entries)))
306 print("\n")
307
308=== modified file 'lpltk/distribution.py'
309--- lpltk/distribution.py 2013-01-03 02:55:37 +0000
310+++ lpltk/distribution.py 2019-12-03 16:36:05 +0000
311@@ -1,12 +1,12 @@
312 #!/usr/bin/python
313
314-from bug_tasks import BugTasks
315-from distribution_source_package import DistributionSourcePackage
316-from distro_series import DistroSeries
317-from milestones import Milestones
318-from person import Person
319-from specification import Specification
320-from utils import typecheck_Entry
321+from .bug_tasks import BugTasks
322+from .distribution_source_package import DistributionSourcePackage
323+from .distro_series import DistroSeries
324+from .milestones import Milestones
325+from .person import Person
326+from .specification import Specification
327+from .utils import typecheck_Entry
328
329 # Distribution
330 #
331
332=== modified file 'lpltk/distribution_source_package.py'
333--- lpltk/distribution_source_package.py 2013-01-31 02:45:52 +0000
334+++ lpltk/distribution_source_package.py 2019-12-03 16:36:05 +0000
335@@ -1,8 +1,8 @@
336 #!/usr/bin/python
337
338-from milestone import Milestone
339-from utils import typecheck_Entry
340-from debug import err
341+from .milestone import Milestone
342+from .utils import typecheck_Entry
343+from .debug import err
344
345 # DistributionSourcePackage
346 #
347@@ -43,7 +43,7 @@
348 # searchTasks
349 #
350 def search_tasks(self, **params):
351- from bug_tasks import BugTasks
352+ from .bug_tasks import BugTasks
353
354 if 'milestone' in params and isinstance(params['milestone'], Milestone):
355 params['milestone'] = params['milestone'].raw
356
357=== modified file 'lpltk/distributions.py'
358--- lpltk/distributions.py 2010-10-04 19:52:37 +0000
359+++ lpltk/distributions.py 2019-12-03 16:36:05 +0000
360@@ -1,6 +1,6 @@
361 #!/usr/bin/python
362
363-from distribution import Distribution
364+from .distribution import Distribution
365
366 class Distributions(object):
367 # __init__
368
369=== modified file 'lpltk/distro_series.py'
370--- lpltk/distro_series.py 2012-11-29 23:24:16 +0000
371+++ lpltk/distro_series.py 2019-12-03 16:36:05 +0000
372@@ -1,12 +1,12 @@
373 #!/usr/bin/python
374
375-from milestones import Milestones
376-from person import Person
377-from utils import (
378+from .milestones import Milestones
379+from .person import Person
380+from .utils import (
381 o2str,
382 typecheck_Entry
383 )
384-from publication import SourcePackagePublication
385+from .publication import SourcePackagePublication
386
387 class DistroSeries(object):
388 # __init__
389
390=== modified file 'lpltk/message.py'
391--- lpltk/message.py 2012-07-12 02:57:13 +0000
392+++ lpltk/message.py 2019-12-03 16:36:05 +0000
393@@ -1,10 +1,10 @@
394 #!/usr/bin/python
395
396-from utils import (
397+from .utils import (
398 o2str,
399 typecheck_Entry
400 )
401-from person import Person
402+from .person import Person
403
404 # Message
405 #
406
407=== modified file 'lpltk/messages.py'
408--- lpltk/messages.py 2012-07-16 23:19:52 +0000
409+++ lpltk/messages.py 2019-12-03 16:36:05 +0000
410@@ -1,6 +1,6 @@
411 #!/usr/bin/python
412
413-from message import Message
414+from .message import Message
415
416 class Messages(object):
417 # __init__
418@@ -85,6 +85,6 @@
419 owners = {}
420 for message in self.__iter__():
421 owners[message.owner.username] = 1
422- return owners.keys()
423+ return list(owners.keys())
424
425 # vi:set ts=4 sw=4 expandtab:
426
427=== modified file 'lpltk/milestone.py'
428--- lpltk/milestone.py 2011-05-26 22:15:38 +0000
429+++ lpltk/milestone.py 2019-12-03 16:36:05 +0000
430@@ -1,6 +1,6 @@
431 #!/usr/bin/python
432
433-from utils import (
434+from .utils import (
435 o2str,
436 typecheck_Entry
437 )
438
439=== modified file 'lpltk/milestones.py'
440--- lpltk/milestones.py 2011-05-27 23:13:49 +0000
441+++ lpltk/milestones.py 2019-12-03 16:36:05 +0000
442@@ -1,7 +1,7 @@
443 #!/usr/bin/python
444
445-from milestone import Milestone
446-from utils import typecheck_Collection
447+from .milestone import Milestone
448+from .utils import typecheck_Collection
449
450 class Milestones(object):
451 # __init__
452
453=== modified file 'lpltk/nomination.py'
454--- lpltk/nomination.py 2011-05-26 22:15:38 +0000
455+++ lpltk/nomination.py 2019-12-03 16:36:05 +0000
456@@ -1,10 +1,10 @@
457 #!/usr/bin/python
458
459-from person import Person
460-from project_series import ProjectSeries
461-from distro_series import DistroSeries
462-from bug_target import BugTarget
463-from utils import typecheck_Entry
464+from .person import Person
465+from .project_series import ProjectSeries
466+from .distro_series import DistroSeries
467+from .bug_target import BugTarget
468+from .utils import typecheck_Entry
469
470 class Nomination(object):
471 # __init__
472
473=== modified file 'lpltk/nominations.py'
474--- lpltk/nominations.py 2010-10-08 21:53:17 +0000
475+++ lpltk/nominations.py 2019-12-03 16:36:05 +0000
476@@ -1,6 +1,6 @@
477 #!/usr/bin/python
478
479-from nomination import Nomination
480+from .nomination import Nomination
481
482 class Nominations(object):
483 # __init__
484
485=== modified file 'lpltk/person.py'
486--- lpltk/person.py 2012-11-29 23:22:34 +0000
487+++ lpltk/person.py 2019-12-03 16:36:05 +0000
488@@ -1,6 +1,6 @@
489 #!/usr/bin/python
490
491-from utils import (
492+from .utils import (
493 o2str,
494 typecheck_Entry
495 )
496@@ -107,7 +107,7 @@
497 #
498 @property
499 def subscribed_packages(self):
500- from distribution_source_package import DistributionSourcePackage
501+ from .distribution_source_package import DistributionSourcePackage
502
503 for pkg in self.__person.getBugSubscriberPackages():
504 yield DistributionSourcePackage(self.__service, pkg)
505
506=== modified file 'lpltk/project.py'
507--- lpltk/project.py 2011-08-01 23:18:12 +0000
508+++ lpltk/project.py 2019-12-03 16:36:05 +0000
509@@ -1,8 +1,8 @@
510 #!/usr/bin/python
511
512-from person import Person
513-from bug_tasks import BugTasks
514-from utils import typecheck_Entry
515+from .person import Person
516+from .bug_tasks import BugTasks
517+from .utils import typecheck_Entry
518
519 # Project
520 #
521
522=== modified file 'lpltk/project_series.py'
523--- lpltk/project_series.py 2011-06-07 00:36:55 +0000
524+++ lpltk/project_series.py 2019-12-03 16:36:05 +0000
525@@ -1,7 +1,7 @@
526 #!/usr/bin/python
527
528-from person import Person
529-from utils import (o2str, typecheck_Entry)
530+from .person import Person
531+from .utils import (o2str, typecheck_Entry)
532
533 class ProjectSeries(object):
534 # __init__
535
536=== modified file 'lpltk/projects.py'
537--- lpltk/projects.py 2010-10-04 19:52:37 +0000
538+++ lpltk/projects.py 2019-12-03 16:36:05 +0000
539@@ -1,6 +1,6 @@
540 #!/usr/bin/python
541
542-from project import Project
543+from .project import Project
544
545 class Projects(object):
546 # __init__
547
548=== modified file 'lpltk/publication.py'
549--- lpltk/publication.py 2013-01-03 02:56:09 +0000
550+++ lpltk/publication.py 2019-12-03 16:36:05 +0000
551@@ -1,6 +1,6 @@
552 #!/usr/bin/python
553
554-from utils import (typecheck_Entry, o2str)
555+from .utils import (typecheck_Entry, o2str)
556
557 class SourcePackagePublication(object):
558 def __init__(self, lp_publication):
559
560=== modified file 'lpltk/specification.py'
561--- lpltk/specification.py 2012-01-07 02:41:17 +0000
562+++ lpltk/specification.py 2019-12-03 16:36:05 +0000
563@@ -1,8 +1,8 @@
564 #!/usr/bin/python
565
566-from person import Person
567-from bugs import Bugs
568-from utils import (
569+from .person import Person
570+from .bugs import Bugs
571+from .utils import (
572 o2str,
573 typecheck_Entry
574 )
575@@ -193,7 +193,7 @@
576 def dependencies(self):
577 if self.__dependencies == None:
578 # Work around circular dependencies
579- from specifications import Specifications
580+ from .specifications import Specifications
581
582 self.__dependencies = Specifications(self.__service,
583 self.__lp_specification.dependencies_collection)
584
585=== modified file 'lpltk/specifications.py'
586--- lpltk/specifications.py 2012-01-07 02:41:17 +0000
587+++ lpltk/specifications.py 2019-12-03 16:36:05 +0000
588@@ -1,7 +1,7 @@
589 #!/usr/bin/python
590
591-from specification import Specification
592-from utils import typecheck_Collection
593+from .specification import Specification
594+from .utils import typecheck_Collection
595
596
597 class Specifications(object):
598
599=== modified file 'lpltk/tkcollection.py'
600--- lpltk/tkcollection.py 2012-07-20 20:43:59 +0000
601+++ lpltk/tkcollection.py 2019-12-03 16:36:05 +0000
602@@ -1,6 +1,6 @@
603 #!/usr/bin/python
604
605-from utils import typecheck_Collection
606+from .utils import typecheck_Collection
607
608 class TKCollection(object):
609 def __init__(self, tk_type, service, lp_objects=None):
610@@ -46,7 +46,7 @@
611
612 if __name__ == "__main__":
613 from lpltk import LaunchpadService
614- from distribution import Distribution
615+ from .distribution import Distribution
616
617 class MyDists(Collection):
618 def __init__(self, lp):
619@@ -58,10 +58,10 @@
620 lp = LaunchpadService(config={'read_only':True})
621 objects = MyDists(lp)
622 for obj in objects:
623- print obj.display_name,
624+ print(obj.display_name, end=' ')
625 if obj.current_series:
626- print obj.current_series.name
627+ print(obj.current_series.name)
628 else:
629- print "<no series>"
630+ print("<no series>")
631
632 # vi:set ts=4 sw=4 expandtab:
633
634=== modified file 'lpltk/tkentry.py'
635--- lpltk/tkentry.py 2012-07-20 20:43:24 +0000
636+++ lpltk/tkentry.py 2019-12-03 16:36:05 +0000
637@@ -10,18 +10,18 @@
638
639 # Entry types
640 if lpclass == 'team':
641- from person import Person
642+ from .person import Person
643 return Person(None, obj)
644 elif lpclass == 'distro_series':
645- from distro_series import DistroSeries
646+ from .distro_series import DistroSeries
647 return DistroSeries(service, None, obj)
648
649 # Collection types
650 elif lpclass == 'milestone-page-resource':
651- from milestones import Milestones
652+ from .milestones import Milestones
653 return Milestones(service, obj)
654 elif lpclass == 'specification-page-resource':
655- from specifications import Specifications
656+ from .specifications import Specifications
657 return Specifications(service, obj)
658
659 return None
660@@ -45,7 +45,7 @@
661 def __getattr__(self, attr_name):
662 if attr_name[0] != '_':
663 assert(self._lp_entry is not None)
664- assert("_"+attr_name in self.__dict__.keys())
665+ assert("_"+attr_name in list(self.__dict__.keys()))
666 if self.__dict__["_"+attr_name] is None:
667 obj = self._lp_entry.__getattr__(attr_name)
668 self.__dict__["_"+attr_name] = lp_to_tk(self._service, obj)
669@@ -67,15 +67,15 @@
670 lp_distro = lp.launchpad.distributions['ubuntu']
671
672 obj = Distribution(lp, lp_distro)
673- print "Name:", obj.display_name
674- print "Owner:", obj.owner
675- print "Driver:", obj.driver
676- print "Registrant:", obj.registrant
677- print "Current:", obj.current_series
678- print "Date Created:", obj.date_created
679- print "Active Milestones:", obj.active_milestones
680- print "All Milestones:", obj.all_milestones
681- print "All Specifications:", obj.all_specifications
682- print "Valid Specifications:", obj.valid_specifications
683- print "Calculated:", obj.my_function()
684+ print("Name:", obj.display_name)
685+ print("Owner:", obj.owner)
686+ print("Driver:", obj.driver)
687+ print("Registrant:", obj.registrant)
688+ print("Current:", obj.current_series)
689+ print("Date Created:", obj.date_created)
690+ print("Active Milestones:", obj.active_milestones)
691+ print("All Milestones:", obj.all_milestones)
692+ print("All Specifications:", obj.all_specifications)
693+ print("Valid Specifications:", obj.valid_specifications)
694+ print("Calculated:", obj.my_function())
695
696
697=== modified file 'lpltk/utils.py'
698--- lpltk/utils.py 2012-03-07 20:07:23 +0000
699+++ lpltk/utils.py 2019-12-03 16:36:05 +0000
700@@ -15,7 +15,7 @@
701 retval = None
702 if type(obj) == str:
703 return obj
704- elif type(obj) == unicode:
705+ elif type(obj) == str:
706 return obj.encode('ascii', 'ignore')
707 elif type(obj) == Decimal:
708 return str(obj)
709@@ -36,7 +36,7 @@
710 #
711 def typecheck_Collection(obj):
712 if type(obj) != Collection:
713- raise TypeError, "Object is of type %s, but must be Launchpad Collection object" %(type(obj))
714+ raise TypeError("Object is of type %s, but must be Launchpad Collection object" %(type(obj)))
715 return obj
716
717 # typecheck_Entry
718@@ -45,7 +45,7 @@
719 #
720 def typecheck_Entry(obj):
721 if type(obj) != Entry:
722- raise TypeError, "Object is of type %s, but must be Launchpad Entry object" %(type(obj))
723+ raise TypeError("Object is of type %s, but must be Launchpad Entry object" %(type(obj)))
724 return obj
725
726 # vi:set ts=4 sw=4 expandtab:

Subscribers

People subscribed via source and target branches