Merge ~cjwatson/launchpad:pyupgrade-py3-archiveuploader into launchpad:master
- Git
- lp:~cjwatson/launchpad
- pyupgrade-py3-archiveuploader
- Merge into master
Proposed by
Colin Watson
Status: | Merged |
---|---|
Approved by: | Colin Watson |
Approved revision: | f87fb13825c47ea57afbc09cbdcf4f1a46ded5c0 |
Merge reported by: | Otto Co-Pilot |
Merged at revision: | not available |
Proposed branch: | ~cjwatson/launchpad:pyupgrade-py3-archiveuploader |
Merge into: | launchpad:master |
Diff against target: |
1307 lines (+199/-200) 23 files modified
.git-blame-ignore-revs (+2/-0) .pre-commit-config.yaml (+1/-1) lib/lp/archiveuploader/buildinfofile.py (+1/-1) lib/lp/archiveuploader/changesfile.py (+1/-1) lib/lp/archiveuploader/dscfile.py (+2/-2) lib/lp/archiveuploader/nascentuploadfile.py (+3/-4) lib/lp/archiveuploader/ocirecipeupload.py (+1/-1) lib/lp/archiveuploader/tests/test_buildduploads.py (+4/-4) lib/lp/archiveuploader/tests/test_changesfile.py (+5/-5) lib/lp/archiveuploader/tests/test_charmrecipeupload.py (+1/-1) lib/lp/archiveuploader/tests/test_dscfile.py (+5/-5) lib/lp/archiveuploader/tests/test_livefsupload.py (+2/-2) lib/lp/archiveuploader/tests/test_nascentupload.py (+1/-1) lib/lp/archiveuploader/tests/test_nascentuploadfile.py (+12/-12) lib/lp/archiveuploader/tests/test_ocirecipeupload.py (+1/-1) lib/lp/archiveuploader/tests/test_ppauploadprocessor.py (+62/-62) lib/lp/archiveuploader/tests/test_recipeuploads.py (+1/-1) lib/lp/archiveuploader/tests/test_snapupload.py (+1/-1) lib/lp/archiveuploader/tests/test_uploadprocessor.py (+44/-44) lib/lp/archiveuploader/tests/test_utils.py (+31/-33) lib/lp/archiveuploader/uploadpolicy.py (+4/-4) lib/lp/archiveuploader/uploadprocessor.py (+1/-1) lib/lp/archiveuploader/utils.py (+13/-13) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jürgen Gmach | Approve | ||
Review via email: mp+412514@code.launchpad.net |
Commit message
lp.archiveuploader: Apply "pyupgrade --py3-plus"
Description of the change
To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs |
2 | index 7121771..78c032b 100644 |
3 | --- a/.git-blame-ignore-revs |
4 | +++ b/.git-blame-ignore-revs |
5 | @@ -6,3 +6,5 @@ |
6 | 7fbeaae55d7d282ccda47c76a27c879e04ee14e9 |
7 | # apply pyupgrade --py3-plus to lp.archivepublisher |
8 | c348b945c29c723201380d9aca0e0c0298037c8c |
9 | +# apply pyupgrade --py3-plus to lp.archiveuploader |
10 | +65c3806b29ddd3d989a1b5a900c40e6599a38c3f |
11 | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml |
12 | index ea4c505..17e1dff 100644 |
13 | --- a/.pre-commit-config.yaml |
14 | +++ b/.pre-commit-config.yaml |
15 | @@ -38,7 +38,7 @@ repos: |
16 | alias: pyupgrade-py3 |
17 | name: pyupgrade (--py3-plus) |
18 | args: [--keep-percent-format, --py3-plus] |
19 | - files: ^lib/lp/(answers|app|archivepublisher)/ |
20 | + files: ^lib/lp/(answers|app|archivepublisher|archiveuploader)/ |
21 | - repo: https://github.com/PyCQA/isort |
22 | rev: 5.9.2 |
23 | hooks: |
24 | diff --git a/lib/lp/archiveuploader/buildinfofile.py b/lib/lp/archiveuploader/buildinfofile.py |
25 | index eb00698..b7fd2ee 100644 |
26 | --- a/lib/lp/archiveuploader/buildinfofile.py |
27 | +++ b/lib/lp/archiveuploader/buildinfofile.py |
28 | @@ -22,7 +22,7 @@ class BuildInfoFile(PackageUploadFile, SignableTagFile): |
29 | |
30 | def __init__(self, filepath, checksums, size, component_and_section, |
31 | priority_name, package, version, changes, policy, logger): |
32 | - super(BuildInfoFile, self).__init__( |
33 | + super().__init__( |
34 | filepath, checksums, size, component_and_section, priority_name, |
35 | package, version, changes, policy, logger) |
36 | self.parse(verify_signature=not policy.unsigned_buildinfo_ok) |
37 | diff --git a/lib/lp/archiveuploader/changesfile.py b/lib/lp/archiveuploader/changesfile.py |
38 | index 1a97999..43ff662 100644 |
39 | --- a/lib/lp/archiveuploader/changesfile.py |
40 | +++ b/lib/lp/archiveuploader/changesfile.py |
41 | @@ -371,7 +371,7 @@ class ChangesFile(SignableTagFile): |
42 | """ |
43 | changes_author = rfc822_encode_address( |
44 | self.changed_by['name'], self.changed_by['email']) |
45 | - return (u'%s\n\n -- %s %s' % ( |
46 | + return ('%s\n\n -- %s %s' % ( |
47 | self.changes_comment, changes_author, self.date)).encode('UTF-8') |
48 | |
49 | |
50 | diff --git a/lib/lp/archiveuploader/dscfile.py b/lib/lp/archiveuploader/dscfile.py |
51 | index 50e6d70..8554832 100644 |
52 | --- a/lib/lp/archiveuploader/dscfile.py |
53 | +++ b/lib/lp/archiveuploader/dscfile.py |
54 | @@ -137,7 +137,7 @@ class SignableTagFile: |
55 | try: |
56 | with open(self.filepath, 'rb') as f: |
57 | self.raw_content = f.read() |
58 | - except IOError as error: |
59 | + except OSError as error: |
60 | raise UploadError( |
61 | "Unable to read %s: %s" % (self.filename, error)) |
62 | |
63 | @@ -212,7 +212,7 @@ class SignableTagFile: |
64 | try: |
65 | (name, email) = parse_maintainer_bytes(addr, fieldname) |
66 | except ParseMaintError as error: |
67 | - raise UploadError(six.text_type(error)) |
68 | + raise UploadError(str(error)) |
69 | |
70 | person = getUtility(IPersonSet).getByEmail(email) |
71 | if person and person.private: |
72 | diff --git a/lib/lp/archiveuploader/nascentuploadfile.py b/lib/lp/archiveuploader/nascentuploadfile.py |
73 | index e996fc4..548e43c 100644 |
74 | --- a/lib/lp/archiveuploader/nascentuploadfile.py |
75 | +++ b/lib/lp/archiveuploader/nascentuploadfile.py |
76 | @@ -219,7 +219,7 @@ class NascentUploadFile: |
77 | with open(self.filepath, "rb") as ckfile: |
78 | size = 0 |
79 | for chunk in filechunks(ckfile): |
80 | - for digester in six.itervalues(digesters): |
81 | + for digester in digesters.values(): |
82 | digester.update(chunk) |
83 | size += len(chunk) |
84 | |
85 | @@ -329,7 +329,7 @@ class PackageUploadFile(NascentUploadFile): |
86 | SourcePackageRelease creation, so component and section need to exist. |
87 | Even if they might be overridden in the future. |
88 | """ |
89 | - super(PackageUploadFile, self).__init__( |
90 | + super().__init__( |
91 | filepath, md5, size, component_and_section, priority_name, |
92 | policy, logger) |
93 | self.package = package |
94 | @@ -551,8 +551,7 @@ class BaseBinaryUploadFile(PackageUploadFile): |
95 | ] |
96 | checks = mandatory_checks + self.local_checks |
97 | for check in checks: |
98 | - for error in check(): |
99 | - yield error |
100 | + yield from check() |
101 | |
102 | def extractAndParseControl(self): |
103 | """Extract and parse control information.""" |
104 | diff --git a/lib/lp/archiveuploader/ocirecipeupload.py b/lib/lp/archiveuploader/ocirecipeupload.py |
105 | index 460b923..ac655a5 100644 |
106 | --- a/lib/lp/archiveuploader/ocirecipeupload.py |
107 | +++ b/lib/lp/archiveuploader/ocirecipeupload.py |
108 | @@ -46,7 +46,7 @@ class OCIRecipeUpload: |
109 | # Open the digest file |
110 | digest_path = os.path.join(dirpath, 'digests.json') |
111 | self.logger.debug("Digest path: {}".format(digest_path)) |
112 | - with open(digest_path, 'r') as digest_fp: |
113 | + with open(digest_path) as digest_fp: |
114 | digests = json.load(digest_fp) |
115 | |
116 | # Foreach id in digest file, find matching layer |
117 | diff --git a/lib/lp/archiveuploader/tests/test_buildduploads.py b/lib/lp/archiveuploader/tests/test_buildduploads.py |
118 | index ab8a571..473c7ee 100644 |
119 | --- a/lib/lp/archiveuploader/tests/test_buildduploads.py |
120 | +++ b/lib/lp/archiveuploader/tests/test_buildduploads.py |
121 | @@ -72,7 +72,7 @@ class TestStagedBinaryUploadBase(TestUploadProcessorBase): |
122 | 6. Clean log messages. |
123 | 7. Commit transaction, so the upload source can be seen. |
124 | """ |
125 | - super(TestStagedBinaryUploadBase, self).setUp() |
126 | + super().setUp() |
127 | self.options.context = self.policy |
128 | self.options.nomails = self.no_mails |
129 | # Set up the uploadprocessor with appropriate options and logger |
130 | @@ -198,7 +198,7 @@ class TestBuilddUploads(TestStagedBinaryUploadBase): |
131 | |
132 | real_policy = self.policy |
133 | self.policy = 'insecure' |
134 | - super(TestBuilddUploads, self).setUp() |
135 | + super().setUp() |
136 | # Publish the source package release so it can be found by |
137 | # NascentUploadFile.findSourcePackageRelease(). |
138 | spr = self.source_queue.sources[0].sourcepackagerelease |
139 | @@ -241,7 +241,7 @@ class TestBuilddUploads(TestStagedBinaryUploadBase): |
140 | self.assertEqual(build_used.id, build_candidate.id) |
141 | self.assertBuildsCreated(1) |
142 | self.assertEqual( |
143 | - u'i386 build of foo 1.0-1 in ubuntu breezy RELEASE', |
144 | + 'i386 build of foo 1.0-1 in ubuntu breezy RELEASE', |
145 | build_used.title) |
146 | self.assertEqual('FULLYBUILT', build_used.status.name) |
147 | |
148 | @@ -258,6 +258,6 @@ class TestBuilddUploads(TestStagedBinaryUploadBase): |
149 | self.assertEqual(build_used.id, build_candidate.id) |
150 | self.assertBuildsCreated(2) |
151 | self.assertEqual( |
152 | - u'powerpc build of foo 1.0-1 in ubuntu breezy RELEASE', |
153 | + 'powerpc build of foo 1.0-1 in ubuntu breezy RELEASE', |
154 | build_used.title) |
155 | self.assertEqual('FULLYBUILT', build_used.status.name) |
156 | diff --git a/lib/lp/archiveuploader/tests/test_changesfile.py b/lib/lp/archiveuploader/tests/test_changesfile.py |
157 | index 427b43b..aeb87d1 100644 |
158 | --- a/lib/lp/archiveuploader/tests/test_changesfile.py |
159 | +++ b/lib/lp/archiveuploader/tests/test_changesfile.py |
160 | @@ -169,7 +169,7 @@ class ChangesFileTests(TestCase): |
161 | layer = LaunchpadZopelessLayer |
162 | |
163 | def setUp(self): |
164 | - super(ChangesFileTests, self).setUp() |
165 | + super().setUp() |
166 | self.logger = BufferLogger() |
167 | self.policy = AbsolutelyAnythingGoesUploadPolicy() |
168 | |
169 | @@ -265,9 +265,9 @@ class ChangesFileTests(TestCase): |
170 | self.assertThat( |
171 | changes.changed_by, |
172 | MatchesDict({ |
173 | - "name": Equals(u"Somebody"), |
174 | - "email": Equals(u"somebody@ubuntu.com"), |
175 | - "person": MatchesStructure.byEquality(displayname=u"Somebody"), |
176 | + "name": Equals("Somebody"), |
177 | + "email": Equals("somebody@ubuntu.com"), |
178 | + "person": MatchesStructure.byEquality(displayname="Somebody"), |
179 | })) |
180 | |
181 | def test_simulated_changelog(self): |
182 | @@ -358,7 +358,7 @@ class TestSignatureVerification(TestCase): |
183 | layer = ZopelessDatabaseLayer |
184 | |
185 | def setUp(self): |
186 | - super(TestSignatureVerification, self).setUp() |
187 | + super().setUp() |
188 | self.useFixture(KeyServerTac()) |
189 | import_public_test_keys() |
190 | |
191 | diff --git a/lib/lp/archiveuploader/tests/test_charmrecipeupload.py b/lib/lp/archiveuploader/tests/test_charmrecipeupload.py |
192 | index edd2da7..7fdf8d4 100644 |
193 | --- a/lib/lp/archiveuploader/tests/test_charmrecipeupload.py |
194 | +++ b/lib/lp/archiveuploader/tests/test_charmrecipeupload.py |
195 | @@ -25,7 +25,7 @@ class TestCharmRecipeUploads(TestUploadProcessorBase): |
196 | """End-to-end tests of charm recipe uploads.""" |
197 | |
198 | def setUp(self): |
199 | - super(TestCharmRecipeUploads, self).setUp() |
200 | + super().setUp() |
201 | self.useFixture(FeatureFixture({CHARM_RECIPE_ALLOW_CREATE: "on"})) |
202 | |
203 | self.setupBreezy() |
204 | diff --git a/lib/lp/archiveuploader/tests/test_dscfile.py b/lib/lp/archiveuploader/tests/test_dscfile.py |
205 | index e1b4404..c38577e 100644 |
206 | --- a/lib/lp/archiveuploader/tests/test_dscfile.py |
207 | +++ b/lib/lp/archiveuploader/tests/test_dscfile.py |
208 | @@ -48,7 +48,7 @@ DIFF = SourcePackageFileType.DIFF |
209 | class TestDscFile(TestCase): |
210 | |
211 | def setUp(self): |
212 | - super(TestDscFile, self).setUp() |
213 | + super().setUp() |
214 | self.tmpdir = self.makeTemporaryDirectory() |
215 | self.dir_path = os.path.join(self.tmpdir, "foo", "debian") |
216 | os.makedirs(self.dir_path) |
217 | @@ -105,7 +105,7 @@ class TestDscFile(TestCase): |
218 | changelog and copyright files. 10MiB was set as a sane lower limit |
219 | which is incredibly unlikely to be hit by normal files in the |
220 | archive""" |
221 | - dev_zero = open("/dev/zero", "r") |
222 | + dev_zero = open("/dev/zero") |
223 | ten_MiB = 10 * (2 ** 20) |
224 | empty_file = dev_zero.read(ten_MiB + 1) |
225 | dev_zero.close() |
226 | @@ -185,10 +185,10 @@ class TestSignableTagFile(TestCaseWithFactory): |
227 | self.makeSignableTagFile().parseAddress, "invalid@bad@address") |
228 | |
229 | def test_parseAddress_decodes_utf8(self): |
230 | - name = u'B\u0105r' |
231 | - email = u'bar@example.com' |
232 | + name = 'B\u0105r' |
233 | + email = 'bar@example.com' |
234 | results = self.makeSignableTagFile().parseAddress( |
235 | - (u'%s <%s>' % (name, email)).encode('utf-8')) |
236 | + ('%s <%s>' % (name, email)).encode('utf-8')) |
237 | self.assertEqual(email, results['email']) |
238 | self.assertEqual(name, results['name']) |
239 | self.assertEqual(name, results['person'].displayname) |
240 | diff --git a/lib/lp/archiveuploader/tests/test_livefsupload.py b/lib/lp/archiveuploader/tests/test_livefsupload.py |
241 | index 273773b..869e077 100644 |
242 | --- a/lib/lp/archiveuploader/tests/test_livefsupload.py |
243 | +++ b/lib/lp/archiveuploader/tests/test_livefsupload.py |
244 | @@ -27,9 +27,9 @@ class TestLiveFSBuildUploads(TestUploadProcessorBase): |
245 | """End-to-end tests of LiveFS build uploads.""" |
246 | |
247 | def setUp(self): |
248 | - super(TestLiveFSBuildUploads, self).setUp() |
249 | + super().setUp() |
250 | |
251 | - self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: u"on"})) |
252 | + self.useFixture(FeatureFixture({LIVEFS_FEATURE_FLAG: "on"})) |
253 | self.setupBreezy() |
254 | |
255 | self.switchToAdmin() |
256 | diff --git a/lib/lp/archiveuploader/tests/test_nascentupload.py b/lib/lp/archiveuploader/tests/test_nascentupload.py |
257 | index d7a0a87..b53fff4 100644 |
258 | --- a/lib/lp/archiveuploader/tests/test_nascentupload.py |
259 | +++ b/lib/lp/archiveuploader/tests/test_nascentupload.py |
260 | @@ -35,7 +35,7 @@ class TestMatchDDEBs(TestCase): |
261 | layer = LaunchpadZopelessLayer |
262 | |
263 | def setUp(self): |
264 | - super(TestMatchDDEBs, self).setUp() |
265 | + super().setUp() |
266 | self.changes = FakeChangesFile() |
267 | self.upload = NascentUpload(self.changes, None, DevNullLogger()) |
268 | |
269 | diff --git a/lib/lp/archiveuploader/tests/test_nascentuploadfile.py b/lib/lp/archiveuploader/tests/test_nascentuploadfile.py |
270 | index 9dfa59f..25e97de 100644 |
271 | --- a/lib/lp/archiveuploader/tests/test_nascentuploadfile.py |
272 | +++ b/lib/lp/archiveuploader/tests/test_nascentuploadfile.py |
273 | @@ -58,7 +58,7 @@ class NascentUploadFileTestCase(TestCaseWithFactory): |
274 | """Base class for all tests of classes deriving from NascentUploadFile.""" |
275 | |
276 | def setUp(self): |
277 | - super(NascentUploadFileTestCase, self).setUp() |
278 | + super().setUp() |
279 | self.logger = BufferLogger() |
280 | self.policy = AbsolutelyAnythingGoesUploadPolicy() |
281 | self.distro = self.factory.makeDistribution() |
282 | @@ -188,7 +188,7 @@ class PackageUploadFileTestCase(NascentUploadFileTestCase): |
283 | """Base class for all tests of classes deriving from PackageUploadFile.""" |
284 | |
285 | def setUp(self): |
286 | - super(PackageUploadFileTestCase, self).setUp() |
287 | + super().setUp() |
288 | self.policy.distroseries = self.factory.makeDistroSeries( |
289 | distribution=self.distro) |
290 | |
291 | @@ -301,7 +301,7 @@ class DSCFileTests(PackageUploadFileTestCase): |
292 | release = uploadfile.storeInDatabase(None) |
293 | # DSCFile lowercases the field names |
294 | self.assertEqual( |
295 | - [["Python-Version", u"2.5"]], release.user_defined_fields) |
296 | + [["Python-Version", "2.5"]], release.user_defined_fields) |
297 | |
298 | def test_homepage(self): |
299 | # storeInDatabase updates homepage. |
300 | @@ -314,7 +314,7 @@ class DSCFileTests(PackageUploadFileTestCase): |
301 | uploadfile.changelog = b"DUMMY" |
302 | uploadfile.files = [] |
303 | release = uploadfile.storeInDatabase(None) |
304 | - self.assertEqual(u"http://samba.org/~jelmer/bzr", release.homepage) |
305 | + self.assertEqual("http://samba.org/~jelmer/bzr", release.homepage) |
306 | |
307 | def test_checkBuild(self): |
308 | # checkBuild() verifies consistency with a build. |
309 | @@ -554,14 +554,14 @@ class DebBinaryUploadFileTests(PackageUploadFileTestCase): |
310 | uploadfile.parseControl(control) |
311 | build = self.factory.makeBinaryPackageBuild() |
312 | bpr = uploadfile.storeInDatabase(build) |
313 | - self.assertEqual(u'python (<< 2.7), python (>= 2.5)', bpr.depends) |
314 | + self.assertEqual('python (<< 2.7), python (>= 2.5)', bpr.depends) |
315 | self.assertEqual( |
316 | - u" Dulwich is a Python implementation of the file formats and" |
317 | - u" protocols", bpr.description) |
318 | + " Dulwich is a Python implementation of the file formats and" |
319 | + " protocols", bpr.description) |
320 | self.assertEqual(False, bpr.essential) |
321 | self.assertEqual(524, bpr.installedsize) |
322 | self.assertEqual(True, bpr.architecturespecific) |
323 | - self.assertEqual(u"", bpr.recommends) |
324 | + self.assertEqual("", bpr.recommends) |
325 | self.assertEqual("0.42", bpr.version) |
326 | |
327 | def test_user_defined_fields(self): |
328 | @@ -575,7 +575,7 @@ class DebBinaryUploadFileTests(PackageUploadFileTestCase): |
329 | build = self.factory.makeBinaryPackageBuild() |
330 | bpr = uploadfile.storeInDatabase(build) |
331 | self.assertEqual( |
332 | - [[u"Python-Version", u"2.5"]], bpr.user_defined_fields) |
333 | + [["Python-Version", "2.5"]], bpr.user_defined_fields) |
334 | |
335 | def test_user_defined_fields_newlines(self): |
336 | # storeInDatabase stores user defined fields and keeps newlines. |
337 | @@ -589,7 +589,7 @@ class DebBinaryUploadFileTests(PackageUploadFileTestCase): |
338 | bpr = uploadfile.storeInDatabase(build) |
339 | self.assertEqual( |
340 | [ |
341 | - [u"RandomData", u"Foo\nbar\nbla\n"], |
342 | + ["RandomData", "Foo\nbar\nbla\n"], |
343 | ], bpr.user_defined_fields) |
344 | |
345 | def test_built_using(self): |
346 | @@ -615,7 +615,7 @@ class DebBinaryUploadFileTests(PackageUploadFileTestCase): |
347 | reference_type=BinarySourceReferenceType.BUILT_USING, |
348 | ))) |
349 | self.assertEqual( |
350 | - [[u"Built-Using", u"bar (= 0.1)"]], bpr.user_defined_fields) |
351 | + [["Built-Using", "bar (= 0.1)"]], bpr.user_defined_fields) |
352 | |
353 | def test_homepage(self): |
354 | # storeInDatabase stores homepage field. |
355 | @@ -628,7 +628,7 @@ class DebBinaryUploadFileTests(PackageUploadFileTestCase): |
356 | build = self.factory.makeBinaryPackageBuild() |
357 | bpr = uploadfile.storeInDatabase(build) |
358 | self.assertEqual( |
359 | - u"http://samba.org/~jelmer/dulwich", bpr.homepage) |
360 | + "http://samba.org/~jelmer/dulwich", bpr.homepage) |
361 | |
362 | def test_checkBuild(self): |
363 | # checkBuild() verifies consistency with a build. |
364 | diff --git a/lib/lp/archiveuploader/tests/test_ocirecipeupload.py b/lib/lp/archiveuploader/tests/test_ocirecipeupload.py |
365 | index 39cc56b..f46785f 100644 |
366 | --- a/lib/lp/archiveuploader/tests/test_ocirecipeupload.py |
367 | +++ b/lib/lp/archiveuploader/tests/test_ocirecipeupload.py |
368 | @@ -26,7 +26,7 @@ from lp.services.propertycache import get_property_cache |
369 | class TestOCIRecipeUploads(OCIConfigHelperMixin, TestUploadProcessorBase): |
370 | |
371 | def setUp(self): |
372 | - super(TestOCIRecipeUploads, self).setUp() |
373 | + super().setUp() |
374 | self.useFixture(FeatureFixture({OCI_RECIPE_ALLOW_CREATE: 'on'})) |
375 | |
376 | self.setupBreezy() |
377 | diff --git a/lib/lp/archiveuploader/tests/test_ppauploadprocessor.py b/lib/lp/archiveuploader/tests/test_ppauploadprocessor.py |
378 | index 2ae52d7..767324d 100644 |
379 | --- a/lib/lp/archiveuploader/tests/test_ppauploadprocessor.py |
380 | +++ b/lib/lp/archiveuploader/tests/test_ppauploadprocessor.py |
381 | @@ -49,7 +49,7 @@ class TestPPAUploadProcessorBase(TestUploadProcessorBase): |
382 | Additionally to the TestUploadProcessorBase.setUp, set 'breezy' |
383 | distroseries and an new uploadprocessor instance. |
384 | """ |
385 | - super(TestPPAUploadProcessorBase, self).setUp() |
386 | + super().setUp() |
387 | self.build_uploadprocessor = self.getUploadProcessor( |
388 | self.layer.txn, builds=True) |
389 | self.ubuntu = getUtility(IDistributionSet).getByName('ubuntu') |
390 | @@ -158,8 +158,8 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase): |
391 | PackageUploadStatus.DONE) |
392 | |
393 | [queue_item] = self.breezy.getPackageUploads( |
394 | - status=PackageUploadStatus.DONE, name=u"bar", |
395 | - version=u"1.0-1", exact_match=True, archive=self.name16.archive) |
396 | + status=PackageUploadStatus.DONE, name="bar", |
397 | + version="1.0-1", exact_match=True, archive=self.name16.archive) |
398 | |
399 | self.assertEqual(queue_item.archive, self.name16.archive) |
400 | self.assertEqual(queue_item.pocket, PackagePublishingPocket.RELEASE) |
401 | @@ -172,13 +172,13 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase): |
402 | self.assertEqual(pending_ppas.count(), 1) |
403 | self.assertEqual(pending_ppas[0], self.name16.archive) |
404 | |
405 | - pub_bar = self.name16.archive.getPublishedSources(name=u'bar').one() |
406 | + pub_bar = self.name16.archive.getPublishedSources(name='bar').one() |
407 | |
408 | - self.assertEqual(pub_bar.sourcepackagerelease.version, u'1.0-1') |
409 | + self.assertEqual(pub_bar.sourcepackagerelease.version, '1.0-1') |
410 | self.assertEqual(pub_bar.status, PackagePublishingStatus.PENDING) |
411 | self.assertEqual(pub_bar.component.name, 'main') |
412 | |
413 | - [build] = self.name16.archive.getBuildRecords(name=u'bar') |
414 | + [build] = self.name16.archive.getBuildRecords(name='bar') |
415 | self.assertEqual( |
416 | build.title, 'i386 build of bar 1.0-1 in ubuntu breezy RELEASE') |
417 | self.assertEqual(build.status.name, 'NEEDSBUILD') |
418 | @@ -197,14 +197,14 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase): |
419 | self.uploadprocessor.last_processed_upload.queue_root.status, |
420 | PackageUploadStatus.DONE) |
421 | |
422 | - pub_sources = self.name16.archive.getPublishedSources(name=u'bar') |
423 | + pub_sources = self.name16.archive.getPublishedSources(name='bar') |
424 | [pub_bar_10, pub_bar] = pub_sources |
425 | |
426 | - self.assertEqual(pub_bar_10.sourcepackagerelease.version, u'1.0-10') |
427 | + self.assertEqual(pub_bar_10.sourcepackagerelease.version, '1.0-10') |
428 | self.assertEqual(pub_bar_10.status, PackagePublishingStatus.PENDING) |
429 | self.assertEqual(pub_bar_10.component.name, 'main') |
430 | |
431 | - [build, build_old] = self.name16.archive.getBuildRecords(name=u'bar') |
432 | + [build, build_old] = self.name16.archive.getBuildRecords(name='bar') |
433 | self.assertEqual( |
434 | build.title, 'i386 build of bar 1.0-10 in ubuntu breezy RELEASE') |
435 | self.assertEqual(build.status.name, 'NEEDSBUILD') |
436 | @@ -219,8 +219,8 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase): |
437 | |
438 | self.assertEqual( |
439 | self.uploadprocessor.last_processed_upload.rejection_message, |
440 | - u'bar_1.0-2.dsc: Version older than that in the archive. ' |
441 | - u'1.0-2 <= 1.0-10') |
442 | + 'bar_1.0-2.dsc: Version older than that in the archive. ' |
443 | + '1.0-2 <= 1.0-10') |
444 | |
445 | def testNamedPPAUploadDefault(self): |
446 | """Test PPA uploads to the default PPA.""" |
447 | @@ -294,7 +294,7 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase): |
448 | pop_notifications() |
449 | |
450 | # The SourcePackageRelease still has a component of universe: |
451 | - pub_foo = self.name16.archive.getPublishedSources(name=u"bar").one() |
452 | + pub_foo = self.name16.archive.getPublishedSources(name="bar").one() |
453 | self.assertEqual( |
454 | pub_foo.sourcepackagerelease.component.name, "universe") |
455 | |
456 | @@ -302,7 +302,7 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase): |
457 | self.assertEqual(pub_foo.component.name, 'main') |
458 | |
459 | # Continue with a binary upload: |
460 | - [build] = self.name16.archive.getBuildRecords(name=u"bar") |
461 | + [build] = self.name16.archive.getBuildRecords(name="bar") |
462 | self.options.context = 'buildd' |
463 | upload_dir = self.queueUpload( |
464 | "bar_1.0-1_binary_universe", "~name16/ubuntu") |
465 | @@ -314,8 +314,8 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase): |
466 | |
467 | # Publish the binary. |
468 | [queue_item] = self.breezy.getPackageUploads( |
469 | - status=PackageUploadStatus.ACCEPTED, name=u"bar", |
470 | - version=u"1.0-1", exact_match=True, archive=self.name16.archive) |
471 | + status=PackageUploadStatus.ACCEPTED, name="bar", |
472 | + version="1.0-1", exact_match=True, archive=self.name16.archive) |
473 | self.switchToAdmin() |
474 | queue_item.realiseUpload() |
475 | self.switchToUploader() |
476 | @@ -341,12 +341,12 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase): |
477 | # Source publication and build record for breezy-i386 |
478 | # distroarchseries were created as expected. The source is ready |
479 | # to receive the binary upload. |
480 | - pub_bar = self.name16.archive.getPublishedSources(name=u'bar').one() |
481 | - self.assertEqual(pub_bar.sourcepackagerelease.version, u'1.0-1') |
482 | + pub_bar = self.name16.archive.getPublishedSources(name='bar').one() |
483 | + self.assertEqual(pub_bar.sourcepackagerelease.version, '1.0-1') |
484 | self.assertEqual(pub_bar.status, PackagePublishingStatus.PENDING) |
485 | self.assertEqual(pub_bar.component.name, 'main') |
486 | |
487 | - [build] = self.name16.archive.getBuildRecords(name=u'bar') |
488 | + [build] = self.name16.archive.getBuildRecords(name='bar') |
489 | self.assertEqual( |
490 | build.title, 'i386 build of bar 1.0-1 in ubuntu breezy RELEASE') |
491 | self.assertEqual(build.status.name, 'NEEDSBUILD') |
492 | @@ -360,8 +360,8 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase): |
493 | |
494 | # The binary upload was accepted and it's waiting in the queue. |
495 | queue_items = self.breezy.getPackageUploads( |
496 | - status=PackageUploadStatus.ACCEPTED, name=u"bar", |
497 | - version=u"1.0-1", exact_match=True, archive=self.name16.archive) |
498 | + status=PackageUploadStatus.ACCEPTED, name="bar", |
499 | + version="1.0-1", exact_match=True, archive=self.name16.archive) |
500 | self.assertEqual(queue_items.count(), 1) |
501 | |
502 | # All the files associated with this binary upload must be in the |
503 | @@ -392,7 +392,7 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase): |
504 | |
505 | # Copy source uploaded to name16 PPA to cprov's PPA. |
506 | name16_pub_bar = self.name16.archive.getPublishedSources( |
507 | - name=u'bar').one() |
508 | + name='bar').one() |
509 | cprov = getUtility(IPersonSet).getByName("cprov") |
510 | cprov_pub_bar = name16_pub_bar.copyTo( |
511 | self.breezy, PackagePublishingPocket.RELEASE, cprov.archive) |
512 | @@ -414,8 +414,8 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase): |
513 | |
514 | # The binary upload was accepted and it's waiting in the queue. |
515 | queue_items = self.breezy.getPackageUploads( |
516 | - status=PackageUploadStatus.ACCEPTED, name=u"bar", |
517 | - version=u"1.0-1", exact_match=True, archive=cprov.archive) |
518 | + status=PackageUploadStatus.ACCEPTED, name="bar", |
519 | + version="1.0-1", exact_match=True, archive=cprov.archive) |
520 | self.assertEqual(queue_items.count(), 1) |
521 | |
522 | def testUploadDoesNotEmailMaintainerOrChangedBy(self): |
523 | @@ -493,8 +493,8 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase): |
524 | PackageUploadStatus.DONE) |
525 | |
526 | [queue_item] = hoary.getPackageUploads( |
527 | - status=PackageUploadStatus.DONE, name=u"bar", |
528 | - version=u"1.0-1", exact_match=True, archive=self.name16.archive) |
529 | + status=PackageUploadStatus.DONE, name="bar", |
530 | + version="1.0-1", exact_match=True, archive=self.name16.archive) |
531 | |
532 | self.assertEqual(queue_item.archive, self.name16.archive) |
533 | self.assertEqual( |
534 | @@ -521,15 +521,15 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase): |
535 | PackageUploadStatus.DONE) |
536 | |
537 | queue_items = self.breezy.getPackageUploads( |
538 | - status=PackageUploadStatus.DONE, name=u"bar", |
539 | - version=u"1.0-1", exact_match=True, archive=ubuntu_team.archive) |
540 | + status=PackageUploadStatus.DONE, name="bar", |
541 | + version="1.0-1", exact_match=True, archive=ubuntu_team.archive) |
542 | self.assertEqual(queue_items.count(), 1) |
543 | |
544 | pending_ppas = self.ubuntu.getPendingPublicationPPAs() |
545 | self.assertEqual(pending_ppas.count(), 1) |
546 | self.assertEqual(pending_ppas[0], ubuntu_team.archive) |
547 | |
548 | - [build] = ubuntu_team.archive.getBuildRecords(name=u'bar') |
549 | + [build] = ubuntu_team.archive.getBuildRecords(name='bar') |
550 | self.assertEqual( |
551 | build.title, 'i386 build of bar 1.0-1 in ubuntu breezy RELEASE') |
552 | self.assertEqual(build.status.name, 'NEEDSBUILD') |
553 | @@ -583,7 +583,7 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase): |
554 | # source's component if the standard auto-overrides don't match |
555 | # an existing publication. |
556 | pub_foocomm = self.name16.archive.getPublishedSources( |
557 | - name=u'foocomm').one() |
558 | + name='foocomm').one() |
559 | self.assertEqual( |
560 | pub_foocomm.sourcepackagerelease.component.name, 'partner') |
561 | self.assertEqual(pub_foocomm.component.name, 'main') |
562 | @@ -615,7 +615,7 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase): |
563 | """ |
564 | upload_dir = self.queueUpload("bar_1.0-1", "~name16/ubuntu") |
565 | self.processUpload(self.uploadprocessor, upload_dir) |
566 | - [build] = self.name16.archive.getBuildRecords(name=u"bar") |
567 | + [build] = self.name16.archive.getBuildRecords(name="bar") |
568 | |
569 | test_files_dir = os.path.join( |
570 | config.root, "lib/lp/archiveuploader/tests/data/") |
571 | @@ -626,7 +626,7 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase): |
572 | self.processUpload(self.build_uploadprocessor, upload_dir, build=build) |
573 | |
574 | [queue_item] = self.breezy.getPackageUploads( |
575 | - name=u"debian-installer", status=PackageUploadStatus.ACCEPTED, |
576 | + name="debian-installer", status=PackageUploadStatus.ACCEPTED, |
577 | archive=self.name16.archive) |
578 | return queue_item |
579 | |
580 | @@ -659,13 +659,13 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase): |
581 | self.processUpload(self.uploadprocessor, upload_dir) |
582 | |
583 | [queue_item] = self.breezy.getPackageUploads( |
584 | - status=PackageUploadStatus.DONE, name=u"bar", |
585 | - version=u"1.0-1", exact_match=True, archive=self.name16.archive) |
586 | + status=PackageUploadStatus.DONE, name="bar", |
587 | + version="1.0-1", exact_match=True, archive=self.name16.archive) |
588 | |
589 | self.checkFilesRestrictedInLibrarian(queue_item, True) |
590 | |
591 | # Now that we have source uploaded, we can upload a build. |
592 | - [build] = self.name16.archive.getBuildRecords(name=u'bar') |
593 | + [build] = self.name16.archive.getBuildRecords(name='bar') |
594 | self.options.context = 'buildd' |
595 | upload_dir = self.queueUpload("bar_1.0-1_binary", "~name16/ubuntu") |
596 | self.processUpload( |
597 | @@ -673,8 +673,8 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase): |
598 | |
599 | # The binary upload was accepted and it's waiting in the queue. |
600 | [queue_item] = self.breezy.getPackageUploads( |
601 | - status=PackageUploadStatus.ACCEPTED, name=u"bar", |
602 | - version=u"1.0-1", exact_match=True, archive=self.name16.archive) |
603 | + status=PackageUploadStatus.ACCEPTED, name="bar", |
604 | + version="1.0-1", exact_match=True, archive=self.name16.archive) |
605 | |
606 | # All the files associated with this binary upload must be in the |
607 | # restricted librarian as the PPA is private. |
608 | @@ -695,8 +695,8 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase): |
609 | "bar_1.0-1_contrib_component", "~name16/ubuntu") |
610 | self.processUpload(self.uploadprocessor, upload_dir) |
611 | [queue_item] = self.breezy.getPackageUploads( |
612 | - status=PackageUploadStatus.DONE, name=u"bar", |
613 | - version=u"1.0-1", exact_match=True, archive=self.name16.archive) |
614 | + status=PackageUploadStatus.DONE, name="bar", |
615 | + version="1.0-1", exact_match=True, archive=self.name16.archive) |
616 | |
617 | # The upload was accepted despite the fact that it does |
618 | # not have a valid component: |
619 | @@ -705,15 +705,15 @@ class TestPPAUploadProcessor(TestPPAUploadProcessorBase): |
620 | self.breezy.upload_components) |
621 | |
622 | # Binary uploads should exhibit the same behaviour: |
623 | - [build] = self.name16.archive.getBuildRecords(name=u"bar") |
624 | + [build] = self.name16.archive.getBuildRecords(name="bar") |
625 | self.options.context = 'buildd' |
626 | upload_dir = self.queueUpload( |
627 | "bar_1.0-1_contrib_binary", "~name16/ubuntu") |
628 | self.processUpload( |
629 | self.build_uploadprocessor, upload_dir, build=build) |
630 | queue_items = self.breezy.getPackageUploads( |
631 | - status=PackageUploadStatus.ACCEPTED, name=u"bar", |
632 | - version=u"1.0-1", exact_match=True, archive=self.name16.archive) |
633 | + status=PackageUploadStatus.ACCEPTED, name="bar", |
634 | + version="1.0-1", exact_match=True, archive=self.name16.archive) |
635 | |
636 | # The binary is accepted despite the fact that it does not have |
637 | # a valid component: |
638 | @@ -818,8 +818,8 @@ class TestPPAUploadProcessorFileLookups(TestPPAUploadProcessorBase): |
639 | PackageUploadStatus.NEW) |
640 | |
641 | [queue_item] = self.breezy.getPackageUploads( |
642 | - status=PackageUploadStatus.NEW, name=u"bar", |
643 | - version=u"1.0-1", exact_match=True) |
644 | + status=PackageUploadStatus.NEW, name="bar", |
645 | + version="1.0-1", exact_match=True) |
646 | queue_item.setAccepted() |
647 | queue_item.realiseUpload() |
648 | transaction.commit() |
649 | @@ -890,7 +890,7 @@ class TestPPAUploadProcessorFileLookups(TestPPAUploadProcessorBase): |
650 | PackageUploadStatus.DONE) |
651 | |
652 | # The published section should be "devel" and not "web". |
653 | - pub_sources = self.name16.archive.getPublishedSources(name=u'bar') |
654 | + pub_sources = self.name16.archive.getPublishedSources(name='bar') |
655 | [pub_bar2, pub_bar1] = pub_sources |
656 | |
657 | section = pub_bar2.section.name |
658 | @@ -948,7 +948,7 @@ class TestPPAUploadProcessorFileLookups(TestPPAUploadProcessorBase): |
659 | than the one already in the PPA. |
660 | """ |
661 | # Ensure the displayname of the PPA has got unicode in it. |
662 | - self.name16.archive.displayname = u"unicode PPA name: áří" |
663 | + self.name16.archive.displayname = "unicode PPA name: áří" |
664 | |
665 | # Upload the first version. |
666 | upload_dir = self.queueUpload("bar_1.0-1", "~name16/ubuntu") |
667 | @@ -966,16 +966,16 @@ class TestPPAUploadProcessorFileLookups(TestPPAUploadProcessorBase): |
668 | # errors. |
669 | self.assertEqual( |
670 | self.uploadprocessor.last_processed_upload.rejection_message, |
671 | - u'File bar_1.0.orig.tar.gz already exists in unicode PPA name: ' |
672 | - u'áří, but uploaded version has different ' |
673 | - u'contents. See more information about this error in ' |
674 | - u'https://help.launchpad.net/Packaging/UploadErrors.\n' |
675 | - u'File bar_1.0-1.diff.gz already exists in unicode PPA name: ' |
676 | - u'áří, but uploaded version has different contents. See more ' |
677 | - u'information about this error in ' |
678 | - u'https://help.launchpad.net/Packaging/UploadErrors.\n' |
679 | - u'Files specified in DSC are broken or missing, skipping package ' |
680 | - u'unpack verification.') |
681 | + 'File bar_1.0.orig.tar.gz already exists in unicode PPA name: ' |
682 | + 'áří, but uploaded version has different ' |
683 | + 'contents. See more information about this error in ' |
684 | + 'https://help.launchpad.net/Packaging/UploadErrors.\n' |
685 | + 'File bar_1.0-1.diff.gz already exists in unicode PPA name: ' |
686 | + 'áří, but uploaded version has different contents. See more ' |
687 | + 'information about this error in ' |
688 | + 'https://help.launchpad.net/Packaging/UploadErrors.\n' |
689 | + 'Files specified in DSC are broken or missing, skipping package ' |
690 | + 'unpack verification.') |
691 | |
692 | # Also, the email generated should be sane. Any of the multiple |
693 | # notifications will do. |
694 | @@ -994,7 +994,7 @@ class TestPPAUploadProcessorFileLookups(TestPPAUploadProcessorBase): |
695 | when a disabled PPA with a unicode display name gets an upload. |
696 | """ |
697 | # Ensure the displayname of the PPA has got unicode in it. |
698 | - self.name16.archive.displayname = u"unicode PPA name: áří" |
699 | + self.name16.archive.displayname = "unicode PPA name: áří" |
700 | self.name16.archive.disable() |
701 | # Upload to disabled archive. |
702 | upload_dir = self.queueUpload("bar_1.0-1", "~name16/ubuntu") |
703 | @@ -1088,7 +1088,7 @@ class TestPPAUploadProcessorFileLookups(TestPPAUploadProcessorBase): |
704 | |
705 | # Delete the published file. |
706 | self.switchToAdmin() |
707 | - bar_src = self.name16.archive.getPublishedSources(name=u"bar").one() |
708 | + bar_src = self.name16.archive.getPublishedSources(name="bar").one() |
709 | bar_src.requestDeletion(self.name16) |
710 | bar_src.dateremoved = UTC_NOW |
711 | self.switchToUploader() |
712 | @@ -1128,8 +1128,8 @@ class TestPPAUploadProcessorFileLookups(TestPPAUploadProcessorBase): |
713 | PackageUploadStatus.NEW) |
714 | |
715 | [queue_item] = self.breezy.getPackageUploads( |
716 | - status=PackageUploadStatus.NEW, name=u"bar", |
717 | - version=u"1.0-1", exact_match=True) |
718 | + status=PackageUploadStatus.NEW, name="bar", |
719 | + version="1.0-1", exact_match=True) |
720 | queue_item.setAccepted() |
721 | queue_item.realiseUpload() |
722 | transaction.commit() |
723 | @@ -1266,7 +1266,7 @@ class TestPPAUploadProcessorQuotaChecks(TestPPAUploadProcessorBase): |
724 | # Retrieve the build record for source bar in breezy-i386 |
725 | # distroarchseries, and setup a appropriate upload policy |
726 | # in preparation to the corresponding binary upload. |
727 | - [build] = self.name16.archive.getBuildRecords(name=u'bar') |
728 | + [build] = self.name16.archive.getBuildRecords(name='bar') |
729 | self.options.context = 'buildd' |
730 | |
731 | # Stuff 2048 MiB in name16 PPA, so anything will be above the |
732 | @@ -1279,8 +1279,8 @@ class TestPPAUploadProcessorQuotaChecks(TestPPAUploadProcessorBase): |
733 | |
734 | # The binary upload was accepted, and it's waiting in the queue. |
735 | queue_items = self.breezy.getPackageUploads( |
736 | - status=PackageUploadStatus.ACCEPTED, name=u"bar", |
737 | - version=u"1.0-1", exact_match=True, archive=self.name16.archive) |
738 | + status=PackageUploadStatus.ACCEPTED, name="bar", |
739 | + version="1.0-1", exact_match=True, archive=self.name16.archive) |
740 | self.assertEqual(queue_items.count(), 1) |
741 | |
742 | def testArchiveBinarySize(self): |
743 | diff --git a/lib/lp/archiveuploader/tests/test_recipeuploads.py b/lib/lp/archiveuploader/tests/test_recipeuploads.py |
744 | index 49f204a..013f5ef 100644 |
745 | --- a/lib/lp/archiveuploader/tests/test_recipeuploads.py |
746 | +++ b/lib/lp/archiveuploader/tests/test_recipeuploads.py |
747 | @@ -24,7 +24,7 @@ from lp.code.interfaces.sourcepackagerecipebuild import ( |
748 | class TestSourcePackageRecipeBuildUploads(TestUploadProcessorBase): |
749 | |
750 | def setUp(self): |
751 | - super(TestSourcePackageRecipeBuildUploads, self).setUp() |
752 | + super().setUp() |
753 | |
754 | self.setupBreezy() |
755 | |
756 | diff --git a/lib/lp/archiveuploader/tests/test_snapupload.py b/lib/lp/archiveuploader/tests/test_snapupload.py |
757 | index a5b8702..f7a9e14 100644 |
758 | --- a/lib/lp/archiveuploader/tests/test_snapupload.py |
759 | +++ b/lib/lp/archiveuploader/tests/test_snapupload.py |
760 | @@ -26,7 +26,7 @@ class TestSnapBuildUploads(TestUploadProcessorBase): |
761 | """End-to-end tests of Snap build uploads.""" |
762 | |
763 | def setUp(self): |
764 | - super(TestSnapBuildUploads, self).setUp() |
765 | + super().setUp() |
766 | |
767 | self.setupBreezy() |
768 | |
769 | diff --git a/lib/lp/archiveuploader/tests/test_uploadprocessor.py b/lib/lp/archiveuploader/tests/test_uploadprocessor.py |
770 | index 72e1976..2b5be80 100644 |
771 | --- a/lib/lp/archiveuploader/tests/test_uploadprocessor.py |
772 | +++ b/lib/lp/archiveuploader/tests/test_uploadprocessor.py |
773 | @@ -142,7 +142,7 @@ class TestUploadProcessorBase(TestCaseWithFactory): |
774 | switch_dbuser("launchpad_main") |
775 | |
776 | def setUp(self): |
777 | - super(TestUploadProcessorBase, self).setUp() |
778 | + super().setUp() |
779 | |
780 | self.queue_folder = tempfile.mkdtemp() |
781 | self.incoming_folder = os.path.join(self.queue_folder, "incoming") |
782 | @@ -174,7 +174,7 @@ class TestUploadProcessorBase(TestCaseWithFactory): |
783 | def tearDown(self): |
784 | shutil.rmtree(self.queue_folder) |
785 | self.switchToAdmin() |
786 | - super(TestUploadProcessorBase, self).tearDown() |
787 | + super().tearDown() |
788 | |
789 | def getUploadProcessor(self, txn, builds=None): |
790 | self.switchToAdmin() |
791 | @@ -550,7 +550,7 @@ class TestUploadProcessor(TestUploadProcessorBase): |
792 | |
793 | See bug 35965. |
794 | """ |
795 | - self.options.context = u'broken' |
796 | + self.options.context = 'broken' |
797 | # Register our broken upload policy. |
798 | getGlobalSiteManager().registerUtility( |
799 | component=BrokenUploadPolicy, provided=IArchiveUploadPolicy, |
800 | @@ -613,8 +613,8 @@ class TestUploadProcessor(TestUploadProcessorBase): |
801 | # the same package will work correctly. |
802 | self.switchToAdmin() |
803 | queue_items = self.breezy.getPackageUploads( |
804 | - status=PackageUploadStatus.NEW, name=u"bar", |
805 | - version=u"1.0-1", exact_match=True) |
806 | + status=PackageUploadStatus.NEW, name="bar", |
807 | + version="1.0-1", exact_match=True) |
808 | self.assertEqual(queue_items.count(), 1) |
809 | queue_item = queue_items[0] |
810 | |
811 | @@ -643,8 +643,8 @@ class TestUploadProcessor(TestUploadProcessorBase): |
812 | |
813 | # And verify that the queue item is in the unapproved state. |
814 | queue_items = self.breezy.getPackageUploads( |
815 | - status=PackageUploadStatus.UNAPPROVED, name=u"bar", |
816 | - version=u"1.0-2", exact_match=True) |
817 | + status=PackageUploadStatus.UNAPPROVED, name="bar", |
818 | + version="1.0-2", exact_match=True) |
819 | self.assertEqual(queue_items.count(), 1) |
820 | queue_item = queue_items[0] |
821 | self.assertEqual( |
822 | @@ -674,8 +674,8 @@ class TestUploadProcessor(TestUploadProcessorBase): |
823 | # Move the source from the accepted queue. |
824 | [queue_item] = self.breezy.getPackageUploads( |
825 | status=PackageUploadStatus.ACCEPTED, |
826 | - version=u"1.0-1", |
827 | - name=u"bar") |
828 | + version="1.0-1", |
829 | + name="bar") |
830 | queue_item.setDone() |
831 | |
832 | # Upload and accept a binary for the primary archive source. |
833 | @@ -729,8 +729,8 @@ class TestUploadProcessor(TestUploadProcessorBase): |
834 | # ancestry. This means items should go to ACCEPTED and not NEW. |
835 | queue_items = self.breezy.getPackageUploads( |
836 | status=PackageUploadStatus.ACCEPTED, |
837 | - version=u"1.0-1", |
838 | - name=u"bar", |
839 | + version="1.0-1", |
840 | + name="bar", |
841 | archive=copy_archive) |
842 | self.assertEqual( |
843 | queue_items.count(), 1, |
844 | @@ -825,8 +825,8 @@ class TestUploadProcessor(TestUploadProcessorBase): |
845 | self.processUpload(build_uploadprocessor, upload_dir, |
846 | build=bar_copied_build) |
847 | [duplicated_binary_upload] = breezy_autotest.getPackageUploads( |
848 | - status=PackageUploadStatus.NEW, name=u'bar', |
849 | - version=u'1.0-1', exact_match=True) |
850 | + status=PackageUploadStatus.NEW, name='bar', |
851 | + version='1.0-1', exact_match=True) |
852 | |
853 | # The just uploaded binary cannot be accepted because its |
854 | # filename 'bar_1.0-1_i386.deb' is already published in the |
855 | @@ -956,8 +956,8 @@ class TestUploadProcessor(TestUploadProcessorBase): |
856 | PackageUploadStatus.NEW) |
857 | |
858 | [queue_item] = self.breezy.getPackageUploads( |
859 | - status=PackageUploadStatus.NEW, name=u"foocomm", |
860 | - version=u"1.0-1", exact_match=True) |
861 | + status=PackageUploadStatus.NEW, name="foocomm", |
862 | + version="1.0-1", exact_match=True) |
863 | queue_item.setAccepted() |
864 | queue_item.realiseUpload() |
865 | self.layer.commit() |
866 | @@ -1119,15 +1119,15 @@ class TestUploadProcessor(TestUploadProcessorBase): |
867 | # with ancestry (previously uploaded) will skip the ACCEPTED state. |
868 | queue_items = self.breezy.getPackageUploads( |
869 | status=PackageUploadStatus.DONE, |
870 | - version=u"1.0-2", |
871 | - name=u"foocomm") |
872 | + version="1.0-2", |
873 | + name="foocomm") |
874 | self.assertEqual(queue_items.count(), 1) |
875 | |
876 | # Single source uploads also get their corrsponding builds created |
877 | # at upload-time. 'foocomm' only builds in 'i386', thus only one |
878 | # build gets created. |
879 | foocomm_source = partner_archive.getPublishedSources( |
880 | - name=u'foocomm', version='1.0-2').one() |
881 | + name='foocomm', version='1.0-2').one() |
882 | [build] = foocomm_source.sourcepackagerelease.builds |
883 | self.assertEqual( |
884 | build.title, |
885 | @@ -1142,8 +1142,8 @@ class TestUploadProcessor(TestUploadProcessorBase): |
886 | # Check that the binary upload was accepted: |
887 | queue_items = self.breezy.getPackageUploads( |
888 | status=PackageUploadStatus.ACCEPTED, |
889 | - version=u"1.0-2", |
890 | - name=u"foocomm") |
891 | + version="1.0-2", |
892 | + name="foocomm") |
893 | self.assertEqual(queue_items.count(), 1) |
894 | |
895 | def testPartnerUploadToProposedPocket(self): |
896 | @@ -1314,8 +1314,8 @@ class TestUploadProcessor(TestUploadProcessorBase): |
897 | self.processUpload(uploadprocessor, upload_dir) |
898 | |
899 | queue_items = self.breezy.getPackageUploads( |
900 | - status=PackageUploadStatus.NEW, name=u"bar", |
901 | - version=u"1.0-1", exact_match=True) |
902 | + status=PackageUploadStatus.NEW, name="bar", |
903 | + version="1.0-1", exact_match=True) |
904 | [queue_item] = queue_items |
905 | self.assertEqual( |
906 | queue_item.sourcepackagerelease.component.name, |
907 | @@ -1441,8 +1441,8 @@ class TestUploadProcessor(TestUploadProcessorBase): |
908 | |
909 | # Check in the queue to see if it really made it: |
910 | queue_items = self.breezy.getPackageUploads( |
911 | - status=PackageUploadStatus.NEW, name=u"bar", |
912 | - version=u"1.0-1", exact_match=True) |
913 | + status=PackageUploadStatus.NEW, name="bar", |
914 | + version="1.0-1", exact_match=True) |
915 | self.assertEqual( |
916 | queue_items.count(), 1, |
917 | "Expected one 'bar' item in the queue, actually got %d." |
918 | @@ -1480,8 +1480,8 @@ class TestUploadProcessor(TestUploadProcessorBase): |
919 | |
920 | # Check in the queue to see if it really made it: |
921 | queue_items = self.breezy.getPackageUploads( |
922 | - status=PackageUploadStatus.NEW, name=u"bar", |
923 | - version=u"1.0-1", exact_match=True) |
924 | + status=PackageUploadStatus.NEW, name="bar", |
925 | + version="1.0-1", exact_match=True) |
926 | self.assertEqual( |
927 | queue_items.count(), 1, |
928 | "Expected one 'bar' item in the queue, actually got %d." |
929 | @@ -1611,7 +1611,7 @@ class TestUploadProcessor(TestUploadProcessorBase): |
930 | # Make sure it failed. |
931 | self.assertEqual( |
932 | uploadprocessor.last_processed_upload.rejection_message, |
933 | - u"Signer is not permitted to upload to the component 'universe'.") |
934 | + "Signer is not permitted to upload to the component 'universe'.") |
935 | |
936 | # Now add permission to upload "bar" for name16. |
937 | self.switchToAdmin() |
938 | @@ -1676,7 +1676,7 @@ class TestUploadProcessor(TestUploadProcessorBase): |
939 | ap_set = getUtility(IArchivePermissionSet) |
940 | ps_set = getUtility(IPackagesetSet) |
941 | foo_ps = ps_set.new( |
942 | - u'foo-pkg-set', u'Packages that require special care.', uploader, |
943 | + 'foo-pkg-set', 'Packages that require special care.', uploader, |
944 | distroseries=self.ubuntu['grumpy']) |
945 | self.layer.txn.commit() |
946 | |
947 | @@ -1707,7 +1707,7 @@ class TestUploadProcessor(TestUploadProcessorBase): |
948 | # Grant the permissions in the proper series. |
949 | self.switchToAdmin() |
950 | breezy_ps = ps_set.new( |
951 | - u'foo-pkg-set-breezy', u'Packages that require special care.', |
952 | + 'foo-pkg-set-breezy', 'Packages that require special care.', |
953 | uploader, distroseries=self.breezy) |
954 | breezy_ps.add((bar_package, )) |
955 | ap_set.newPackagesetUploader( |
956 | @@ -1969,8 +1969,8 @@ class TestUploadProcessor(TestUploadProcessorBase): |
957 | self.processUpload(uploadprocessor, upload_dir) |
958 | # ACCEPT the upload |
959 | queue_items = self.breezy.getPackageUploads( |
960 | - status=PackageUploadStatus.NEW, name=u"bar", |
961 | - version=u"1.0-1", exact_match=True) |
962 | + status=PackageUploadStatus.NEW, name="bar", |
963 | + version="1.0-1", exact_match=True) |
964 | self.assertEqual(queue_items.count(), 1) |
965 | self.switchToAdmin() |
966 | queue_item = queue_items[0] |
967 | @@ -2114,8 +2114,8 @@ class TestUploadProcessor(TestUploadProcessorBase): |
968 | "recipient": None, |
969 | }], allow_leftover=True) |
970 | [queue_item] = self.breezy.getPackageUploads( |
971 | - status=PackageUploadStatus.NEW, name=u"bar", |
972 | - version=u"1.0-1", exact_match=True) |
973 | + status=PackageUploadStatus.NEW, name="bar", |
974 | + version="1.0-1", exact_match=True) |
975 | self.assertEqual(PackagePublishingPocket.PROPOSED, queue_item.pocket) |
976 | |
977 | queue_item.acceptFromQueue() |
978 | @@ -2128,8 +2128,8 @@ class TestUploadProcessor(TestUploadProcessorBase): |
979 | "recipient": None, |
980 | }], allow_leftover=True) |
981 | [queue_item] = self.breezy.getPackageUploads( |
982 | - status=PackageUploadStatus.DONE, name=u"bar", |
983 | - version=u"1.0-2", exact_match=True) |
984 | + status=PackageUploadStatus.DONE, name="bar", |
985 | + version="1.0-2", exact_match=True) |
986 | self.assertEqual(PackagePublishingPocket.PROPOSED, queue_item.pocket) |
987 | |
988 | def test_source_buildinfo(self): |
989 | @@ -2155,7 +2155,7 @@ class TestUploadProcessor(TestUploadProcessorBase): |
990 | self.switchToAdmin() |
991 | [queue_item] = self.breezy.getPackageUploads( |
992 | status=PackageUploadStatus.ACCEPTED, |
993 | - version=u"1.0-1", name=u"bar") |
994 | + version="1.0-1", name="bar") |
995 | queue_item.setDone() |
996 | build.buildqueue_record.markAsBuilding(self.factory.makeBuilder()) |
997 | build.updateStatus( |
998 | @@ -2187,7 +2187,7 @@ class TestUploadProcessor(TestUploadProcessorBase): |
999 | self.switchToAdmin() |
1000 | [queue_item] = self.breezy.getPackageUploads( |
1001 | status=PackageUploadStatus.ACCEPTED, |
1002 | - version=u"1.0-1", name=u"bar") |
1003 | + version="1.0-1", name="bar") |
1004 | queue_item.setDone() |
1005 | build.buildqueue_record.markAsBuilding(self.factory.makeBuilder()) |
1006 | build.updateStatus( |
1007 | @@ -2213,7 +2213,7 @@ class TestUploadProcessor(TestUploadProcessorBase): |
1008 | class TestUploadHandler(TestUploadProcessorBase): |
1009 | |
1010 | def setUp(self): |
1011 | - super(TestUploadHandler, self).setUp() |
1012 | + super().setUp() |
1013 | self.uploadprocessor = self.setupBreezyAndGetUploadProcessor() |
1014 | |
1015 | def testInvalidLeafName(self): |
1016 | @@ -2252,7 +2252,7 @@ class TestUploadHandler(TestUploadProcessorBase): |
1017 | self.switchToAdmin() |
1018 | [queue_item] = self.breezy.getPackageUploads( |
1019 | status=PackageUploadStatus.ACCEPTED, |
1020 | - version=u"1.0-1", name=u"bar") |
1021 | + version="1.0-1", name="bar") |
1022 | queue_item.setDone() |
1023 | |
1024 | builder = self.factory.makeBuilder() |
1025 | @@ -2295,7 +2295,7 @@ class TestUploadHandler(TestUploadProcessorBase): |
1026 | self.switchToAdmin() |
1027 | [queue_item] = self.breezy.getPackageUploads( |
1028 | status=PackageUploadStatus.ACCEPTED, |
1029 | - version=u"1.0-1", name=u"bar") |
1030 | + version="1.0-1", name="bar") |
1031 | queue_item.setDone() |
1032 | |
1033 | build.buildqueue_record.markAsBuilding(self.factory.makeBuilder()) |
1034 | @@ -2328,7 +2328,7 @@ class TestUploadHandler(TestUploadProcessorBase): |
1035 | self.switchToAdmin() |
1036 | archive = self.factory.makeArchive() |
1037 | archive.require_virtualized = False |
1038 | - build = self.factory.makeSourcePackageRecipeBuild(sourcename=u"bar", |
1039 | + build = self.factory.makeSourcePackageRecipeBuild(sourcename="bar", |
1040 | distroseries=self.breezy, archive=archive, |
1041 | requester=archive.owner) |
1042 | self.assertEqual(archive.owner, build.requester) |
1043 | @@ -2377,7 +2377,7 @@ class TestUploadHandler(TestUploadProcessorBase): |
1044 | self.switchToAdmin() |
1045 | archive = self.factory.makeArchive() |
1046 | archive.require_virtualized = False |
1047 | - build = self.factory.makeSourcePackageRecipeBuild(sourcename=u"bar", |
1048 | + build = self.factory.makeSourcePackageRecipeBuild(sourcename="bar", |
1049 | distroseries=self.breezy, archive=archive) |
1050 | # Commit so the build cookie has the right ids. |
1051 | Store.of(build).flush() |
1052 | @@ -2418,7 +2418,7 @@ class TestUploadHandler(TestUploadProcessorBase): |
1053 | self.switchToAdmin() |
1054 | archive = self.factory.makeArchive() |
1055 | archive.require_virtualized = False |
1056 | - build = self.factory.makeSourcePackageRecipeBuild(sourcename=u"bar", |
1057 | + build = self.factory.makeSourcePackageRecipeBuild(sourcename="bar", |
1058 | distroseries=self.breezy, archive=archive) |
1059 | self.switchToUploader() |
1060 | # Commit so the build cookie has the right ids. |
1061 | @@ -2480,7 +2480,7 @@ class TestUploadHandler(TestUploadProcessorBase): |
1062 | self.switchToAdmin() |
1063 | [queue_item] = self.breezy.getPackageUploads( |
1064 | status=PackageUploadStatus.ACCEPTED, |
1065 | - version=u"1.0-1", name=u"bar") |
1066 | + version="1.0-1", name="bar") |
1067 | queue_item.setDone() |
1068 | pop_notifications() |
1069 | |
1070 | diff --git a/lib/lp/archiveuploader/tests/test_utils.py b/lib/lp/archiveuploader/tests/test_utils.py |
1071 | index 03ed90e..e65a6b5 100755 |
1072 | --- a/lib/lp/archiveuploader/tests/test_utils.py |
1073 | +++ b/lib/lp/archiveuploader/tests/test_utils.py |
1074 | @@ -5,8 +5,6 @@ |
1075 | |
1076 | import os |
1077 | |
1078 | -import six |
1079 | - |
1080 | from lp.archiveuploader.tests import datadir |
1081 | from lp.archiveuploader.utils import ( |
1082 | determine_binary_file_type, |
1083 | @@ -170,54 +168,54 @@ class TestUtilities(TestCase): |
1084 | ) |
1085 | cases = ( |
1086 | (b"No\xc3\xa8l K\xc3\xb6the <noel@debian.org>", |
1087 | - u"No\xe8l K\xf6the <noel@debian.org>", |
1088 | - u"No\xe8l K\xf6the", |
1089 | - u"noel@debian.org"), |
1090 | + "No\xe8l K\xf6the <noel@debian.org>", |
1091 | + "No\xe8l K\xf6the", |
1092 | + "noel@debian.org"), |
1093 | |
1094 | (b"No\xe8l K\xf6the <noel@debian.org>", |
1095 | - u"No\xe8l K\xf6the <noel@debian.org>", |
1096 | - u"No\xe8l K\xf6the", |
1097 | - u"noel@debian.org"), |
1098 | + "No\xe8l K\xf6the <noel@debian.org>", |
1099 | + "No\xe8l K\xf6the", |
1100 | + "noel@debian.org"), |
1101 | |
1102 | ("James Troup <james@nocrew.org>", |
1103 | - u"James Troup <james@nocrew.org>", |
1104 | - u"James Troup", |
1105 | - u"james@nocrew.org"), |
1106 | + "James Troup <james@nocrew.org>", |
1107 | + "James Troup", |
1108 | + "james@nocrew.org"), |
1109 | |
1110 | ("James J. Troup <james@nocrew.org>", |
1111 | - u"james@nocrew.org (James J. Troup)", |
1112 | - u"James J. Troup", |
1113 | - u"james@nocrew.org"), |
1114 | + "james@nocrew.org (James J. Troup)", |
1115 | + "James J. Troup", |
1116 | + "james@nocrew.org"), |
1117 | |
1118 | ("James J, Troup <james@nocrew.org>", |
1119 | - u"james@nocrew.org (James J, Troup)", |
1120 | - u"James J, Troup", |
1121 | - u"james@nocrew.org"), |
1122 | + "james@nocrew.org (James J, Troup)", |
1123 | + "James J, Troup", |
1124 | + "james@nocrew.org"), |
1125 | |
1126 | ("james@nocrew.org", |
1127 | - u" <james@nocrew.org>", |
1128 | - u"", |
1129 | - u"james@nocrew.org"), |
1130 | + " <james@nocrew.org>", |
1131 | + "", |
1132 | + "james@nocrew.org"), |
1133 | |
1134 | ("<james@nocrew.org>", |
1135 | - u" <james@nocrew.org>", |
1136 | - u"", |
1137 | - u"james@nocrew.org"), |
1138 | + " <james@nocrew.org>", |
1139 | + "", |
1140 | + "james@nocrew.org"), |
1141 | |
1142 | ("Cris van Pelt <\"Cris van Pelt\"@tribe.eu.org>", |
1143 | - u"Cris van Pelt <\"Cris van Pelt\"@tribe.eu.org>", |
1144 | - u"Cris van Pelt", |
1145 | - u"\"Cris van Pelt\"@tribe.eu.org"), |
1146 | + "Cris van Pelt <\"Cris van Pelt\"@tribe.eu.org>", |
1147 | + "Cris van Pelt", |
1148 | + "\"Cris van Pelt\"@tribe.eu.org"), |
1149 | |
1150 | ("Zak B. Elep <zakame@ubuntu.com>", |
1151 | - u"zakame@ubuntu.com (Zak B. Elep)", |
1152 | - u"Zak B. Elep", |
1153 | - u"zakame@ubuntu.com"), |
1154 | + "zakame@ubuntu.com (Zak B. Elep)", |
1155 | + "Zak B. Elep", |
1156 | + "zakame@ubuntu.com"), |
1157 | |
1158 | ("zakame@ubuntu.com (Zak B. Elep)", |
1159 | - u" <zakame@ubuntu.com (Zak B. Elep)>", |
1160 | - u"", |
1161 | - u"zakame@ubuntu.com (Zak B. Elep)"), |
1162 | + " <zakame@ubuntu.com (Zak B. Elep)>", |
1163 | + "", |
1164 | + "zakame@ubuntu.com (Zak B. Elep)"), |
1165 | ) |
1166 | |
1167 | for case in cases: |
1168 | @@ -253,7 +251,7 @@ class TestUtilities(TestCase): |
1169 | try: |
1170 | parse_maintainer_bytes(case[0], 'Maintainer') |
1171 | except ParseMaintError as e: |
1172 | - self.assertEqual(case[1], six.text_type(e)) |
1173 | + self.assertEqual(case[1], str(e)) |
1174 | else: |
1175 | self.fail('ParseMaintError not raised') |
1176 | |
1177 | diff --git a/lib/lp/archiveuploader/uploadpolicy.py b/lib/lp/archiveuploader/uploadpolicy.py |
1178 | index 88a363d..1151deb 100644 |
1179 | --- a/lib/lp/archiveuploader/uploadpolicy.py |
1180 | +++ b/lib/lp/archiveuploader/uploadpolicy.py |
1181 | @@ -190,7 +190,7 @@ class InsecureUploadPolicy(AbstractUploadPolicy): |
1182 | accepted_type = ArchiveUploadType.SOURCE_ONLY |
1183 | |
1184 | def __init__(self): |
1185 | - super(InsecureUploadPolicy, self).__init__() |
1186 | + super().__init__() |
1187 | # Signatures on source buildinfo files aren't a big deal, and older |
1188 | # versions of debsign didn't produce them. |
1189 | self.unsigned_buildinfo_ok = True |
1190 | @@ -201,7 +201,7 @@ class InsecureUploadPolicy(AbstractUploadPolicy): |
1191 | The insecure policy redirects uploads to a different pocket if |
1192 | Distribution.redirect_release_uploads is set. |
1193 | """ |
1194 | - super(InsecureUploadPolicy, self).setDistroSeriesAndPocket(dr_name) |
1195 | + super().setDistroSeriesAndPocket(dr_name) |
1196 | if (self.archive.purpose == ArchivePurpose.PRIMARY and |
1197 | self.distro.redirect_release_uploads and |
1198 | self.pocket == PackagePublishingPocket.RELEASE): |
1199 | @@ -292,7 +292,7 @@ class BuildDaemonUploadPolicy(AbstractUploadPolicy): |
1200 | name = 'buildd' |
1201 | |
1202 | def __init__(self): |
1203 | - super(BuildDaemonUploadPolicy, self).__init__() |
1204 | + super().__init__() |
1205 | # We permit unsigned uploads because we trust our build daemons |
1206 | self.unsigned_changes_ok = True |
1207 | self.unsigned_dsc_ok = True |
1208 | @@ -300,7 +300,7 @@ class BuildDaemonUploadPolicy(AbstractUploadPolicy): |
1209 | |
1210 | def setOptions(self, options): |
1211 | """Store the options for later.""" |
1212 | - super(BuildDaemonUploadPolicy, self).setOptions(options) |
1213 | + super().setOptions(options) |
1214 | options.builds = True |
1215 | |
1216 | def policySpecificChecks(self, upload): |
1217 | diff --git a/lib/lp/archiveuploader/uploadprocessor.py b/lib/lp/archiveuploader/uploadprocessor.py |
1218 | index c5341b0..b71d0aa 100644 |
1219 | --- a/lib/lp/archiveuploader/uploadprocessor.py |
1220 | +++ b/lib/lp/archiveuploader/uploadprocessor.py |
1221 | @@ -555,7 +555,7 @@ class BuildUploadHandler(UploadHandler): |
1222 | will be retrieved using the id in the upload. |
1223 | :raises: CannotGetBuild if the build could not be retrieved. |
1224 | """ |
1225 | - super(BuildUploadHandler, self).__init__(processor, fsroot, upload) |
1226 | + super().__init__(processor, fsroot, upload) |
1227 | self.build = build |
1228 | if self.build is None: |
1229 | self.build = self._getBuild() |
1230 | diff --git a/lib/lp/archiveuploader/utils.py b/lib/lp/archiveuploader/utils.py |
1231 | index 5ff24d2..94e61df 100644 |
1232 | --- a/lib/lp/archiveuploader/utils.py |
1233 | +++ b/lib/lp/archiveuploader/utils.py |
1234 | @@ -56,7 +56,7 @@ class DpkgSourceError(Exception): |
1235 | _fmt = "Unable to unpack source package (%(result)s): %(output)s" |
1236 | |
1237 | def __init__(self, command, output, result): |
1238 | - super(DpkgSourceError, self).__init__( |
1239 | + super().__init__( |
1240 | self._fmt % { |
1241 | "output": output, "result": result, "command": command}) |
1242 | self.output = output |
1243 | @@ -179,14 +179,14 @@ def parse_maintainer(maintainer, field_name="Maintainer"): |
1244 | """ |
1245 | maintainer = maintainer.strip() |
1246 | if not maintainer: |
1247 | - return (u'', u'') |
1248 | + return ('', '') |
1249 | |
1250 | - if maintainer.find(u"<") == -1: |
1251 | + if maintainer.find("<") == -1: |
1252 | email = maintainer |
1253 | - name = u"" |
1254 | - elif (maintainer[0] == u"<" and maintainer[-1:] == u">"): |
1255 | + name = "" |
1256 | + elif (maintainer[0] == "<" and maintainer[-1:] == ">"): |
1257 | email = maintainer[1:-1] |
1258 | - name = u"" |
1259 | + name = "" |
1260 | else: |
1261 | m = re_parse_maintainer.match(maintainer) |
1262 | if not m: |
1263 | @@ -195,10 +195,10 @@ def parse_maintainer(maintainer, field_name="Maintainer"): |
1264 | name = m.group(1) |
1265 | email = m.group(2) |
1266 | # Just in case the maintainer ended up with nested angles; check... |
1267 | - while email.startswith(u"<"): |
1268 | + while email.startswith("<"): |
1269 | email = email[1:] |
1270 | |
1271 | - if email.find(u"@") == -1 and email.find(u"buildd_") != 0: |
1272 | + if email.find("@") == -1 and email.find("buildd_") != 0: |
1273 | raise ParseMaintError("%s: no @ found in email address part." |
1274 | % maintainer) |
1275 | |
1276 | @@ -211,7 +211,7 @@ def parse_maintainer_bytes(content, fieldname): |
1277 | It verifies the content type and transforms it to text with |
1278 | guess(). Then we can safely call parse_maintainer(). |
1279 | """ |
1280 | - if not isinstance(content, six.text_type): |
1281 | + if not isinstance(content, str): |
1282 | content = guess_encoding(content) |
1283 | return parse_maintainer(content, fieldname) |
1284 | |
1285 | @@ -231,10 +231,10 @@ def rfc822_encode_address(name, email): |
1286 | # not work directly as an email address due to a misfeature in the syntax |
1287 | # specified in RFC822; see Debian policy 5.6.2 (Maintainer field syntax) |
1288 | # for details. |
1289 | - if name.find(u',') != -1 or name.find(u'.') != -1: |
1290 | - return u"%s (%s)" % (email, name) |
1291 | + if name.find(',') != -1 or name.find('.') != -1: |
1292 | + return "%s (%s)" % (email, name) |
1293 | else: |
1294 | - return u"%s <%s>" % (name, email) |
1295 | + return "%s <%s>" % (name, email) |
1296 | |
1297 | |
1298 | def extract_dpkg_source(dsc_filepath, target, vendor=None): |
1299 | @@ -324,7 +324,7 @@ def merge_file_lists(files, checksums_sha1, checksums_sha256, changes=True): |
1300 | (filename, file_hashes[filename], size)) |
1301 | |
1302 | # Ensure that each filename was only listed in Files once. |
1303 | - if set(six.itervalues(file_counter)) - {1}: |
1304 | + if set(file_counter.values()) - {1}: |
1305 | raise UploadError("Duplicate filenames in Files field.") |
1306 | |
1307 | # Ensure that the Checksums-Sha1 and Checksums-Sha256 fields, if |