Merge ~cjwatson/launchpad:snappy-future-imports into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 941573e977e872cf5486819b6e6012def056b95e
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:snappy-future-imports
Merge into: launchpad:master
Diff against target: 415 lines (+68/-38)
15 files modified
lib/lp/snappy/browser/hassnaps.py (+2/-0)
lib/lp/snappy/browser/snap.py (+29/-27)
lib/lp/snappy/browser/snapbuild.py (+2/-0)
lib/lp/snappy/browser/snaplisting.py (+2/-0)
lib/lp/snappy/browser/widgets/snaparchive.py (+3/-1)
lib/lp/snappy/browser/widgets/storechannels.py (+5/-3)
lib/lp/snappy/interfaces/snap.py (+8/-6)
lib/lp/snappy/interfaces/snapbuild.py (+2/-0)
lib/lp/snappy/interfaces/webservice.py (+2/-0)
lib/lp/snappy/mail/snapbuild.py (+2/-0)
lib/lp/snappy/model/snap.py (+2/-0)
lib/lp/snappy/model/snapbuild.py (+2/-0)
lib/lp/snappy/model/snapbuildbehaviour.py (+3/-1)
lib/lp/snappy/validators/channels.py (+2/-0)
lib/lp/snappy/vocabularies.py (+2/-0)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Kristian Glass (community) Approve
Review via email: mp+373696@code.launchpad.net

Commit message

Convert lp.snappy to preferred __future__ imports

To post a comment you must log in.
Revision history for this message
Kristian Glass (doismellburning) :
review: Approve
Revision history for this message
Otto Co-Pilot (otto-copilot) wrote :
Revision history for this message
Colin Watson (cjwatson) wrote :

