Merge ~cjwatson/launchpad-buildd:unsixify into launchpad-buildd:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 894faff97953dcc1fe013c4d160b48bae2bb887a
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad-buildd:unsixify
Merge into: launchpad-buildd:master
Diff against target: 485 lines (+49/-70)
24 files modified
bin/test_buildd_generatetranslationtemplates (+1/-2)
bin/test_buildd_recipe (+1/-2)
debian/changelog (+6/-0)
debian/control (+0/-1)
lpbuildd/builder.py (+4/-4)
lpbuildd/ci.py (+4/-4)
lpbuildd/debian.py (+4/-4)
lpbuildd/livefs.py (+2/-3)
lpbuildd/oci.py (+4/-5)
lpbuildd/pottery/tests/test_intltool.py (+1/-1)
lpbuildd/proxy.py (+4/-4)
lpbuildd/snap.py (+2/-3)
lpbuildd/target/build_snap.py (+1/-2)
lpbuildd/target/chroot.py (+0/-6)
lpbuildd/target/lxd.py (+0/-5)
lpbuildd/target/snapstore.py (+3/-2)
lpbuildd/target/tests/test_chroot.py (+1/-2)
lpbuildd/target/tests/test_lxd.py (+1/-3)
lpbuildd/tests/fakebuilder.py (+4/-5)
lpbuildd/tests/test_buildd.py (+2/-2)
lpbuildd/tests/test_builder.py (+1/-4)
lpbuildd/tests/test_buildrecipe.py (+3/-4)
setup.py (+0/-1)
system-dependencies.txt (+0/-1)
Reviewer Review Type Date Requested Status
Andrey Fedoseev Approve
Review via email: mp+429742@code.launchpad.net

Commit message

Remove use of six

