Merge lp:~jelmer/loggerhead/drop-python3 into lp:loggerhead
- drop-python3
- Merge into trunk-rich
Status: | Merged |
---|---|
Approved by: | Colin Watson |
Approved revision: | no longer in the source branch. |
Merge reported by: | Otto Co-Pilot |
Merged at revision: | 520 |
Proposed branch: | lp:~jelmer/loggerhead/drop-python3 |
Merge into: | lp:loggerhead |
Prerequisite: | lp:~jelmer/loggerhead/fix-tox |
Diff against target: |
390 lines (+55/-105) 17 files modified
.travis.yml (+0/-2) loggerhead.wsgi (+2/-4) loggerhead/__init__.py (+1/-1) loggerhead/changecache.py (+2/-8) loggerhead/controllers/filediff_ui.py (+1/-11) loggerhead/controllers/view_ui.py (+1/-1) loggerhead/highlight.py (+1/-4) loggerhead/history.py (+1/-1) loggerhead/load_test.py (+1/-4) loggerhead/lsprof.py (+1/-4) loggerhead/main.py (+1/-4) loggerhead/tests/test_load_test.py (+1/-4) loggerhead/tests/test_simple.py (+2/-8) loggerhead/util.py (+3/-12) requirements.txt (+10/-11) setup.py (+24/-20) tox.ini (+3/-6) |
To merge this branch: | bzr merge lp:~jelmer/loggerhead/drop-python3 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson (community) | Approve | ||
Review via email: mp+411875@code.launchpad.net |
Commit message
Drop support for Python < 3 and Breezy < 3.1.
Description of the change
Drop support for Python < 3 and Breezy < 3.1.
Jelmer Vernooij (jelmer) wrote : | # |
> Same comment as in https:/
> tox/+merge/411874 - could you adjust this to keep Python 3.5? I'll need to
> merge these two together, since something (probably a Breezy release or
> similar) has broken the Python 2 tests.
>
> We'll need to upgrade Launchpad to Breezy >= 3.1, but that should be
> manageable now.
Done.
Otto Co-Pilot (otto-copilot) wrote : | # |
Voting criteria not met
https:/
Colin Watson (cjwatson) : | # |
Otto Co-Pilot (otto-copilot) wrote : | # |
Running landing tests failed
https:/
Colin Watson (cjwatson) wrote : | # |
ols-jenkaas is explicitly running "tox -e py27 -e py35". Dropping py27 will have to wait for the new year so that I can get somebody to update the job configuration.
However, there's also another problem that could be fixed before then:
14:40:30 O: py35 create: /workspace/
14:40:33 O: py35 installdeps: -rrequirements.txt
14:40:37 O: ERROR: invocation failed (exit code 1), logfile: /workspace/
14:40:37 O: ERROR: actionid: py35
14:40:37 O: msg: getenv
14:40:37 O: cmdargs: [local(
14:40:37 O: env: {'_': '/usr/bin/tox', 'LOGNAME': 'ubuntu', 'no_proxy': '0.0.0.
14:40:37 O:
14:40:37 O: Collecting https:/
14:40:37 O: Downloading https:/
14:40:37 O: Requirement already satisfied (use --upgrade to upgrade): setuptools in ./.tox/
14:40:37 O: Collecting Paste>=1.6 (from -r requirements.txt (line 2))
14:40:37 O: Downloading https:/
14:40:37 O: Collecting dulwich (from -r requirements.txt (line 3))
14:40:37 O: Downloading https:/
14:40:37 O: Complete output from command python setup.py egg_info:
14:40:37 O: Traceback (most recent call last):
14:40:37 O: File "<string>", line 1, in <module>
14:40:37 O: File "/tmp/pip-
14:40:37 O: 'Dulwich only supports Python 3.6 and later. '
14:40:37 O: Exception: ...
Jelmer Vernooij (jelmer) wrote : | # |
Updated for Python 3.5, hopefully.
Otto Co-Pilot (otto-copilot) wrote : | # |
Running landing tests failed
https:/
Colin Watson (cjwatson) wrote : | # |
Reproducible using tox in a xenial container: https:/
Some other things apparently need pinning as well. I think it makes sense to do this in requirements.txt rather than setup.py: https:/
Jelmer Vernooij (jelmer) wrote : | # |
Thanks! I can confirm that it works with those changes - I've imported them in the branch and retried with a clean xenial chroot (rather than python3.5 and whatever libraries were already present on my machine).
Can we try again? Thanks for your patience.
- 520. By Colin Watson
-
Drop support for Python < 3 and Breezy < 3.1.
Merged from https:/
/code.launchpad .net/~jelmer/ loggerhead/ drop-python3/ +merge/ 411875
Preview Diff
1 | === modified file '.travis.yml' |
2 | --- .travis.yml 2020-07-08 17:14:19 +0000 |
3 | +++ .travis.yml 2022-02-23 19:35:55 +0000 |
4 | @@ -9,8 +9,6 @@ |
5 | |
6 | matrix: |
7 | include: |
8 | - - python: 2.7 |
9 | - env: TAL_VERSION=4.3 |
10 | - python: 3.5 |
11 | env: TAL_VERSION=5.2 |
12 | - python: 3.6 |
13 | |
14 | === modified file 'loggerhead.wsgi' |
15 | --- loggerhead.wsgi 2020-06-04 20:28:15 +0000 |
16 | +++ loggerhead.wsgi 2022-02-23 19:35:55 +0000 |
17 | @@ -24,7 +24,6 @@ |
18 | from loggerhead.apps.error import ErrorHandlerApp |
19 | from loggerhead.config import LoggerheadConfig |
20 | from breezy import config as bzrconfig |
21 | -from breezy.sixish import PY3 |
22 | from paste.deploy.config import PrefixMiddleware |
23 | from breezy.plugin import load_plugins |
24 | |
25 | @@ -46,9 +45,8 @@ |
26 | ' %(user)s with http_root_dir set to the base directory you want' |
27 | ' to serve bazaar repositories from' % |
28 | {'user': pwd.getpwuid(os.geteuid()).pw_name}) |
29 | -if not PY3: |
30 | - prefix = prefix.encode('utf-8', 'ignore') |
31 | - root_dir = root_dir.encode('utf-8', 'ignore') |
32 | +prefix = prefix.encode('utf-8', 'ignore') |
33 | +root_dir = root_dir.encode('utf-8', 'ignore') |
34 | app = BranchesFromTransportRoot(root_dir, config) |
35 | app = PrefixMiddleware(app, prefix=prefix) |
36 | app = HTTPExceptionHandler(app) |
37 | |
38 | === modified file 'loggerhead/__init__.py' |
39 | --- loggerhead/__init__.py 2018-10-20 16:33:25 +0000 |
40 | +++ loggerhead/__init__.py 2022-02-23 19:35:55 +0000 |
41 | @@ -24,7 +24,7 @@ |
42 | |
43 | __version__ = '1.20.0' # Keep in sync with ../__init__.py. |
44 | __revision__ = None |
45 | -required_breezy = (3, 0) |
46 | +required_breezy = (3, 1) |
47 | |
48 | pkg_resources.get_distribution('Paste>=1.6') |
49 | try: |
50 | |
51 | === modified file 'loggerhead/changecache.py' |
52 | --- loggerhead/changecache.py 2021-07-28 14:57:50 +0000 |
53 | +++ loggerhead/changecache.py 2022-02-23 19:35:55 +0000 |
54 | @@ -26,19 +26,13 @@ |
55 | cached a change, it's good forever. |
56 | """ |
57 | |
58 | -try: |
59 | - import cPickle as pickle |
60 | -except ImportError: # Python >= 3 |
61 | - import pickle |
62 | +import pickle |
63 | import marshal |
64 | import os |
65 | import tempfile |
66 | import zlib |
67 | |
68 | -try: |
69 | - from sqlite3 import dbapi2 |
70 | -except ImportError: |
71 | - from pysqlite2 import dbapi2 |
72 | +from sqlite3 import dbapi2 |
73 | |
74 | # We take an optimistic approach to concurrency here: we might do work twice |
75 | # in the case of races, but not crash or corrupt data. |
76 | |
77 | === modified file 'loggerhead/controllers/filediff_ui.py' |
78 | --- loggerhead/controllers/filediff_ui.py 2020-01-19 20:09:08 +0000 |
79 | +++ loggerhead/controllers/filediff_ui.py 2022-02-23 19:35:55 +0000 |
80 | @@ -5,17 +5,7 @@ |
81 | errors, |
82 | urlutils, |
83 | ) |
84 | -try: |
85 | - from breezy.tree import find_previous_path |
86 | -except ImportError: # breezy < 3.1 |
87 | - def find_previous_path(from_tree, to_tree, path): |
88 | - file_id = from_tree.path2id(path) |
89 | - if file_id is None: |
90 | - raise errors.NoSuchFile(path) |
91 | - try: |
92 | - return to_tree.id2path(file_id) |
93 | - except errors.NoSuchId: |
94 | - return None |
95 | +from breezy.tree import find_previous_path |
96 | |
97 | from .. import util |
98 | from ..controllers import TemplatedBranchView |
99 | |
100 | === modified file 'loggerhead/controllers/view_ui.py' |
101 | --- loggerhead/controllers/view_ui.py 2020-07-09 08:50:19 +0000 |
102 | +++ loggerhead/controllers/view_ui.py 2022-02-23 19:35:55 +0000 |
103 | @@ -50,7 +50,7 @@ |
104 | template_name = 'view' |
105 | |
106 | def tree_for(self, path, revid): |
107 | - if not isinstance(path, util.text_type): |
108 | + if not isinstance(path, str): |
109 | raise TypeError(path) |
110 | if not isinstance(revid, bytes): |
111 | raise TypeError(revid) |
112 | |
113 | === modified file 'loggerhead/highlight.py' |
114 | --- loggerhead/highlight.py 2020-05-06 19:06:44 +0000 |
115 | +++ loggerhead/highlight.py 2022-02-23 19:35:55 +0000 |
116 | @@ -17,10 +17,7 @@ |
117 | # |
118 | |
119 | import breezy.osutils |
120 | -try: |
121 | - from html import escape |
122 | -except ImportError: |
123 | - from cgi import escape |
124 | +from html import escape |
125 | |
126 | from pygments import highlight as _highlight_func |
127 | from pygments.lexers import guess_lexer, guess_lexer_for_filename, TextLexer |
128 | |
129 | === modified file 'loggerhead/history.py' |
130 | --- loggerhead/history.py 2020-07-08 16:33:07 +0000 |
131 | +++ loggerhead/history.py 2022-02-23 19:35:55 +0000 |
132 | @@ -465,7 +465,7 @@ |
133 | # if a "revid" is actually a dotted revno, convert it to a revid |
134 | if revid is None: |
135 | return revid |
136 | - if not isinstance(revid, (str, util.text_type)): |
137 | + if not isinstance(revid, str): |
138 | raise TypeError(revid) |
139 | if revid == 'head:': |
140 | return self.last_revid |
141 | |
142 | === modified file 'loggerhead/load_test.py' |
143 | --- loggerhead/load_test.py 2022-02-23 19:35:55 +0000 |
144 | +++ loggerhead/load_test.py 2022-02-23 19:35:55 +0000 |
145 | @@ -65,10 +65,7 @@ |
146 | |
147 | import threading |
148 | import time |
149 | -try: |
150 | - from queue import Queue, Empty |
151 | -except ImportError: # Python < 3 |
152 | - from Queue import Queue, Empty |
153 | +from queue import Queue, Empty |
154 | |
155 | import json |
156 | |
157 | |
158 | === modified file 'loggerhead/lsprof.py' |
159 | --- loggerhead/lsprof.py 2018-10-20 12:15:22 +0000 |
160 | +++ loggerhead/lsprof.py 2022-02-23 19:35:55 +0000 |
161 | @@ -6,10 +6,7 @@ |
162 | # instead of just the Stats object |
163 | |
164 | import sys |
165 | -try: |
166 | - from threading import get_ident |
167 | -except ImportError: # python < 3 |
168 | - from thread import get_ident |
169 | +from threading import get_ident |
170 | import threading |
171 | from _lsprof import Profiler, profiler_entry |
172 | |
173 | |
174 | === modified file 'loggerhead/main.py' |
175 | --- loggerhead/main.py 2020-01-19 20:09:08 +0000 |
176 | +++ loggerhead/main.py 2022-02-23 19:35:55 +0000 |
177 | @@ -22,10 +22,7 @@ |
178 | import sys |
179 | |
180 | from breezy.plugin import load_plugins |
181 | -try: |
182 | - from breezy.location import location_to_url |
183 | -except ImportError: # Breezy < 3.1 |
184 | - from breezy.transport import location_to_url |
185 | +from breezy.location import location_to_url |
186 | |
187 | from paste import httpserver |
188 | from paste.httpexceptions import HTTPExceptionHandler, HTTPInternalServerError |
189 | |
190 | === modified file 'loggerhead/tests/test_load_test.py' |
191 | --- loggerhead/tests/test_load_test.py 2018-10-20 12:15:22 +0000 |
192 | +++ loggerhead/tests/test_load_test.py 2022-02-23 19:35:55 +0000 |
193 | @@ -15,10 +15,7 @@ |
194 | import socket |
195 | import time |
196 | import threading |
197 | -try: |
198 | - from queue import Empty |
199 | -except ImportError: # Python < 3 |
200 | - from Queue import Empty |
201 | +from queue import Empty |
202 | |
203 | from breezy import tests |
204 | from breezy.tests import http_server |
205 | |
206 | === modified file 'loggerhead/tests/test_simple.py' |
207 | --- loggerhead/tests/test_simple.py 2020-07-08 17:14:19 +0000 |
208 | +++ loggerhead/tests/test_simple.py 2022-02-23 19:35:55 +0000 |
209 | @@ -17,20 +17,14 @@ |
210 | |
211 | from __future__ import absolute_import |
212 | |
213 | -try: |
214 | - from html import escape |
215 | -except ImportError: |
216 | - from cgi import escape |
217 | +from html import escape |
218 | import json |
219 | import logging |
220 | import re |
221 | from io import BytesIO |
222 | |
223 | from breezy.tests import TestCaseWithTransport |
224 | -try: |
225 | - from breezy.util.configobj.configobj import ConfigObj |
226 | -except ImportError: |
227 | - from configobj import ConfigObj |
228 | +from configobj import ConfigObj |
229 | from breezy import config |
230 | |
231 | from ..apps.branch import BranchWSGIApp |
232 | |
233 | === modified file 'loggerhead/util.py' |
234 | --- loggerhead/util.py 2020-07-08 17:14:19 +0000 |
235 | +++ loggerhead/util.py 2022-02-23 19:35:55 +0000 |
236 | @@ -32,10 +32,7 @@ |
237 | import os |
238 | import subprocess |
239 | |
240 | -try: |
241 | - from xml.etree import ElementTree as ET |
242 | -except ImportError: |
243 | - from elementtree import ElementTree as ET |
244 | +from xml.etree import ElementTree as ET |
245 | |
246 | from breezy import urlutils |
247 | |
248 | @@ -277,7 +274,7 @@ |
249 | except UnicodeDecodeError: |
250 | s = s.decode('iso-8859-15') |
251 | return s |
252 | - elif isinstance(s, text_type): |
253 | + elif isinstance(s, str): |
254 | return s |
255 | else: |
256 | return repr(s) |
257 | @@ -288,7 +285,7 @@ |
258 | expand tabs and turn spaces into "non-breaking spaces", so browsers won't |
259 | chop up the string. |
260 | """ |
261 | - if not isinstance(s, text_type): |
262 | + if not isinstance(s, str): |
263 | # this kinda sucks. file contents are just binary data, and no |
264 | # encoding metadata is stored, so we need to guess. this is probably |
265 | # okay for most code, but for people using things like KOI-8, this |
266 | @@ -675,9 +672,3 @@ |
267 | elif isinstance(obj, datetime.datetime): |
268 | return tuple(obj.utctimetuple()) |
269 | raise TypeError(repr(obj) + " is not JSON serializable") |
270 | - |
271 | - |
272 | -if sys.version_info[0] > 2: |
273 | - text_type = str |
274 | -else: |
275 | - text_type = unicode # noqa: F821 |
276 | |
277 | === modified file 'requirements.txt' |
278 | --- requirements.txt 2021-07-28 12:28:09 +0000 |
279 | +++ requirements.txt 2022-02-23 19:35:55 +0000 |
280 | @@ -1,12 +1,11 @@ |
281 | -setuptools < 45; python_version < "3" |
282 | -packaging < 21.0; python_version < "3.6" |
283 | +setuptools |
284 | Paste >= 1.6 |
285 | -dulwich < 0.20; python_version < "3" |
286 | -dulwich; python_version >= "3" |
287 | -testtools < 2.5.0; python_version < "3" |
288 | -testtools; python_version >= "3" |
289 | -breezy < 3.2; python_version < "3.6" |
290 | -breezy ; python_version >= "3.6" |
291 | -bleach |
292 | -https://www.owlfish.com/software/simpleTAL/downloads/SimpleTAL-4.3.tar.gz; python_version < "3" |
293 | -https://www.owlfish.com/software/simpleTAL/downloads/SimpleTAL-5.2.tar.gz; python_version >= "3" |
294 | +dulwich; python_version > "3.5" |
295 | +dulwich <= 0.20.25; python_version <= "3.5" |
296 | +testtools |
297 | +breezy >= 3.1; python_version > "3.5" |
298 | +breezy >= 3.1, < 3.2; python_version <= "3.5" |
299 | +bleach; python_version > "3.5" |
300 | +bleach < 4.0.0; python_version <= "3.5" |
301 | +packaging < 21.0; python_version <= "3.5" |
302 | +https://www.owlfish.com/software/simpleTAL/downloads/SimpleTAL-5.2.tar.gz |
303 | |
304 | === modified file 'setup.py' |
305 | --- setup.py 2020-07-08 17:14:19 +0000 |
306 | +++ setup.py 2022-02-23 19:35:55 +0000 |
307 | @@ -28,34 +28,38 @@ |
308 | |
309 | |
310 | setup( |
311 | - name = "loggerhead", |
312 | - version = loggerhead.__version__, |
313 | - description = "Loggerhead is a web viewer for projects in bazaar", |
314 | + name="loggerhead", |
315 | + version=loggerhead.__version__, |
316 | + description="Loggerhead is a web viewer for projects in bazaar", |
317 | long_description=long_description, |
318 | long_description_content_type="text/x-rst", |
319 | - license = "GNU GPL v2 or later", |
320 | - maintainer = "Michael Hudson", |
321 | - maintainer_email = "michael.hudson@canonical.com", |
322 | - scripts = [ |
323 | + license="GNU GPL v2 or later", |
324 | + maintainer="Michael Hudson", |
325 | + maintainer_email="michael.hudson@canonical.com", |
326 | + scripts=[ |
327 | "loggerhead-serve", |
328 | ], |
329 | - packages = ["loggerhead", |
330 | - "loggerhead/apps", |
331 | - "loggerhead/controllers", |
332 | - "loggerhead/middleware", |
333 | - "loggerhead/templates", |
334 | - "breezy.plugins.loggerhead"], |
335 | - package_dir={'breezy.plugins.loggerhead':'.'}, |
336 | - package_data = {"loggerhead": ["templates/*.pt", |
337 | - "static/css/*.css", |
338 | - "static/javascript/*.js", |
339 | - "static/images/*"]}, |
340 | - data_files = [ |
341 | + packages=["loggerhead", |
342 | + "loggerhead/apps", |
343 | + "loggerhead/controllers", |
344 | + "loggerhead/middleware", |
345 | + "loggerhead/templates", |
346 | + "breezy.plugins.loggerhead"], |
347 | + package_dir={'breezy.plugins.loggerhead': '.'}, |
348 | + package_data={"loggerhead": ["templates/*.pt", |
349 | + "static/css/*.css", |
350 | + "static/javascript/*.js", |
351 | + "static/images/*"]}, |
352 | + data_files=[ |
353 | ('share/man/man1', ['loggerhead-serve.1']), |
354 | ('share/doc/loggerhead', ['apache-loggerhead.conf', |
355 | 'loggerheadd', |
356 | 'breezy.conf']), |
357 | ], |
358 | - install_requires=['paste', 'bleach'], |
359 | + install_requires=[ |
360 | + 'paste', |
361 | + 'bleach', |
362 | + 'breezy>=3.1', |
363 | + ], |
364 | testsuite='loggerhead.tests.test_suite', |
365 | ) |
366 | |
367 | === removed directory 'tox-scripts' |
368 | === removed file 'tox-scripts/py27-install' |
369 | === modified file 'tox.ini' |
370 | --- tox.ini 2022-02-23 19:35:55 +0000 |
371 | +++ tox.ini 2022-02-23 19:35:55 +0000 |
372 | @@ -1,15 +1,12 @@ |
373 | [tox] |
374 | -envlist = py27,py36,py37,py38,py39 |
375 | +envlist = py35,py36,py37,py38,py39,py310 |
376 | skipsdist=True |
377 | |
378 | [testenv] |
379 | deps = -rrequirements.txt |
380 | commands = brz selftest -v breezy.plugins.loggerhead --strict |
381 | setenv = |
382 | - py27,py35: VIRTUALENV_DOWNLOAD = 0 |
383 | - py27,py35: VIRTUALENV_PIP = 20.3.4 |
384 | + py35: VIRTUALENV_DOWNLOAD = 0 |
385 | + py35: VIRTUALENV_PIP = 20.3.4 |
386 | BRZ_PLUGIN_PATH=-user:-site |
387 | BRZ_PLUGINS_AT = loggerhead@{toxinidir} |
388 | - |
389 | -[testenv:py27] |
390 | -install_command = {toxinidir}/tox-scripts/py27-install {opts} {packages} |
Same comment as in https:/ /code.launchpad .net/~jelmer/ loggerhead/ fix-tox/ +merge/ 411874 - could you adjust this to keep Python 3.5? I'll need to merge these two together, since something (probably a Breezy release or similar) has broken the Python 2 tests.
We'll need to upgrade Launchpad to Breezy >= 3.1, but that should be manageable now.