Merge ~cjwatson/launchpad:avoid-defer-returnValue into launchpad:master
- Git
- lp:~cjwatson/launchpad
- avoid-defer-returnValue
- Merge into master
Proposed by
Colin Watson
Status: | Merged |
---|---|
Approved by: | Colin Watson |
Approved revision: | e7253f943783a433ede4b45ee6015e068b2d268a |
Merge reported by: | Otto Co-Pilot |
Merged at revision: | not available |
Proposed branch: | ~cjwatson/launchpad:avoid-defer-returnValue |
Merge into: | launchpad:master |
Diff against target: |
466 lines (+51/-58) 19 files modified
lib/lp/buildmaster/builderproxy.py (+1/-1) lib/lp/buildmaster/interactor.py (+8/-8) lib/lp/buildmaster/model/buildfarmjobbehaviour.py (+5/-5) lib/lp/buildmaster/tests/test_manager.py (+3/-3) lib/lp/charms/model/charmrecipebuildbehaviour.py (+1/-1) lib/lp/code/model/recipebuilder.py (+1/-1) lib/lp/codehosting/sftp.py (+5/-6) lib/lp/oci/model/ocirecipebuildbehaviour.py (+2/-3) lib/lp/services/librarianserver/db.py (+2/-2) lib/lp/services/librarianserver/storage.py (+6/-7) lib/lp/services/librarianserver/web.py (+4/-5) lib/lp/snappy/model/snapbuildbehaviour.py (+1/-1) lib/lp/soyuz/adapters/archivedependencies.py (+5/-6) lib/lp/soyuz/adapters/tests/test_archivedependencies.py (+1/-1) lib/lp/soyuz/model/binarypackagebuildbehaviour.py (+2/-2) lib/lp/soyuz/model/livefsbuildbehaviour.py (+1/-1) lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py (+1/-2) lib/lp/testing/keyserver/inprocess.py (+1/-2) lib/lp/translations/model/translationtemplatesbuildbehaviour.py (+1/-1) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ioana Lasc (community) | Approve | ||
Review via email: mp+409949@code.launchpad.net |
Commit message
Stop using defer.returnValue
Description of the change
On Python 3, we can just return values directly.
To post a comment you must log in.
Revision history for this message
Ioana Lasc (ilasc) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/lib/lp/buildmaster/builderproxy.py b/lib/lp/buildmaster/builderproxy.py |
2 | index aeb55c9..a224adf 100644 |
3 | --- a/lib/lp/buildmaster/builderproxy.py |
4 | +++ b/lib/lp/buildmaster/builderproxy.py |
5 | @@ -74,4 +74,4 @@ class BuilderProxyMixin: |
6 | RequestProxyTokenCommand, |
7 | url=url, auth_header=auth_header, |
8 | proxy_username=proxy_username) |
9 | - defer.returnValue(token) |
10 | + return token |
11 | diff --git a/lib/lp/buildmaster/interactor.py b/lib/lp/buildmaster/interactor.py |
12 | index 178b8d1..59f7612 100644 |
13 | --- a/lib/lp/buildmaster/interactor.py |
14 | +++ b/lib/lp/buildmaster/interactor.py |
15 | @@ -424,7 +424,7 @@ class BuilderInteractor(object): |
16 | # apparent reason. This could be a quirk of the Xen |
17 | # guest, we're not sure. See bug 586359. |
18 | yield slave.echo("ping") |
19 | - defer.returnValue(True) |
20 | + return True |
21 | elif vitals.vm_reset_protocol == BuilderResetProtocol.PROTO_2_0: |
22 | # In protocol 2.0 the reset trigger is asynchronous. |
23 | # If the trigger succeeds we'll leave the slave in |
24 | @@ -437,7 +437,7 @@ class BuilderInteractor(object): |
25 | transaction.commit() |
26 | logger = cls._getSlaveScannerLogger() |
27 | logger.info("%s is being cleaned.", vitals.name) |
28 | - defer.returnValue(False) |
29 | + return False |
30 | raise CannotResumeHost( |
31 | "Invalid vm_reset_protocol: %r" % vitals.vm_reset_protocol) |
32 | else: |
33 | @@ -445,18 +445,18 @@ class BuilderInteractor(object): |
34 | status = slave_status.get('builder_status', None) |
35 | if status == 'BuilderStatus.IDLE': |
36 | # This is as clean as we can get it. |
37 | - defer.returnValue(True) |
38 | + return True |
39 | elif status == 'BuilderStatus.BUILDING': |
40 | # Asynchronously abort() the slave and wait until WAITING. |
41 | yield slave.abort() |
42 | - defer.returnValue(False) |
43 | + return False |
44 | elif status == 'BuilderStatus.ABORTING': |
45 | # Wait it out until WAITING. |
46 | - defer.returnValue(False) |
47 | + return False |
48 | elif status == 'BuilderStatus.WAITING': |
49 | # Just a synchronous clean() call and we'll be idle. |
50 | yield slave.clean() |
51 | - defer.returnValue(True) |
52 | + return True |
53 | raise BuildDaemonError( |
54 | "Invalid status during clean: %r" % status) |
55 | |
56 | @@ -512,7 +512,7 @@ class BuilderInteractor(object): |
57 | break |
58 | else: |
59 | logger.debug("No build candidates available for builder.") |
60 | - defer.returnValue(None) |
61 | + return None |
62 | |
63 | new_behaviour = cls.getBuildBehaviour(candidate, builder, slave) |
64 | needed_bfjb = type(removeSecurityProxy( |
65 | @@ -523,7 +523,7 @@ class BuilderInteractor(object): |
66 | (new_behaviour, needed_bfjb)) |
67 | yield cls._startBuild( |
68 | candidate, vitals, builder, slave, new_behaviour, logger) |
69 | - defer.returnValue(candidate) |
70 | + return candidate |
71 | |
72 | @staticmethod |
73 | def extractBuildStatus(slave_status): |
74 | diff --git a/lib/lp/buildmaster/model/buildfarmjobbehaviour.py b/lib/lp/buildmaster/model/buildfarmjobbehaviour.py |
75 | index 9cac6e9..4b5253b 100644 |
76 | --- a/lib/lp/buildmaster/model/buildfarmjobbehaviour.py |
77 | +++ b/lib/lp/buildmaster/model/buildfarmjobbehaviour.py |
78 | @@ -105,9 +105,9 @@ class BuildFarmJobBehaviourBase: |
79 | def composeBuildRequest(self, logger): |
80 | args = yield self.extraBuildArgs(logger=logger) |
81 | filemap = yield self.determineFilesToSend() |
82 | - defer.returnValue( |
83 | - (self.builder_type, self.distro_arch_series, self.pocket, |
84 | - filemap, args)) |
85 | + return ( |
86 | + self.builder_type, self.distro_arch_series, self.pocket, |
87 | + filemap, args) |
88 | |
89 | def verifyBuildRequest(self, logger): |
90 | """The default behaviour is a no-op.""" |
91 | @@ -347,7 +347,7 @@ class BuildFarmJobBehaviourBase: |
92 | if build.job_type == BuildFarmJobType.PACKAGEBUILD: |
93 | build = build.buildqueue_record.specific_build |
94 | if not build.current_source_publication: |
95 | - defer.returnValue(BuildStatus.SUPERSEDED) |
96 | + return BuildStatus.SUPERSEDED |
97 | |
98 | self.verifySuccessfulBuild() |
99 | |
100 | @@ -383,4 +383,4 @@ class BuildFarmJobBehaviourBase: |
101 | os.mkdir(target_dir) |
102 | os.rename(grab_dir, os.path.join(target_dir, upload_leaf)) |
103 | |
104 | - defer.returnValue(BuildStatus.UPLOADING) |
105 | + return BuildStatus.UPLOADING |
106 | diff --git a/lib/lp/buildmaster/tests/test_manager.py b/lib/lp/buildmaster/tests/test_manager.py |
107 | index ada37a0..0187dc2 100644 |
108 | --- a/lib/lp/buildmaster/tests/test_manager.py |
109 | +++ b/lib/lp/buildmaster/tests/test_manager.py |
110 | @@ -321,7 +321,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory): |
111 | status = yield super(BrokenUTF8Slave, self).status() |
112 | status["logtail"] = xmlrpc_client.Binary( |
113 | u"───".encode("UTF-8")[1:]) |
114 | - defer.returnValue(status) |
115 | + return status |
116 | |
117 | builder = getUtility(IBuilderSet)[BOB_THE_BUILDER_NAME] |
118 | login('foo.bar@canonical.com') |
119 | @@ -350,7 +350,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory): |
120 | def status(self): |
121 | status = yield super(NULSlave, self).status() |
122 | status["logtail"] = xmlrpc_client.Binary(b"foo\0bar\0baz") |
123 | - defer.returnValue(status) |
124 | + return status |
125 | |
126 | builder = getUtility(IBuilderSet)[BOB_THE_BUILDER_NAME] |
127 | login('foo.bar@canonical.com') |
128 | @@ -431,7 +431,7 @@ class TestSlaveScannerScan(StatsMixin, TestCaseWithFactory): |
129 | def status(self): |
130 | status = yield super(SnapBuildingSlave, self).status() |
131 | status["revision_id"] = self.revision_id |
132 | - defer.returnValue(status) |
133 | + return status |
134 | |
135 | build = self.factory.makeSnapBuild( |
136 | distroarchseries=self.test_publisher.distroseries.architectures[0]) |
137 | diff --git a/lib/lp/charms/model/charmrecipebuildbehaviour.py b/lib/lp/charms/model/charmrecipebuildbehaviour.py |
138 | index 99538dc..b02c90e 100644 |
139 | --- a/lib/lp/charms/model/charmrecipebuildbehaviour.py |
140 | +++ b/lib/lp/charms/model/charmrecipebuildbehaviour.py |
141 | @@ -98,7 +98,7 @@ class CharmRecipeBuildBehaviour(BuilderProxyMixin, BuildFarmJobBehaviourBase): |
142 | build.recipe.owner.name, build.recipe.project.name, |
143 | build.recipe.name)) |
144 | args["private"] = build.is_private |
145 | - defer.returnValue(args) |
146 | + return args |
147 | |
148 | def verifySuccessfulBuild(self): |
149 | """See `IBuildFarmJobBehaviour`.""" |
150 | diff --git a/lib/lp/code/model/recipebuilder.py b/lib/lp/code/model/recipebuilder.py |
151 | index a40ba2c..46ef5b8 100644 |
152 | --- a/lib/lp/code/model/recipebuilder.py |
153 | +++ b/lib/lp/code/model/recipebuilder.py |
154 | @@ -94,7 +94,7 @@ class RecipeBuildBehaviour(BuildFarmJobBehaviourBase): |
155 | args['distroseries_name'] = self.build.distroseries.name |
156 | if self.build.recipe.base_git_repository is not None: |
157 | args['git'] = True |
158 | - defer.returnValue(args) |
159 | + return args |
160 | |
161 | def verifyBuildRequest(self, logger): |
162 | """Assert some pre-build checks. |
163 | diff --git a/lib/lp/codehosting/sftp.py b/lib/lp/codehosting/sftp.py |
164 | index 4242a14..8e6f9cd 100644 |
165 | --- a/lib/lp/codehosting/sftp.py |
166 | +++ b/lib/lp/codehosting/sftp.py |
167 | @@ -194,7 +194,7 @@ class TransportSFTPFile: |
168 | # past the end of files, so we don't need to worry too much |
169 | # about performance here. |
170 | chunk = yield self.readChunk(e.offset, e.actual) |
171 | - defer.returnValue(chunk) |
172 | + return chunk |
173 | |
174 | def setAttrs(self, attrs): |
175 | """See `ISFTPFile`. |
176 | @@ -314,7 +314,7 @@ class TransportSFTPServer: |
177 | file_list = yield self.transport.list_dir(escaped_path) |
178 | stat_results = yield self._stat_files_in_list(file_list, escaped_path) |
179 | entries = self._format_directory_entries(stat_results, file_list) |
180 | - defer.returnValue(DirectoryListing(entries)) |
181 | + return DirectoryListing(entries) |
182 | |
183 | @with_sftp_error |
184 | @defer.inlineCallbacks |
185 | @@ -324,8 +324,7 @@ class TransportSFTPServer: |
186 | directory = os.path.dirname(path) |
187 | stat_result = yield self.transport.stat(directory) |
188 | if stat.S_ISDIR(stat_result.st_mode): |
189 | - defer.returnValue( |
190 | - TransportSFTPFile(self.transport, path, flags, self)) |
191 | + return TransportSFTPFile(self.transport, path, flags, self) |
192 | else: |
193 | raise filetransfer.SFTPError( |
194 | filetransfer.FX_NO_SUCH_FILE, directory) |
195 | @@ -340,7 +339,7 @@ class TransportSFTPServer: |
196 | relpath = self._decodePath(relpath) |
197 | path = yield self.transport.local_realPath(urlutils.escape(relpath)) |
198 | unescaped_path = urlutils.unescape(path) |
199 | - defer.returnValue(unescaped_path.encode('utf-8')) |
200 | + return unescaped_path.encode('utf-8') |
201 | |
202 | def setAttrs(self, path, attrs): |
203 | """See `ISFTPServer`. |
204 | @@ -374,7 +373,7 @@ class TransportSFTPServer: |
205 | """ |
206 | path = self._decodePath(path) |
207 | stat_result = yield self.transport.stat(urlutils.escape(path)) |
208 | - defer.returnValue(self._translate_stat(stat_result)) |
209 | + return self._translate_stat(stat_result) |
210 | |
211 | def gotVersion(self, otherVersion, extensionData): |
212 | """See `ISFTPServer`.""" |
213 | diff --git a/lib/lp/oci/model/ocirecipebuildbehaviour.py b/lib/lp/oci/model/ocirecipebuildbehaviour.py |
214 | index f654287..46c8569 100644 |
215 | --- a/lib/lp/oci/model/ocirecipebuildbehaviour.py |
216 | +++ b/lib/lp/oci/model/ocirecipebuildbehaviour.py |
217 | @@ -169,7 +169,7 @@ class OCIRecipeBuildBehaviour(BuilderProxyMixin, BuildFarmJobBehaviourBase): |
218 | if build.recipe.git_path != "HEAD": |
219 | args["git_path"] = build.recipe.git_ref.name |
220 | |
221 | - defer.returnValue(args) |
222 | + return args |
223 | |
224 | def _ensureFilePath(self, file_name, file_path, upload_path): |
225 | # If the evaluated output file name is not within our |
226 | @@ -187,8 +187,7 @@ class OCIRecipeBuildBehaviour(BuilderProxyMixin, BuildFarmJobBehaviourBase): |
227 | yield self._slave.getFile(file_hash, file_path) |
228 | |
229 | with open(file_path, 'r') as file_fp: |
230 | - contents = json.load(file_fp) |
231 | - defer.returnValue(contents) |
232 | + return json.load(file_fp) |
233 | |
234 | def _extractLayerFiles(self, upload_path, section, config, digests, files): |
235 | # These are different sets of ids, in the same order |
236 | diff --git a/lib/lp/services/librarianserver/db.py b/lib/lp/services/librarianserver/db.py |
237 | index df53941..972ca8f 100644 |
238 | --- a/lib/lp/services/librarianserver/db.py |
239 | +++ b/lib/lp/services/librarianserver/db.py |
240 | @@ -76,10 +76,10 @@ class Library: |
241 | "verifyMacaroon", macaroon.serialize(), "LibraryFileAlias", |
242 | aliasid), |
243 | config.librarian.authentication_timeout) |
244 | - defer.returnValue(True) |
245 | + return True |
246 | except Fault as fault: |
247 | if fault.faultCode == faults.Unauthorized.error_code: |
248 | - defer.returnValue(False) |
249 | + return False |
250 | else: |
251 | raise |
252 | |
253 | diff --git a/lib/lp/services/librarianserver/storage.py b/lib/lp/services/librarianserver/storage.py |
254 | index 9554dbb..e8611b2 100644 |
255 | --- a/lib/lp/services/librarianserver/storage.py |
256 | +++ b/lib/lp/services/librarianserver/storage.py |
257 | @@ -130,9 +130,8 @@ class LibrarianStorage: |
258 | headers, chunks = yield deferToThread( |
259 | swift.quiet_swiftclient, swift_connection.get_object, |
260 | container, name, resp_chunk_size=self.CHUNK_SIZE) |
261 | - swift_stream = TxSwiftStream( |
262 | + return TxSwiftStream( |
263 | connection_pool, swift_connection, chunks) |
264 | - defer.returnValue(swift_stream) |
265 | except swiftclient.ClientException as x: |
266 | if x.http_status == 404: |
267 | connection_pool.put(swift_connection) |
268 | @@ -151,7 +150,7 @@ class LibrarianStorage: |
269 | |
270 | path = self._fileLocation(fileid) |
271 | if os.path.exists(path): |
272 | - defer.returnValue(open(path, 'rb')) |
273 | + return open(path, 'rb') |
274 | |
275 | def _fileLocation(self, fileid): |
276 | return os.path.join(self.directory, _relFileLocation(str(fileid))) |
277 | @@ -170,10 +169,10 @@ class TxSwiftStream(swift.SwiftStream): |
278 | raise ValueError('I/O operation on closed file') |
279 | |
280 | if self._swift_connection is None: |
281 | - defer.returnValue(b'') # EOF already reached, connection returned. |
282 | + return b'' # EOF already reached, connection returned. |
283 | |
284 | if size == 0: |
285 | - defer.returnValue(b'') |
286 | + return b'' |
287 | |
288 | if not self._chunk: |
289 | self._chunk = yield deferToThread(self._next_chunk) |
290 | @@ -185,12 +184,12 @@ class TxSwiftStream(swift.SwiftStream): |
291 | self._connection_pool.put(self._swift_connection) |
292 | self._swift_connection = None |
293 | self._chunks = None |
294 | - defer.returnValue(b'') |
295 | + return b'' |
296 | return_chunk = self._chunk[:size] |
297 | self._chunk = self._chunk[size:] |
298 | |
299 | self._offset += len(return_chunk) |
300 | - defer.returnValue(return_chunk) |
301 | + return return_chunk |
302 | |
303 | |
304 | class LibraryFileUpload(object): |
305 | diff --git a/lib/lp/services/librarianserver/web.py b/lib/lp/services/librarianserver/web.py |
306 | index 3d567ab..55ad829 100644 |
307 | --- a/lib/lp/services/librarianserver/web.py |
308 | +++ b/lib/lp/services/librarianserver/web.py |
309 | @@ -172,7 +172,7 @@ class LibraryFileAliasResource(resource.Resource): |
310 | log.msg( |
311 | "404: dbfilename.encode('utf-8') != filename: %r != %r" |
312 | % (dbfilename.encode('utf-8'), filename)) |
313 | - defer.returnValue(fourOhFour) |
314 | + return fourOhFour |
315 | |
316 | stream = yield self.storage.open(dbcontentID) |
317 | if stream is not None: |
318 | @@ -186,11 +186,10 @@ class LibraryFileAliasResource(resource.Resource): |
319 | 'Cache-Control', |
320 | 'max-age=31536000, public' |
321 | if not restricted else 'max-age=0, private') |
322 | - defer.returnValue(file) |
323 | + return file |
324 | elif self.upstreamHost is not None: |
325 | - defer.returnValue( |
326 | - proxy.ReverseProxyResource( |
327 | - self.upstreamHost, self.upstreamPort, request.path)) |
328 | + return proxy.ReverseProxyResource( |
329 | + self.upstreamHost, self.upstreamPort, request.path) |
330 | else: |
331 | raise AssertionError( |
332 | "Content %d missing from storage." % dbcontentID) |
333 | diff --git a/lib/lp/snappy/model/snapbuildbehaviour.py b/lib/lp/snappy/model/snapbuildbehaviour.py |
334 | index 69adcfe..cfbf645 100644 |
335 | --- a/lib/lp/snappy/model/snapbuildbehaviour.py |
336 | +++ b/lib/lp/snappy/model/snapbuildbehaviour.py |
337 | @@ -166,7 +166,7 @@ class SnapBuildBehaviour(BuilderProxyMixin, BuildFarmJobBehaviourBase): |
338 | # (matching snapd, SAS and snapcraft representation) |
339 | timestamp = format_as_rfc3339(build_request.date_requested) |
340 | args["build_request_timestamp"] = timestamp |
341 | - defer.returnValue(args) |
342 | + return args |
343 | |
344 | def verifySuccessfulBuild(self): |
345 | """See `IBuildFarmJobBehaviour`.""" |
346 | diff --git a/lib/lp/soyuz/adapters/archivedependencies.py b/lib/lp/soyuz/adapters/archivedependencies.py |
347 | index c19dca9..27ae3e3 100644 |
348 | --- a/lib/lp/soyuz/adapters/archivedependencies.py |
349 | +++ b/lib/lp/soyuz/adapters/archivedependencies.py |
350 | @@ -325,9 +325,9 @@ def get_sources_list_for_building(behaviour, distroarchseries, |
351 | # binaries that need to override primary binaries of the same |
352 | # version), we want the external dependency lines to show up second: |
353 | # after the archive itself, but before any other dependencies. |
354 | - defer.returnValue( |
355 | - ([sources_list_lines[0]] + external_dep_lines + sources_list_lines[1:], |
356 | - trusted_keys)) |
357 | + return ( |
358 | + [sources_list_lines[0]] + external_dep_lines + sources_list_lines[1:], |
359 | + trusted_keys) |
360 | |
361 | |
362 | def _has_published_binaries(archive, distroarchseries, pocket): |
363 | @@ -358,7 +358,7 @@ def _get_binary_sources_list_line(behaviour, archive, distroarchseries, pocket, |
364 | url = archive.archive_url |
365 | |
366 | suite = distroarchseries.distroseries.name + pocketsuffix[pocket] |
367 | - defer.returnValue('deb %s %s %s' % (url, suite, ' '.join(components))) |
368 | + return 'deb %s %s %s' % (url, suite, ' '.join(components)) |
369 | |
370 | |
371 | @defer.inlineCallbacks |
372 | @@ -423,8 +423,7 @@ def _get_sources_list_for_dependencies(behaviour, dependencies, logger=None): |
373 | trusted_keys[fingerprint] = ( |
374 | base64.b64encode(key.export()).decode("ASCII")) |
375 | |
376 | - defer.returnValue( |
377 | - (sources_list_lines, [v for k, v in sorted(trusted_keys.items())])) |
378 | + return (sources_list_lines, [v for k, v in sorted(trusted_keys.items())]) |
379 | |
380 | |
381 | def _get_default_primary_dependencies(archive, distro_arch_series, component, |
382 | diff --git a/lib/lp/soyuz/adapters/tests/test_archivedependencies.py b/lib/lp/soyuz/adapters/tests/test_archivedependencies.py |
383 | index bf9bec5..a6374a5 100644 |
384 | --- a/lib/lp/soyuz/adapters/tests/test_archivedependencies.py |
385 | +++ b/lib/lp/soyuz/adapters/tests/test_archivedependencies.py |
386 | @@ -178,7 +178,7 @@ class TestSourcesList(TestCaseWithFactory): |
387 | if publish_binary: |
388 | self.publisher.getPubBinaries( |
389 | archive=archive, status=PackagePublishingStatus.PUBLISHED) |
390 | - defer.returnValue(archive) |
391 | + return archive |
392 | |
393 | def makeBuild(self, **kwargs): |
394 | pub_source = self.publisher.getPubSource(**kwargs) |
395 | diff --git a/lib/lp/soyuz/model/binarypackagebuildbehaviour.py b/lib/lp/soyuz/model/binarypackagebuildbehaviour.py |
396 | index 287f66b..fc94d9a 100644 |
397 | --- a/lib/lp/soyuz/model/binarypackagebuildbehaviour.py |
398 | +++ b/lib/lp/soyuz/model/binarypackagebuildbehaviour.py |
399 | @@ -89,7 +89,7 @@ class BinaryPackageBuildBehaviour(BuildFarmJobBehaviourBase): |
400 | 'url': urlappend(pool_url, lfa.filename), |
401 | 'username': 'buildd', |
402 | 'password': macaroon_raw} |
403 | - defer.returnValue(filemap) |
404 | + return filemap |
405 | |
406 | def verifyBuildRequest(self, logger): |
407 | """Assert some pre-build checks. |
408 | @@ -180,4 +180,4 @@ class BinaryPackageBuildBehaviour(BuildFarmJobBehaviourBase): |
409 | self, das, build.source_package_release.name, logger=logger)) |
410 | args['build_debug_symbols'] = build.archive.build_debug_symbols |
411 | |
412 | - defer.returnValue(args) |
413 | + return args |
414 | diff --git a/lib/lp/soyuz/model/livefsbuildbehaviour.py b/lib/lp/soyuz/model/livefsbuildbehaviour.py |
415 | index be29688..acf8999 100644 |
416 | --- a/lib/lp/soyuz/model/livefsbuildbehaviour.py |
417 | +++ b/lib/lp/soyuz/model/livefsbuildbehaviour.py |
418 | @@ -107,7 +107,7 @@ class LiveFSBuildBehaviour(BuildFarmJobBehaviourBase): |
419 | args["archives"], args["trusted_keys"] = ( |
420 | yield get_sources_list_for_building( |
421 | self, build.distro_arch_series, None, logger=logger)) |
422 | - defer.returnValue(args) |
423 | + return args |
424 | |
425 | def verifySuccessfulBuild(self): |
426 | """See `IBuildFarmJobBehaviour`.""" |
427 | diff --git a/lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py b/lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py |
428 | index 3fa99d4..5239946 100644 |
429 | --- a/lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py |
430 | +++ b/lib/lp/soyuz/tests/test_binarypackagebuildbehaviour.py |
431 | @@ -165,10 +165,9 @@ class TestBinaryBuildPackageBehaviour(StatsMixin, TestCaseWithFactory): |
432 | build_log = [ |
433 | ('build', build.build_cookie, 'binarypackage', |
434 | chroot.content.sha1, filemap_names, extra_args)] |
435 | - result = MatchesListwise([ |
436 | + return MatchesListwise([ |
437 | item if hasattr(item, 'match') else Equals(item) |
438 | for item in upload_logs + build_log]) |
439 | - defer.returnValue(result) |
440 | |
441 | @defer.inlineCallbacks |
442 | def test_non_virtual_ppa_dispatch(self): |
443 | diff --git a/lib/lp/testing/keyserver/inprocess.py b/lib/lp/testing/keyserver/inprocess.py |
444 | index ef4a54c..70d6aae 100644 |
445 | --- a/lib/lp/testing/keyserver/inprocess.py |
446 | +++ b/lib/lp/testing/keyserver/inprocess.py |
447 | @@ -67,8 +67,7 @@ class InProcessKeyServerFixture(Fixture): |
448 | # fixtures.callmany.CallMany doesn't support cleanup functions that |
449 | # return Deferred, so we have to do this manually. |
450 | yield self._port.stopListening() |
451 | - defer.returnValue( |
452 | - super(InProcessKeyServerFixture, self).cleanUp(*args, **kwargs)) |
453 | + return super(InProcessKeyServerFixture, self).cleanUp(*args, **kwargs) |
454 | |
455 | @property |
456 | def url(self): |
457 | diff --git a/lib/lp/translations/model/translationtemplatesbuildbehaviour.py b/lib/lp/translations/model/translationtemplatesbuildbehaviour.py |
458 | index a2a82fc..f141c87 100644 |
459 | --- a/lib/lp/translations/model/translationtemplatesbuildbehaviour.py |
460 | +++ b/lib/lp/translations/model/translationtemplatesbuildbehaviour.py |
461 | @@ -133,4 +133,4 @@ class TranslationTemplatesBuildBehaviour(BuildFarmJobBehaviourBase): |
462 | finally: |
463 | tarball_file.close() |
464 | os.remove(filename) |
465 | - defer.returnValue(BuildStatus.FULLYBUILT) |
466 | + return BuildStatus.FULLYBUILT |