To post a comment you must log in.
Revision history for this message
Andrey Fedoseev (andrey-fedoseev) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/test_buildd_generatetranslationtemplates b/bin/test_buildd_generatetranslationtemplates
2index e981ef0..9cce305 100755
3--- a/bin/test_buildd_generatetranslationtemplates
4+++ b/bin/test_buildd_generatetranslationtemplates
5@@ -6,8 +6,7 @@
6 # TranslationTemplatesBuildManager through XMLRPC.
7
8 import sys
9-
10-from six.moves.xmlrpc_client import ServerProxy
11+from xmlrpc.client import ServerProxy
12
13 if len(sys.argv) != 2:
14 print("Usage: %s <chroot_sha1>" % sys.argv[0])
15diff --git a/bin/test_buildd_recipe b/bin/test_buildd_recipe
16index 89803e6..9090688 100755
17--- a/bin/test_buildd_recipe
18+++ b/bin/test_buildd_recipe
19@@ -6,8 +6,7 @@
20 # recipe, without involving the BuilderBehaviour.
21
22 import sys
23-
24-from six.moves.xmlrpc_client import ServerProxy
25+from xmlrpc.client import ServerProxy
26
27 country_code = 'us'
28 apt_cacher_ng_host = 'stumpy'
29diff --git a/debian/changelog b/debian/changelog
30index b10ccb5..aa2253a 100644
31--- a/debian/changelog
32+++ b/debian/changelog
33@@ -1,3 +1,9 @@
34+launchpad-buildd (222) UNRELEASED; urgency=medium
35+
36+ * Remove use of six.
37+
38+ -- Colin Watson <cjwatson@ubuntu.com> Mon, 12 Sep 2022 09:50:13 +0100
39+
40 launchpad-buildd (221) focal; urgency=medium
41
42 [ Andy Whitcroft ]
43diff --git a/debian/control b/debian/control
44index a9e3850..b881694 100644
45--- a/debian/control
46+++ b/debian/control
47@@ -23,7 +23,6 @@ Build-Depends: apt-utils,
48 python3-requests,
49 python3-responses,
50 python3-setuptools,
51- python3-six,
52 python3-systemfixtures,
53 python3-testtools,
54 python3-twisted (>= 16.4.0),
55diff --git a/lpbuildd/builder.py b/lpbuildd/builder.py
56index 336594c..2f256ad 100644
57--- a/lpbuildd/builder.py
58+++ b/lpbuildd/builder.py
59@@ -14,15 +14,15 @@ import re
60 import shutil
61 import sys
62 import tempfile
63-
64-import apt
65-from six.moves.urllib.request import (
66+from urllib.request import (
67 build_opener,
68 HTTPBasicAuthHandler,
69 HTTPPasswordMgrWithDefaultRealm,
70 urlopen,
71 )
72-from six.moves.xmlrpc_client import Binary
73+from xmlrpc.client import Binary
74+
75+import apt
76 from twisted.internet import protocol
77 from twisted.internet import reactor as default_reactor
78 from twisted.internet import process
79diff --git a/lpbuildd/ci.py b/lpbuildd/ci.py
80index 3401aae..c49a24c 100644
81--- a/lpbuildd/ci.py
82+++ b/lpbuildd/ci.py
83@@ -1,14 +1,14 @@
84 # Copyright 2022 Canonical Ltd. This software is licensed under the
85 # GNU Affero General Public License version 3 (see the file LICENSE).
86
87+from configparser import (
88+ NoOptionError,
89+ NoSectionError,
90+ )
91 import os
92 import tempfile
93 import yaml
94
95-from six.moves.configparser import (
96- NoOptionError,
97- NoSectionError,
98- )
99 from twisted.internet import defer
100
101 from lpbuildd.debian import (
102diff --git a/lpbuildd/debian.py b/lpbuildd/debian.py
103index 5cb47e7..f66bf27 100644
104--- a/lpbuildd/debian.py
105+++ b/lpbuildd/debian.py
106@@ -5,14 +5,14 @@
107 # and Adam Conrad <adam.conrad@canonical.com>
108
109 import base64
110+from configparser import (
111+ NoOptionError,
112+ NoSectionError,
113+ )
114 import os
115 import re
116 import signal
117
118-from six.moves.configparser import (
119- NoOptionError,
120- NoSectionError,
121- )
122 from twisted.internet import (
123 defer,
124 threads,
125diff --git a/lpbuildd/livefs.py b/lpbuildd/livefs.py
126index f627e76..3cc2fb3 100644
127--- a/lpbuildd/livefs.py
128+++ b/lpbuildd/livefs.py
129@@ -1,12 +1,11 @@
130 # Copyright 2013-2019 Canonical Ltd. This software is licensed under the
131 # GNU Affero General Public License version 3 (see the file LICENSE).
132
133-import os
134-
135-from six.moves.configparser import (
136+from configparser import (
137 NoOptionError,
138 NoSectionError,
139 )
140+import os
141
142 from lpbuildd.debian import (
143 DebianBuildManager,
144diff --git a/lpbuildd/oci.py b/lpbuildd/oci.py
145index fdce1aa..e112caf 100644
146--- a/lpbuildd/oci.py
147+++ b/lpbuildd/oci.py
148@@ -1,6 +1,10 @@
149 # Copyright 2019 Canonical Ltd. This software is licensed under the
150 # GNU Affero General Public License version 3 (see the file LICENSE).
151
152+from configparser import (
153+ NoOptionError,
154+ NoSectionError,
155+ )
156 import gzip
157 import hashlib
158 import json
159@@ -9,11 +13,6 @@ import shutil
160 import tarfile
161 import tempfile
162
163-from six.moves.configparser import (
164- NoOptionError,
165- NoSectionError,
166- )
167-
168 from lpbuildd.debian import (
169 DebianBuildManager,
170 DebianBuildState,
171diff --git a/lpbuildd/pottery/tests/test_intltool.py b/lpbuildd/pottery/tests/test_intltool.py
172index b540c1d..28ff021 100644
173--- a/lpbuildd/pottery/tests/test_intltool.py
174+++ b/lpbuildd/pottery/tests/test_intltool.py
175@@ -2,12 +2,12 @@
176 # GNU Affero General Public License version 3 (see the file LICENSE).
177
178 import errno
179+from io import StringIO
180 import os
181 import tarfile
182 from textwrap import dedent
183
184 from fixtures import TempDir
185-from six import StringIO
186 from testtools import TestCase
187 from testtools.matchers import (
188 Equals,
189diff --git a/lpbuildd/proxy.py b/lpbuildd/proxy.py
190index 9c56780..94a383f 100644
191--- a/lpbuildd/proxy.py
192+++ b/lpbuildd/proxy.py
193@@ -3,16 +3,16 @@
194
195 import base64
196 import io
197-
198-from six.moves.urllib.error import (
199+from urllib.error import (
200 HTTPError,
201 URLError,
202 )
203-from six.moves.urllib.parse import urlparse
204-from six.moves.urllib.request import (
205+from urllib.parse import urlparse
206+from urllib.request import (
207 Request,
208 urlopen,
209 )
210+
211 from twisted.application import strports
212 from twisted.internet import reactor
213 from twisted.internet.interfaces import IHalfCloseableProtocol
214diff --git a/lpbuildd/snap.py b/lpbuildd/snap.py
215index cd90106..07d9f3e 100644
216--- a/lpbuildd/snap.py
217+++ b/lpbuildd/snap.py
218@@ -1,12 +1,11 @@
219 # Copyright 2015-2019 Canonical Ltd. This software is licensed under the
220 # GNU Affero General Public License version 3 (see the file LICENSE).
221
222-import os
223-
224-from six.moves.configparser import (
225+from configparser import (
226 NoOptionError,
227 NoSectionError,
228 )
229+import os
230
231 from lpbuildd.debian import (
232 DebianBuildManager,
233diff --git a/lpbuildd/target/build_snap.py b/lpbuildd/target/build_snap.py
234index 9a8efec..30c5ecc 100644
235--- a/lpbuildd/target/build_snap.py
236+++ b/lpbuildd/target/build_snap.py
237@@ -7,8 +7,7 @@ import logging
238 import os.path
239 import tempfile
240 from textwrap import dedent
241-
242-from six.moves.urllib.parse import urlparse
243+from urllib.parse import urlparse
244
245 from lpbuildd.target.operation import Operation
246 from lpbuildd.target.proxy import BuilderProxyOperationMixin
247diff --git a/lpbuildd/target/chroot.py b/lpbuildd/target/chroot.py
248index 27c6e01..11752c8 100644
249--- a/lpbuildd/target/chroot.py
250+++ b/lpbuildd/target/chroot.py
251@@ -7,8 +7,6 @@ import stat
252 import subprocess
253 import time
254
255-import six
256-
257 from lpbuildd.target.backend import (
258 Backend,
259 BackendException,
260@@ -73,10 +71,6 @@ class Chroot(Backend):
261 if echo:
262 print("Running in chroot: %s" % ' '.join(
263 shell_escape(arg) for arg in args))
264- if six.PY2:
265- # The behaviour of non-bytes subprocess arguments in Python 2
266- # depends on the interpreter's startup locale.
267- args = [arg.encode("UTF-8") for arg in args]
268 cmd = ["sudo", "/usr/sbin/chroot", self.chroot_path] + args
269 if input_text is None and not get_output:
270 subprocess.check_call(cmd, **kwargs)
271diff --git a/lpbuildd/target/lxd.py b/lpbuildd/target/lxd.py
272index fbb6f14..d58d9ab 100644
273--- a/lpbuildd/target/lxd.py
274+++ b/lpbuildd/target/lxd.py
275@@ -16,7 +16,6 @@ import time
276 import netaddr
277 import pylxd
278 from pylxd.exceptions import LXDAPIException
279-import six
280
281 from lpbuildd.target.backend import (
282 Backend,
283@@ -532,10 +531,6 @@ class LXD(Backend):
284 if echo:
285 print("Running in container: %s" % ' '.join(
286 shell_escape(arg) for arg in args))
287- if six.PY2:
288- # The behaviour of non-bytes subprocess arguments in Python 2
289- # depends on the interpreter's startup locale.
290- args = [arg.encode("UTF-8") for arg in args]
291 # pylxd's Container.execute doesn't support sending stdin, and it's
292 # tedious to implement ourselves.
293 cmd = ["lxc", "exec", self.name] + env_params + ["--"] + args
294diff --git a/lpbuildd/target/snapstore.py b/lpbuildd/target/snapstore.py
295index a46bb5a..e087d7e 100644
296--- a/lpbuildd/target/snapstore.py
297+++ b/lpbuildd/target/snapstore.py
298@@ -1,13 +1,14 @@
299 # Copyright 2019 Canonical Ltd. This software is licensed under the
300 # GNU Affero General Public License version 3 (see the file LICENSE).
301
302-import requests
303-from six.moves.urllib.parse import (
304+from urllib.parse import (
305 urljoin,
306 urlparse,
307 urlunparse,
308 )
309
310+import requests
311+
312
313 class SnapStoreOperationMixin:
314 """Methods supporting operations that interact with the snap store."""
315diff --git a/lpbuildd/target/tests/test_chroot.py b/lpbuildd/target/tests/test_chroot.py
316index e77c455..a8971d3 100644
317--- a/lpbuildd/target/tests/test_chroot.py
318+++ b/lpbuildd/target/tests/test_chroot.py
319@@ -11,7 +11,6 @@ from fixtures import (
320 EnvironmentVariable,
321 TempDir,
322 )
323-import six
324 from systemfixtures import (
325 FakeProcesses,
326 FakeTime,
327@@ -131,7 +130,7 @@ class TestChroot(TestCase):
328 expected_args = [
329 ["sudo", "/usr/sbin/chroot",
330 "/expected/home/build-1/chroot-autobuild",
331- "linux64", "echo", arg.encode("UTF-8") if six.PY2 else arg],
332+ "linux64", "echo", arg],
333 ]
334 self.assertEqual(
335 expected_args,
336diff --git a/lpbuildd/target/tests/test_lxd.py b/lpbuildd/target/tests/test_lxd.py
337index 8258d0f..ecf3ddd 100644
338--- a/lpbuildd/target/tests/test_lxd.py
339+++ b/lpbuildd/target/tests/test_lxd.py
340@@ -20,7 +20,6 @@ from fixtures import (
341 )
342 import pylxd
343 from pylxd.exceptions import LXDAPIException
344-import six
345 from systemfixtures import (
346 FakeFilesystem as _FakeFilesystem,
347 FakeProcesses,
348@@ -645,8 +644,7 @@ class TestLXD(TestCase):
349 LXD("1", "xenial", "amd64").run(["echo", arg])
350
351 expected_args = [
352- ["lxc", "exec", "lp-xenial-amd64", "--",
353- "linux64", "echo", arg.encode("UTF-8") if six.PY2 else arg],
354+ ["lxc", "exec", "lp-xenial-amd64", "--", "linux64", "echo", arg],
355 ]
356 self.assertEqual(
357 expected_args,
358diff --git a/lpbuildd/tests/fakebuilder.py b/lpbuildd/tests/fakebuilder.py
359index 268fd13..24a40b2 100644
360--- a/lpbuildd/tests/fakebuilder.py
361+++ b/lpbuildd/tests/fakebuilder.py
362@@ -9,17 +9,16 @@ __all__ = [
363 ]
364
365 from collections import defaultdict
366+from configparser import (
367+ NoOptionError,
368+ NoSectionError,
369+ )
370 import hashlib
371 import os
372 import shutil
373 import stat
374 import subprocess
375
376-from six.moves.configparser import (
377- NoOptionError,
378- NoSectionError,
379- )
380-
381 from lpbuildd.target.backend import Backend
382 from lpbuildd.util import (
383 set_personality,
384diff --git a/lpbuildd/tests/test_buildd.py b/lpbuildd/tests/test_buildd.py
385index 3cecb5a..9eb421d 100644
386--- a/lpbuildd/tests/test_buildd.py
387+++ b/lpbuildd/tests/test_buildd.py
388@@ -19,9 +19,9 @@ import shutil
389 import sys
390 import tempfile
391 import unittest
392+from urllib.request import HTTPBasicAuthHandler
393+from xmlrpc.client import ServerProxy
394
395-from six.moves.urllib.request import HTTPBasicAuthHandler
396-from six.moves.xmlrpc_client import ServerProxy
397 import twisted
398
399 from lpbuildd.tests.harness import (
400diff --git a/lpbuildd/tests/test_builder.py b/lpbuildd/tests/test_builder.py
401index 1f08126..aee3e4d 100644
402--- a/lpbuildd/tests/test_builder.py
403+++ b/lpbuildd/tests/test_builder.py
404@@ -10,7 +10,6 @@ import io
405 import re
406
407 from fixtures import TempDir
408-import six
409 from testtools import TestCase
410 from testtools.deferredruntest import AsynchronousDeferredRunTest
411 from twisted.internet import defer
412@@ -122,9 +121,7 @@ class TestBuildManager(TestCase):
413 "RUN: echo '\N{SNOWMAN}'\n"
414 "\N{SNOWMAN}\n".encode(),
415 builder._log.getvalue())
416- logged_snowman = '\N{SNOWMAN}' if six.PY3 else '\\u2603'
417 self.assertEqual(
418- ["Build log: RUN: echo '%s'" % logged_snowman,
419- "Build log: %s" % logged_snowman],
420+ ["Build log: RUN: echo '\N{SNOWMAN}'", "Build log: \N{SNOWMAN}"],
421 [re.sub(r".*? \[-\] (.*)", r"\1", line)
422 for line in self.log_file.getvalue().splitlines()])
423diff --git a/lpbuildd/tests/test_buildrecipe.py b/lpbuildd/tests/test_buildrecipe.py
424index 0914c04..32858fa 100644
425--- a/lpbuildd/tests/test_buildrecipe.py
426+++ b/lpbuildd/tests/test_buildrecipe.py
427@@ -17,7 +17,6 @@ from fixtures import (
428 MockPatchObject,
429 TempDir,
430 )
431-import six
432 from systemfixtures import FakeProcesses
433 from testtools import TestCase
434 from testtools.matchers import (
435@@ -134,7 +133,7 @@ class TestRecipeBuilder(TestCase):
436 "grumpy", "main", "PPA", git=True)
437 with open(os.path.join(self.builder.work_dir, "recipe"), "w") as f:
438 f.write("dummy recipe contents\n")
439- mock_stdout = six.StringIO()
440+ mock_stdout = io.StringIO()
441 self.useFixture(MockPatch("sys.stdout", mock_stdout))
442 self.assertEqual(0, self.builder.buildTree())
443 self.assertEqual(
444@@ -185,7 +184,7 @@ class TestRecipeBuilder(TestCase):
445 fake_brz_build_daily_recipe, name="brz-build-daily-recipe")
446 with open(os.path.join(self.builder.work_dir, "recipe"), "w") as f:
447 f.write("dummy recipe contents\n")
448- mock_stdout = six.StringIO()
449+ mock_stdout = io.StringIO()
450 self.useFixture(MockPatch("sys.stdout", mock_stdout))
451 self.useFixture(MockPatchObject(
452 self.builder, "_is_command_on_path",
453@@ -236,7 +235,7 @@ class TestRecipeBuilder(TestCase):
454 processes_fixture.add(fake_bzr, name="bzr")
455 with open(os.path.join(self.builder.work_dir, "recipe"), "w") as f:
456 f.write("dummy recipe contents\n")
457- mock_stdout = six.StringIO()
458+ mock_stdout = io.StringIO()
459 self.useFixture(MockPatch("sys.stdout", mock_stdout))
460 self.useFixture(MockPatchObject(
461 self.builder, "_is_command_on_path", return_value=False))
462diff --git a/setup.py b/setup.py
463index 680e2c5..b1bea46 100755
464--- a/setup.py
465+++ b/setup.py
466@@ -72,7 +72,6 @@ setup(
467 # 'python-apt',
468 'python-debian',
469 'requests',
470- 'six',
471 'Twisted',
472 'zope.interface',
473 ],
474diff --git a/system-dependencies.txt b/system-dependencies.txt
475index f4d4bd4..df43d2b 100644
476--- a/system-dependencies.txt
477+++ b/system-dependencies.txt
478@@ -13,7 +13,6 @@ python3-pylxd
479 python3-requests
480 python3-responses
481 python3-setuptools
482-python3-six
483 python3-systemfixtures
484 python3-testtools
485 python3-twisted

Subscribers

People subscribed via source and target branches