Self-approving to work around incorrect repository reviewer (which I've now fixed).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/snappy/browser/hassnaps.py b/lib/lp/snappy/browser/hassnaps.py
2index 2e2d1b0..9fa983d 100644
3--- a/lib/lp/snappy/browser/hassnaps.py
4+++ b/lib/lp/snappy/browser/hassnaps.py
5@@ -3,6 +3,8 @@
6
7 """Mixins for browser classes for objects that implement IHasSnaps."""
8
9+from __future__ import absolute_import, print_function, unicode_literals
10+
11 __metaclass__ = type
12 __all__ = [
13 'HasSnapsMenuMixin',
14diff --git a/lib/lp/snappy/browser/snap.py b/lib/lp/snappy/browser/snap.py
15index 557adfe..2461b29 100644
16--- a/lib/lp/snappy/browser/snap.py
17+++ b/lib/lp/snappy/browser/snap.py
18@@ -3,6 +3,8 @@
19
20 """Snap views."""
21
22+from __future__ import absolute_import, print_function, unicode_literals
23+
24 __metaclass__ = type
25 __all__ = [
26 'SnapAddView',
27@@ -266,21 +268,21 @@ class SnapRequestBuildsView(LaunchpadFormView):
28 class schema(Interface):
29 """Schema for requesting a build."""
30
31- archive = Reference(IArchive, title=u'Source archive', required=True)
32+ archive = Reference(IArchive, title='Source archive', required=True)
33 distro_arch_series = List(
34 Choice(vocabulary='SnapDistroArchSeries'),
35- title=u'Architectures', required=True,
36+ title='Architectures', required=True,
37 description=(
38- u'If you do not explicitly select any architectures, then '
39- u'the snap package will be built for all architectures '
40- u'allowed by its configuration.'))
41+ 'If you do not explicitly select any architectures, then the '
42+ 'snap package will be built for all architectures allowed by '
43+ 'its configuration.'))
44 pocket = Choice(
45- title=u'Pocket', vocabulary=PackagePublishingPocket, required=True,
46+ title='Pocket', vocabulary=PackagePublishingPocket, required=True,
47 description=(
48- u'The package stream within the source distribution series '
49- u'to use when building the snap package.'))
50+ 'The package stream within the source distribution series to '
51+ 'use when building the snap package.'))
52 channels = Dict(
53- title=u'Source snap channels', key_type=TextLine(), required=True,
54+ title='Source snap channels', key_type=TextLine(), required=True,
55 description=ISnap['auto_build_channels'].description)
56
57 custom_widget_archive = SnapArchiveWidget
58@@ -289,7 +291,7 @@ class SnapRequestBuildsView(LaunchpadFormView):
59 custom_widget_channels = SnapBuildChannelsWidget
60
61 help_links = {
62- "pocket": u"/+help-snappy/snap-build-pocket.html",
63+ "pocket": "/+help-snappy/snap-build-pocket.html",
64 }
65
66 @property
67@@ -343,8 +345,8 @@ class ISnapEditSchema(Interface):
68 ])
69 store_distro_series = Choice(
70 vocabulary='BuildableSnappyDistroSeries', required=True,
71- title=u'Series')
72- vcs = Choice(vocabulary=VCSType, required=True, title=u'VCS')
73+ title='Series')
74+ vcs = Choice(vocabulary=VCSType, required=True, title='VCS')
75
76 # Each of these is only required if vcs has an appropriate value. Later
77 # validation takes care of adjusting the required attribute.
78@@ -408,7 +410,7 @@ class SnapAddView(
79 custom_widget_store_channels = StoreChannelsWidget
80
81 help_links = {
82- "auto_build_pocket": u"/+help-snappy/snap-build-pocket.html",
83+ "auto_build_pocket": "/+help-snappy/snap-build-pocket.html",
84 }
85
86 def initialize(self):
87@@ -427,9 +429,9 @@ class SnapAddView(
88 super(SnapAddView, self).setUpFields()
89 self.form_fields += self.createEnabledProcessors(
90 getUtility(IProcessorSet).getAll(),
91- u"The architectures that this snap package builds for. Some "
92- u"architectures are restricted and may only be enabled or "
93- u"disabled by administrators.")
94+ "The architectures that this snap package builds for. Some "
95+ "architectures are restricted and may only be enabled or "
96+ "disabled by administrators.")
97
98 def setUpWidgets(self):
99 """See `LaunchpadFormView`."""
100@@ -608,19 +610,19 @@ class BaseSnapEditView(LaunchpadEditFormView, SnapAuthorizeMixin):
101 if owner is not None and owner.private:
102 self.setFieldError(
103 'private' if 'private' in data else 'owner',
104- u'A public snap cannot have a private owner.')
105+ 'A public snap cannot have a private owner.')
106 if 'private' in data or 'branch' in data:
107 branch = data.get('branch', self.context.branch)
108 if branch is not None and branch.private:
109 self.setFieldError(
110 'private' if 'private' in data else 'branch',
111- u'A public snap cannot have a private branch.')
112+ 'A public snap cannot have a private branch.')
113 if 'private' in data or 'git_ref' in data:
114 ref = data.get('git_ref', self.context.git_ref)
115 if ref is not None and ref.private:
116 self.setFieldError(
117 'private' if 'private' in data else 'git_ref',
118- u'A public snap cannot have a private repository.')
119+ 'A public snap cannot have a private repository.')
120
121 def _needStoreReauth(self, data):
122 """Does this change require reauthorizing to the store?"""
123@@ -696,7 +698,7 @@ class SnapAdminView(BaseSnapEditView):
124 if not getFeatureFlag(SNAP_PRIVATE_FEATURE_FLAG):
125 self.setFieldError(
126 'private',
127- u'You do not have permission to create private snaps.')
128+ 'You do not have permission to create private snaps.')
129
130
131 class SnapEditView(BaseSnapEditView, EnableProcessorsMixin):
132@@ -734,7 +736,7 @@ class SnapEditView(BaseSnapEditView, EnableProcessorsMixin):
133 custom_widget_store_channels = StoreChannelsWidget
134
135 help_links = {
136- "auto_build_pocket": u"/+help-snappy/snap-build-pocket.html",
137+ "auto_build_pocket": "/+help-snappy/snap-build-pocket.html",
138 }
139
140 def setUpFields(self):
141@@ -742,9 +744,9 @@ class SnapEditView(BaseSnapEditView, EnableProcessorsMixin):
142 super(SnapEditView, self).setUpFields()
143 self.form_fields += self.createEnabledProcessors(
144 self.context.available_processors,
145- u"The architectures that this snap package builds for. Some "
146- u"architectures are restricted and may only be enabled or "
147- u"disabled by administrators.")
148+ "The architectures that this snap package builds for. Some "
149+ "architectures are restricted and may only be enabled or "
150+ "disabled by administrators.")
151
152 @property
153 def initial_values(self):
154@@ -804,7 +806,7 @@ class SnapAuthorizeView(LaunchpadEditFormView):
155 """Schema for authorizing snap package uploads to the store."""
156
157 discharge_macaroon = TextLine(
158- title=u'Serialized discharge macaroon', required=True)
159+ title='Serialized discharge macaroon', required=True)
160
161 render_context = False
162
163@@ -842,13 +844,13 @@ class SnapAuthorizeView(LaunchpadEditFormView):
164 def complete_action(self, action, data):
165 if not data.get('discharge_macaroon'):
166 self.addError(structured(
167- _(u'Uploads of %(snap)s to the store were not authorized.'),
168+ _('Uploads of %(snap)s to the store were not authorized.'),
169 snap=self.context.name))
170 return
171 self.context.completeAuthorization(
172 discharge_macaroon=data['discharge_macaroon'])
173 self.request.response.addInfoNotification(structured(
174- _(u'Uploads of %(snap)s to the store are now authorized.'),
175+ _('Uploads of %(snap)s to the store are now authorized.'),
176 snap=self.context.name))
177 self.request.response.redirect(canonical_url(self.context))
178
179diff --git a/lib/lp/snappy/browser/snapbuild.py b/lib/lp/snappy/browser/snapbuild.py
180index 190d07c..a485afd 100644
181--- a/lib/lp/snappy/browser/snapbuild.py
182+++ b/lib/lp/snappy/browser/snapbuild.py
183@@ -3,6 +3,8 @@
184
185 """SnapBuild views."""
186
187+from __future__ import absolute_import, print_function, unicode_literals
188+
189 __metaclass__ = type
190 __all__ = [
191 'SnapBuildContextMenu',
192diff --git a/lib/lp/snappy/browser/snaplisting.py b/lib/lp/snappy/browser/snaplisting.py
193index 608bece..e59fd29 100644
194--- a/lib/lp/snappy/browser/snaplisting.py
195+++ b/lib/lp/snappy/browser/snaplisting.py
196@@ -3,6 +3,8 @@
197
198 """Base class view for snap listings."""
199
200+from __future__ import absolute_import, print_function, unicode_literals
201+
202 __metaclass__ = type
203
204 __all__ = [
205diff --git a/lib/lp/snappy/browser/widgets/snaparchive.py b/lib/lp/snappy/browser/widgets/snaparchive.py
206index 441013f..e138664 100644
207--- a/lib/lp/snappy/browser/widgets/snaparchive.py
208+++ b/lib/lp/snappy/browser/widgets/snaparchive.py
209@@ -1,6 +1,8 @@
210 # Copyright 2015-2019 Canonical Ltd. This software is licensed under the
211 # GNU Affero General Public License version 3 (see the file LICENSE).
212
213+from __future__ import absolute_import, print_function, unicode_literals
214+
215 __metaclass__ = type
216
217 __all__ = [
218@@ -48,7 +50,7 @@ class SnapArchiveWidget(BrowserWidget, InputWidget):
219 return
220 fields = [
221 Choice(
222- __name__="ppa", title=u"PPA", required=True, vocabulary="PPA"),
223+ __name__="ppa", title="PPA", required=True, vocabulary="PPA"),
224 ]
225 for field in fields:
226 setUpWidget(
227diff --git a/lib/lp/snappy/browser/widgets/storechannels.py b/lib/lp/snappy/browser/widgets/storechannels.py
228index b7e84db..2d4d665 100644
229--- a/lib/lp/snappy/browser/widgets/storechannels.py
230+++ b/lib/lp/snappy/browser/widgets/storechannels.py
231@@ -1,6 +1,8 @@
232 # Copyright 2017-2018 Canonical Ltd. This software is licensed under the
233 # GNU Affero General Public License version 3 (see the file LICENSE).
234
235+from __future__ import absolute_import, print_function, unicode_literals
236+
237 __metaclass__ = type
238
239 __all__ = [
240@@ -59,17 +61,17 @@ class StoreChannelsWidget(BrowserWidget, InputWidget):
241 return
242 fields = [
243 TextLine(
244- __name__="track", title=u"Track", required=False,
245+ __name__="track", title="Track", required=False,
246 description=_(
247 "Track defines a series for your software. "
248 "If not specified, the default track ('latest') is "
249 "assumed.")),
250 List(
251- __name__="risks", title=u"Risk", required=False,
252+ __name__="risks", title="Risk", required=False,
253 value_type=Choice(vocabulary="SnapStoreChannel"),
254 description=_("Risks denote the stability of your software.")),
255 TextLine(
256- __name__="branch", title=u"Branch", required=False,
257+ __name__="branch", title="Branch", required=False,
258 description=_(
259 "Branches provide users with an easy way to test bug "
260 "fixes. They are temporary and created on demand. If "
261diff --git a/lib/lp/snappy/interfaces/snap.py b/lib/lp/snappy/interfaces/snap.py
262index 4471b79..70626c9 100644
263--- a/lib/lp/snappy/interfaces/snap.py
264+++ b/lib/lp/snappy/interfaces/snap.py
265@@ -3,6 +3,8 @@
266
267 """Snap package interfaces."""
268
269+from __future__ import absolute_import, print_function, unicode_literals
270+
271 __metaclass__ = type
272
273 __all__ = [
274@@ -112,14 +114,14 @@ from lp.soyuz.interfaces.archive import IArchive
275 from lp.soyuz.interfaces.distroarchseries import IDistroArchSeries
276
277
278-SNAP_PRIVATE_FEATURE_FLAG = u"snap.allow_private"
279-SNAP_SNAPCRAFT_CHANNEL_FEATURE_FLAG = u"snap.channels.snapcraft"
280-SNAP_WEBHOOKS_FEATURE_FLAG = u"snap.webhooks.enabled"
281+SNAP_PRIVATE_FEATURE_FLAG = "snap.allow_private"
282+SNAP_SNAPCRAFT_CHANNEL_FEATURE_FLAG = "snap.channels.snapcraft"
283+SNAP_WEBHOOKS_FEATURE_FLAG = "snap.webhooks.enabled"
284
285
286 SNAP_TESTING_FLAGS = {
287- SNAP_PRIVATE_FEATURE_FLAG: u"on",
288- SNAP_WEBHOOKS_FEATURE_FLAG: u"on",
289+ SNAP_PRIVATE_FEATURE_FLAG: "on",
290+ SNAP_WEBHOOKS_FEATURE_FLAG: "on",
291 }
292
293
294@@ -330,7 +332,7 @@ class ISnapBuildRequest(Interface):
295
296 archive = Reference(
297 IArchive,
298- title=u"The source archive for builds produced by this request",
299+ title="The source archive for builds produced by this request",
300 required=True, readonly=True)
301
302 channels = Dict(
303diff --git a/lib/lp/snappy/interfaces/snapbuild.py b/lib/lp/snappy/interfaces/snapbuild.py
304index 3eaaae8..fdd9c86 100644
305--- a/lib/lp/snappy/interfaces/snapbuild.py
306+++ b/lib/lp/snappy/interfaces/snapbuild.py
307@@ -3,6 +3,8 @@
308
309 """Snap package build interfaces."""
310
311+from __future__ import absolute_import, print_function, unicode_literals
312+
313 __metaclass__ = type
314
315 __all__ = [
316diff --git a/lib/lp/snappy/interfaces/webservice.py b/lib/lp/snappy/interfaces/webservice.py
317index 30def61..b978965 100644
318--- a/lib/lp/snappy/interfaces/webservice.py
319+++ b/lib/lp/snappy/interfaces/webservice.py
320@@ -9,6 +9,8 @@ There is a declaration in ZCML somewhere that looks like:
321 which tells `lazr.restful` that it should look for webservice exports here.
322 """
323
324+from __future__ import absolute_import, print_function, unicode_literals
325+
326 __all__ = [
327 'ISnap',
328 'ISnapBase',
329diff --git a/lib/lp/snappy/mail/snapbuild.py b/lib/lp/snappy/mail/snapbuild.py
330index fa85a34..1f36e75 100644
331--- a/lib/lp/snappy/mail/snapbuild.py
332+++ b/lib/lp/snappy/mail/snapbuild.py
333@@ -1,6 +1,8 @@
334 # Copyright 2015-2017 Canonical Ltd. This software is licensed under the
335 # GNU Affero General Public License version 3 (see the file LICENSE).
336
337+from __future__ import absolute_import, print_function, unicode_literals
338+
339 __metaclass__ = type
340 __all__ = [
341 'SnapBuildMailer',
342diff --git a/lib/lp/snappy/model/snap.py b/lib/lp/snappy/model/snap.py
343index 681b735..18eee6e 100644
344--- a/lib/lp/snappy/model/snap.py
345+++ b/lib/lp/snappy/model/snap.py
346@@ -1,6 +1,8 @@
347 # Copyright 2015-2019 Canonical Ltd. This software is licensed under the
348 # GNU Affero General Public License version 3 (see the file LICENSE).
349
350+from __future__ import absolute_import, print_function, unicode_literals
351+
352 __metaclass__ = type
353 __all__ = [
354 'Snap',
355diff --git a/lib/lp/snappy/model/snapbuild.py b/lib/lp/snappy/model/snapbuild.py
356index f21d4c7..0415c66 100644
357--- a/lib/lp/snappy/model/snapbuild.py
358+++ b/lib/lp/snappy/model/snapbuild.py
359@@ -1,6 +1,8 @@
360 # Copyright 2015-2019 Canonical Ltd. This software is licensed under the
361 # GNU Affero General Public License version 3 (see the file LICENSE).
362
363+from __future__ import absolute_import, print_function, unicode_literals
364+
365 __metaclass__ = type
366 __all__ = [
367 'SnapBuild',
368diff --git a/lib/lp/snappy/model/snapbuildbehaviour.py b/lib/lp/snappy/model/snapbuildbehaviour.py
369index 8e61925..cda3cff 100644
370--- a/lib/lp/snappy/model/snapbuildbehaviour.py
371+++ b/lib/lp/snappy/model/snapbuildbehaviour.py
372@@ -6,6 +6,8 @@
373 Dispatches snap package build jobs to build-farm slaves.
374 """
375
376+from __future__ import absolute_import, print_function, unicode_literals
377+
378 __metaclass__ = type
379 __all__ = [
380 'SnapBuildBehaviour',
381@@ -169,7 +171,7 @@ class SnapBuildBehaviour(BuildFarmJobBehaviourBase):
382 # "git clone -b" doesn't accept full ref names. If this becomes
383 # a problem then we could change launchpad-buildd to do "git
384 # clone" followed by "git checkout" instead.
385- if build.snap.git_path != u"HEAD":
386+ if build.snap.git_path != "HEAD":
387 args["git_path"] = build.snap.git_ref.name
388 else:
389 raise CannotBuild(
390diff --git a/lib/lp/snappy/validators/channels.py b/lib/lp/snappy/validators/channels.py
391index f6ed93e..f091857 100644
392--- a/lib/lp/snappy/validators/channels.py
393+++ b/lib/lp/snappy/validators/channels.py
394@@ -3,6 +3,8 @@
395
396 """Validators for the .store_channels attribute."""
397
398+from __future__ import absolute_import, print_function, unicode_literals
399+
400 __metaclass__ = type
401
402 from zope.schema.vocabulary import getVocabularyRegistry
403diff --git a/lib/lp/snappy/vocabularies.py b/lib/lp/snappy/vocabularies.py
404index 61e5872..331088a 100644
405--- a/lib/lp/snappy/vocabularies.py
406+++ b/lib/lp/snappy/vocabularies.py
407@@ -3,6 +3,8 @@
408
409 """Snappy vocabularies."""
410
411+from __future__ import absolute_import, print_function, unicode_literals
412+
413 __metaclass__ = type
414
415 __all__ = [

Subscribers

People subscribed via source and target branches

to status/vote changes: