Merge lp:~jelmer/brz/python3.12-compat into lp:brz/3.3

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: 7821
Merged at revision: 7819
Proposed branch: lp:~jelmer/brz/python3.12-compat
Merge into: lp:brz/3.3
Diff against target: 185 lines (+31/-17)
10 files modified
breezy/bzr/index.py (+1/-1)
breezy/git/dir.py (+1/-1)
breezy/git/mapping.py (+1/-1)
breezy/git/repository.py (+1/-1)
breezy/lockdir.py (+1/-1)
breezy/tests/test_selftest.py (+2/-2)
breezy/tests/test_setup.py (+3/-2)
breezy/transport/http/response.py (+8/-4)
breezy/transport/http/urllib.py (+11/-4)
doc/en/release-notes/brz-3.3.txt (+2/-0)
To merge this branch: bzr merge lp:~jelmer/brz/python3.12-compat
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+458124@code.launchpad.net

Commit message

Fix python 3.12 compatibility

Description of the change

Fix python 3.12 compatibility

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Download full text (9.8 KiB)

The attempt to merge lp:~jelmer/brz/python3.12-compat into lp:brz/3.3 failed. Command exited with 2.
Below is the output from the failed tests.

Collecting setuptools-gettext
  Using cached setuptools_gettext-0.1.8-py3-none-any.whl.metadata (1.9 kB)
Requirement already satisfied: types-paramiko in /usr/lib/python3/dist-packages (3.3)
Requirement already satisfied: setuptools>=60.8 in ./lib/python3.11/site-packages (from setuptools-gettext) (68.1.2)
Requirement already satisfied: cryptography>=37.0.0 in /usr/lib/python3/dist-packages (from types-paramiko) (38.0.4)
Using cached setuptools_gettext-0.1.8-py3-none-any.whl (12 kB)
Installing collected packages: setuptools-gettext
Successfully installed setuptools-gettext-0.1.8
Obtaining file:///tmp/tarmac/branch.3e4_d4c5
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Checking if build backend supports build_editable: started
  Checking if build backend supports build_editable: finished with status 'done'
  Getting requirements to build editable: started
  Getting requirements to build editable: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing editable metadata (pyproject.toml): started
  Preparing editable metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: configobj in /usr/lib/python3/dist-packages (5.0.8)
Requirement already satisfied: fastbencode in /usr/lib/python3/dist-packages (0.2)
Requirement already satisfied: patiencediff in /usr/lib/python3/dist-packages (0.2.13)
Requirement already satisfied: merge3 in /usr/lib/python3/dist-packages (0.0.8)
Requirement already satisfied: dulwich>=0.21.6 in /usr/lib/python3/dist-packages (0.21.6)
Requirement already satisfied: urllib3>=1.24.1 in /usr/lib/python3/dist-packages (1.26.18)
Requirement already satisfied: pyyaml in /usr/lib/python3/dist-packages (6.0.1)
Collecting testtools
  Using cached testtools-2.7.1-py3-none-any.whl.metadata (5.3 kB)
Collecting testscenarios
  Using cached testscenarios-0.5.0-py2.py3-none-any.whl (21 kB)
Collecting python-subunit
  Using cached python_subunit-1.4.4-py3-none-any.whl.metadata (22 kB)
Requirement already satisfied: flake8 in /usr/lib/python3/dist-packages (6.1.0)
Collecting cython>=0.29
  Using cached Cython-3.0.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.2 kB)
Collecting docutils
  Using cached docutils-0.20.1-py3-none-any.whl.metadata (2.8 kB)
Requirement already satisfied: setuptools in ./lib/python3.11/site-packages (68.1.2)
Collecting sphinx
  Using cached sphinx-7.2.6-py3-none-any.whl.metadata (5.9 kB)
Collecting sphinx-epytext
  Using cached sphinx_epytext-0.0.4-py3-none-any.whl
Collecting fastimport
  Using cached fastimport-0.9.14-py2.py3-none-any.whl
Requirement already satisfied: launchpadlib>=1.6.3 in /usr/lib/python3/dist-packages (1.11.0)
Requirement already satisfied: paramiko in /usr/local/lib/python3.11/dist-packages (3.3.1)
Requirement already satisfied: gpg in /usr/lib/python3/dist-packages (1.18.0)
Requirement already satisfied: httplib2 in /usr/lib/python3/dist-packages (fr...

Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :
Download full text (85.7 KiB)

The attempt to merge lp:~jelmer/brz/python3.12-compat into lp:brz/3.3 failed. Command exited with 2.
Below is the output from the failed tests.

Collecting setuptools-gettext
  Downloading setuptools_gettext-0.1.8-py3-none-any.whl.metadata (1.9 kB)
Requirement already satisfied: types-paramiko in /usr/lib/python3/dist-packages (3.3)
Requirement already satisfied: setuptools>=60.8 in ./lib/python3.11/site-packages (from setuptools-gettext) (68.1.2)
Requirement already satisfied: cryptography>=37.0.0 in /usr/lib/python3/dist-packages (from types-paramiko) (38.0.4)
Downloading setuptools_gettext-0.1.8-py3-none-any.whl (12 kB)
Installing collected packages: setuptools-gettext
Successfully installed setuptools-gettext-0.1.8
Obtaining file:///tmp/tarmac/branch.u6qmoisd
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Checking if build backend supports build_editable: started
  Checking if build backend supports build_editable: finished with status 'done'
  Getting requirements to build editable: started
  Getting requirements to build editable: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing editable metadata (pyproject.toml): started
  Preparing editable metadata (pyproject.toml): finished with status 'done'
Requirement already satisfied: configobj in /usr/lib/python3/dist-packages (5.0.8)
Requirement already satisfied: fastbencode in /usr/lib/python3/dist-packages (0.2)
Requirement already satisfied: patiencediff in /usr/lib/python3/dist-packages (0.2.13)
Requirement already satisfied: merge3 in /usr/lib/python3/dist-packages (0.0.8)
Requirement already satisfied: dulwich>=0.21.6 in /usr/lib/python3/dist-packages (0.21.6)
Requirement already satisfied: urllib3>=1.24.1 in /usr/lib/python3/dist-packages (1.26.18)
Requirement already satisfied: pyyaml in /usr/lib/python3/dist-packages (6.0.1)
Collecting testtools
  Downloading testtools-2.7.1-py3-none-any.whl.metadata (5.3 kB)
Collecting testscenarios
  Downloading testscenarios-0.5.0-py2.py3-none-any.whl (21 kB)
Collecting python-subunit
  Downloading python_subunit-1.4.4-py3-none-any.whl.metadata (22 kB)
Requirement already satisfied: flake8 in /usr/lib/python3/dist-packages (6.1.0)
Collecting cython>=0.29
  Using cached Cython-3.0.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.2 kB)
Collecting docutils
  Downloading docutils-0.20.1-py3-none-any.whl.metadata (2.8 kB)
Requirement already satisfied: setuptools in ./lib/python3.11/site-packages (68.1.2)
Collecting sphinx
  Downloading sphinx-7.2.6-py3-none-any.whl.metadata (5.9 kB)
Collecting sphinx-epytext
  Downloading sphinx-epytext-0.0.4.tar.gz (3.6 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting fastimport
  Downloading fastimport-0.9.14.tar.gz (41 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.8/41.8 kB 2.0 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: launchpadlib>=1.6.3 in /usr/lib/python3/d...

lp:~jelmer/brz/python3.12-compat updated
7821. By Jelmer Vernooij

Fix ruff

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/bzr/index.py'
2--- breezy/bzr/index.py 2023-01-31 01:05:40 +0000
3+++ breezy/bzr/index.py 2024-01-07 15:55:31 +0000
4@@ -164,7 +164,7 @@
5 if self._key_length != len(key):
6 raise BadIndexKey(key)
7 for element in key:
8- if not element or type(element) != bytes or _whitespace_re.search(element) is not None:
9+ if not element or not isinstance(element, bytes) or _whitespace_re.search(element) is not None:
10 raise BadIndexKey(key)
11
12 def _external_references(self):
13
14=== modified file 'breezy/git/dir.py'
15--- breezy/git/dir.py 2023-03-08 23:09:15 +0000
16+++ breezy/git/dir.py 2024-01-07 15:55:31 +0000
17@@ -49,7 +49,7 @@
18 fixed_components = True
19
20 def __eq__(self, other):
21- return type(self) == type(other)
22+ return type(self) is type(other)
23
24 def is_supported(self):
25 return True
26
27=== modified file 'breezy/git/mapping.py'
28--- breezy/git/mapping.py 2023-05-23 18:45:06 +0000
29+++ breezy/git/mapping.py 2024-01-07 15:55:31 +0000
30@@ -154,7 +154,7 @@
31 super().__init__(foreign_vcs_git)
32
33 def __eq__(self, other):
34- return (type(self) == type(other)
35+ return (type(self) is type(other)
36 and self.revid_prefix == other.revid_prefix)
37
38 @classmethod
39
40=== modified file 'breezy/git/repository.py'
41--- breezy/git/repository.py 2023-01-31 01:05:40 +0000
42+++ breezy/git/repository.py 2024-01-07 15:55:31 +0000
43@@ -323,7 +323,7 @@
44 return list(ret)
45
46 def _get_parents(self, revid, no_alternates=False):
47- if type(revid) != bytes:
48+ if not isinstance(revid, bytes):
49 raise ValueError
50 try:
51 (hexsha, mapping) = self.lookup_bzr_revision_id(revid)
52
53=== modified file 'breezy/lockdir.py'
54--- breezy/lockdir.py 2023-01-31 01:05:40 +0000
55+++ breezy/lockdir.py 2024-01-07 15:55:31 +0000
56@@ -785,7 +785,7 @@
57
58 def __eq__(self, other):
59 """Equality check for lock holders."""
60- if type(self) != type(other):
61+ if not isinstance(self, type(other)):
62 return False
63 return self.info_dict == other.info_dict
64
65
66=== modified file 'breezy/tests/test_selftest.py'
67--- breezy/tests/test_selftest.py 2023-03-31 19:05:43 +0000
68+++ breezy/tests/test_selftest.py 2024-01-07 15:55:31 +0000
69@@ -1208,8 +1208,8 @@
70 def test_verbose_test_count(self):
71 """A verbose test run reports the right test count at the start"""
72 suite = TestUtil.TestSuite([
73- unittest.FunctionTestCase(lambda:None),
74- unittest.FunctionTestCase(lambda:None)])
75+ unittest.FunctionTestCase(lambda: None),
76+ unittest.FunctionTestCase(lambda: None)])
77 self.assertEqual(suite.countTestCases(), 2)
78 stream = StringIO()
79 runner = tests.TextTestRunner(stream=stream, verbosity=2)
80
81=== modified file 'breezy/tests/test_setup.py'
82--- breezy/tests/test_setup.py 2023-01-31 01:05:40 +0000
83+++ breezy/tests/test_setup.py 2024-01-07 15:55:31 +0000
84@@ -19,7 +19,8 @@
85 import os
86 import subprocess
87 import sys
88-from distutils import version
89+
90+from packaging.version import Version
91
92 import breezy
93
94@@ -96,6 +97,6 @@
95 def test_version_with_string(self):
96 # We really care about two pyrex specific versions and our ability to
97 # detect them
98- lv = version.LooseVersion
99+ lv = Version
100 self.assertTrue(lv("0.9.4.1") < lv('0.17.beta1'))
101 self.assertTrue(lv("0.9.6.3") < lv('0.10'))
102
103=== modified file 'breezy/transport/http/response.py'
104--- breezy/transport/http/response.py 2023-01-31 01:05:40 +0000
105+++ breezy/transport/http/response.py 2024-01-07 15:55:31 +0000
106@@ -21,7 +21,6 @@
107 responses.
108 """
109
110-import cgi
111 import email.utils as email_utils
112 import http.client as http_client
113 import os
114@@ -380,10 +379,15 @@
115 # being of type 'application/octet-stream' as per RFC2616 section
116 # 7.2.1.
117 # Therefore it is obviously not multipart
118- content_type = getheader('content-type', 'application/octet-stream')
119- mimetype, options = cgi.parse_header(content_type)
120+ content_type = getheader("content-type", "application/octet-stream")
121+ from email.message import EmailMessage
122+
123+ msg = EmailMessage()
124+ msg["content-type"] = content_type
125+ params = msg["content-type"].params
126+ mimetype = msg.get_content_type()
127 if mimetype == 'multipart/byteranges':
128- rfile.set_boundary(options['boundary'].encode('ascii'))
129+ rfile.set_boundary(params['boundary'].encode('ascii'))
130 else:
131 # A response to a range request, but not multipart
132 content_range = getheader('content-range', None)
133
134=== modified file 'breezy/transport/http/urllib.py'
135--- breezy/transport/http/urllib.py 2023-07-18 05:19:01 +0000
136+++ breezy/transport/http/urllib.py 2024-01-07 15:55:31 +0000
137@@ -22,7 +22,6 @@
138 DEBUG = 0
139
140 import base64
141-import cgi
142 import errno
143 import http.client
144 import os
145@@ -302,8 +301,13 @@
146 proxied_host=None,
147 report_activity=None, ca_certs=None):
148 AbstractHTTPConnection.__init__(self, report_activity=report_activity)
149+ context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
150+ if key_file or cert_file:
151+ context.load_cert_chain(cert_file, key_file)
152+ self.cert_file = cert_file
153+ self.key_file = key_file
154 http.client.HTTPSConnection.__init__(
155- self, host, port, key_file, cert_file)
156+ self, host, port, context=context)
157 self.proxied_host = proxied_host
158 self.ca_certs = ca_certs
159
160@@ -1859,8 +1863,11 @@
161 def text(self):
162 if self.status == 204:
163 return None
164- charset = cgi.parse_header(
165- self._actual.headers['Content-Type'])[1].get('charset')
166+ from email.message import EmailMessage
167+
168+ msg = EmailMessage()
169+ msg["content-type"] = self._actual.headers["Content-Type"]
170+ charset = msg["content-type"].params.get("charset")
171 if charset:
172 return self.data.decode(charset)
173 else:
174
175=== modified file 'doc/en/release-notes/brz-3.3.txt'
176--- doc/en/release-notes/brz-3.3.txt 2023-09-04 17:12:03 +0000
177+++ doc/en/release-notes/brz-3.3.txt 2024-01-07 15:55:31 +0000
178@@ -10,6 +10,8 @@
179
180 :3.3.5: UNRELEASED
181
182+* Fix compatibility with Python 3.12. Jelmer Vernooij, #2047991)
183+
184 brz 3.3.4
185 #########
186

Subscribers

People subscribed via source and target branches