1 From a88d0c8e27b48344942187c2611bb121bde9332d Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= <fzatlouk@redhat.com>
3 Date: Tue, 13 Jul 2021 11:46:20 +0200
4 Subject: [PATCH] Fixup compatibility of mozbuild with Python 3.10
5
6 ---
7 python/mach/mach/config.py | 4 ++--
8 python/mach/mach/decorators.py | 2 +-
9 python/mozbuild/mozbuild/backend/configenvironment.py | 3 ++-
10 python/mozbuild/mozbuild/makeutil.py | 2 +-
11 python/mozbuild/mozbuild/util.py | 2 +-
12 testing/marionette/client/marionette_driver/wait.py | 2 +-
13 testing/mozbase/manifestparser/manifestparser/filters.py | 3 ++-
14 testing/mozbase/versioninfo.py | 2 +-
15 testing/web-platform/tests/tools/manifest/vcs.py | 2 +-
16 .../web-platform/tests/tools/third_party/h2/h2/settings.py | 2 +-
17 .../tests/tools/third_party/html5lib/html5lib/_trie/_base.py | 2 +-
18 .../tools/third_party/html5lib/html5lib/treebuilders/dom.py | 2 +-
19 .../tests/tools/third_party/hyper/hyper/common/headers.py | 2 +-
20 .../tests/tools/third_party/hyper/hyper/h2/settings.py | 2 +-
21 .../tests/tools/third_party/hyper/hyper/http11/connection.py | 4 ++--
22 .../third_party/hyper/hyper/packages/hyperframe/flags.py | 2 +-
23 .../tests/tools/third_party/hyperframe/hyperframe/flags.py | 2 +-
24 testing/web-platform/tests/tools/wptserve/wptserve/config.py | 3 ++-
25 testing/web-platform/tests/webdriver/tests/support/sync.py | 2 +-
26 19 files changed, 24 insertions(+), 21 deletions(-)
27
28 diff --git a/python/mach/mach/config.py b/python/mach/mach/config.py
29 index 7210eca82..edb4d2e93 100644
30 --- a/python/mach/mach/config.py
31 +++ b/python/mach/mach/config.py
32 @@ -144,7 +144,7 @@ def reraise_attribute_error(func):
33 return _
34
35
36 -class ConfigSettings(collections.Mapping):
37 +class ConfigSettings(collections.abc.Mapping):
38 """Interface for configuration settings.
39
40 This is the main interface to the configuration.
41 @@ -190,7 +190,7 @@ class ConfigSettings(collections.Mapping):
42 will result in exceptions being raised.
43 """
44
45 - class ConfigSection(collections.MutableMapping, object):
46 + class ConfigSection(collections.abc.MutableMapping, object):
47 """Represents an individual config section."""
48 def __init__(self, config, name, settings):
49 object.__setattr__(self, '_config', config)
50 diff --git a/python/mach/mach/decorators.py b/python/mach/mach/decorators.py
51 index 27f7f34a6..5f63271a3 100644
52 --- a/python/mach/mach/decorators.py
53 +++ b/python/mach/mach/decorators.py
54 @@ -140,7 +140,7 @@ def CommandProvider(cls):
55 'Conditions argument must take a list ' + \
56 'of functions. Found %s instead.'
57
58 - if not isinstance(command.conditions, collections.Iterable):
59 + if not isinstance(command.conditions, collections.abc.Iterable):
60 msg = msg % (command.name, type(command.conditions))
61 raise MachError(msg)
62
63 diff --git a/python/mozbuild/mozbuild/backend/configenvironment.py b/python/mozbuild/mozbuild/backend/configenvironment.py
64 index 20d1a9fa6..8747958bd 100644
65 --- a/python/mozbuild/mozbuild/backend/configenvironment.py
66 +++ b/python/mozbuild/mozbuild/backend/configenvironment.py
67 @@ -9,7 +9,8 @@ import six
68 import sys
69 import json
70
71 -from collections import Iterable, OrderedDict
72 +from collections import OrderedDict
73 +from collections.abc import Iterable
74 from types import ModuleType
75
76 import mozpack.path as mozpath
77 diff --git a/python/mozbuild/mozbuild/makeutil.py b/python/mozbuild/mozbuild/makeutil.py
78 index 4da1a3b26..4ce56848c 100644
79 --- a/python/mozbuild/mozbuild/makeutil.py
80 +++ b/python/mozbuild/mozbuild/makeutil.py
81 @@ -7,7 +7,7 @@ from __future__ import absolute_import, print_function, unicode_literals
82 import os
83 import re
84 import six
85 -from collections import Iterable
86 +from collections.abc import Iterable
87
88
89 class Makefile(object):
90 diff --git a/python/mozbuild/mozbuild/util.py b/python/mozbuild/mozbuild/util.py
91 index 044cf645c..98ed3ef52 100644
92 --- a/python/mozbuild/mozbuild/util.py
93 +++ b/python/mozbuild/mozbuild/util.py
94 @@ -782,7 +782,7 @@ class HierarchicalStringList(object):
95 self._strings = StrictOrderingOnAppendList()
96 self._children = {}
97
98 - class StringListAdaptor(collections.Sequence):
99 + class StringListAdaptor(collections.abc.Sequence):
100 def __init__(self, hsl):
101 self._hsl = hsl
102
103 diff --git a/testing/marionette/client/marionette_driver/wait.py b/testing/marionette/client/marionette_driver/wait.py
104 index eeaa1e23d..c147f463f 100644
105 --- a/testing/marionette/client/marionette_driver/wait.py
106 +++ b/testing/marionette/client/marionette_driver/wait.py
107 @@ -82,7 +82,7 @@ class Wait(object):
108
109 exceptions = []
110 if ignored_exceptions is not None:
111 - if isinstance(ignored_exceptions, collections.Iterable):
112 + if isinstance(ignored_exceptions, collections.abc.Iterable):
113 exceptions.extend(iter(ignored_exceptions))
114 else:
115 exceptions.append(ignored_exceptions)
116 diff --git a/testing/mozbase/manifestparser/manifestparser/filters.py b/testing/mozbase/manifestparser/manifestparser/filters.py
117 index 287ee033b..b1d608003 100644
118 --- a/testing/mozbase/manifestparser/manifestparser/filters.py
119 +++ b/testing/mozbase/manifestparser/manifestparser/filters.py
120 @@ -12,7 +12,8 @@ from __future__ import absolute_import
121
122 import itertools
123 import os
124 -from collections import defaultdict, MutableSequence
125 +from collections import defaultdict
126 +from collections.abc import MutableSequence
127
128 import six
129 from six import string_types
130 diff --git a/testing/mozbase/versioninfo.py b/testing/mozbase/versioninfo.py
131 index 91d1a0473..8c1680069 100755
132 --- a/testing/mozbase/versioninfo.py
133 +++ b/testing/mozbase/versioninfo.py
134 @@ -11,7 +11,7 @@ from commit messages.
135
136 from __future__ import absolute_import, print_function
137
138 -from collections import Iterable
139 +from collections.abc import Iterable
140 from distutils.version import StrictVersion
141 import argparse
142 import os
143 diff --git a/testing/web-platform/tests/tools/manifest/vcs.py b/testing/web-platform/tests/tools/manifest/vcs.py
144 index 7c0feeb81..05ee19c7c 100644
145 --- a/testing/web-platform/tests/tools/manifest/vcs.py
146 +++ b/testing/web-platform/tests/tools/manifest/vcs.py
147 @@ -3,7 +3,7 @@ import json
148 import os
149 import stat
150 from collections import deque
151 -from collections import MutableMapping
152 +from collections.abc import MutableMapping
153
154 from six import with_metaclass, PY2
155
156 diff --git a/testing/web-platform/tests/tools/third_party/h2/h2/settings.py b/testing/web-platform/tests/tools/third_party/h2/h2/settings.py
157 index 3da720329..e097630e9 100644
158 --- a/testing/web-platform/tests/tools/third_party/h2/h2/settings.py
159 +++ b/testing/web-platform/tests/tools/third_party/h2/h2/settings.py
160 @@ -88,7 +88,7 @@ class ChangedSetting:
161 )
162
163
164 -class Settings(collections.MutableMapping):
165 +class Settings(collections.abc.MutableMapping):
166 """
167 An object that encapsulates HTTP/2 settings state.
168
169 diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/_base.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/_base.py
170 index a1158bbbf..a9295a2ba 100644
171 --- a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/_base.py
172 +++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/_base.py
173 @@ -1,6 +1,6 @@
174 from __future__ import absolute_import, division, unicode_literals
175
176 -from collections import Mapping
177 +from collections.abc import Mapping
178
179
180 class Trie(Mapping):
181 diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/dom.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/dom.py
182 index dcfac220b..818a33433 100644
183 --- a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/dom.py
184 +++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/dom.py
185 @@ -1,7 +1,7 @@
186 from __future__ import absolute_import, division, unicode_literals
187
188
189 -from collections import MutableMapping
190 +from collections.abc import MutableMapping
191 from xml.dom import minidom, Node
192 import weakref
193
194 diff --git a/testing/web-platform/tests/tools/third_party/hyper/hyper/common/headers.py b/testing/web-platform/tests/tools/third_party/hyper/hyper/common/headers.py
195 index 655a591ac..6454f550a 100644
196 --- a/testing/web-platform/tests/tools/third_party/hyper/hyper/common/headers.py
197 +++ b/testing/web-platform/tests/tools/third_party/hyper/hyper/common/headers.py
198 @@ -10,7 +10,7 @@ import collections
199 from hyper.common.util import to_bytestring, to_bytestring_tuple
200
201
202 -class HTTPHeaderMap(collections.MutableMapping):
203 +class HTTPHeaderMap(collections.abc.MutableMapping):
204 """
205 A structure that contains HTTP headers.
206
207 diff --git a/testing/web-platform/tests/tools/third_party/hyper/hyper/h2/settings.py b/testing/web-platform/tests/tools/third_party/hyper/hyper/h2/settings.py
208 index fedc5e3c4..040afea92 100755
209 --- a/testing/web-platform/tests/tools/third_party/hyper/hyper/h2/settings.py
210 +++ b/testing/web-platform/tests/tools/third_party/hyper/hyper/h2/settings.py
211 @@ -151,7 +151,7 @@ class ChangedSetting:
212 )
213
214
215 -class Settings(collections.MutableMapping):
216 +class Settings(collections.abc.MutableMapping):
217 """
218 An object that encapsulates HTTP/2 settings state.
219
220 diff --git a/testing/web-platform/tests/tools/third_party/hyper/hyper/http11/connection.py b/testing/web-platform/tests/tools/third_party/hyper/hyper/http11/connection.py
221 index 61361c358..a214311d2 100644
222 --- a/testing/web-platform/tests/tools/third_party/hyper/hyper/http11/connection.py
223 +++ b/testing/web-platform/tests/tools/third_party/hyper/hyper/http11/connection.py
224 @@ -10,7 +10,7 @@ import os
225 import socket
226 import base64
227
228 -from collections import Iterable, Mapping
229 +from collections.abc import Iterable, Mapping
230
231 import collections
232 from hyperframe.frame import SettingsFrame
233 @@ -295,7 +295,7 @@ class HTTP11Connection(object):
234 return
235
236 # Iterables that set a specific content length.
237 - elif isinstance(body, collections.Iterable):
238 + elif isinstance(body, collections.abc.Iterable):
239 for item in body:
240 try:
241 self._sock.send(item)
242 diff --git a/testing/web-platform/tests/tools/third_party/hyper/hyper/packages/hyperframe/flags.py b/testing/web-platform/tests/tools/third_party/hyper/hyper/packages/hyperframe/flags.py
243 index e8f630056..8f2ea689b 100644
244 --- a/testing/web-platform/tests/tools/third_party/hyper/hyper/packages/hyperframe/flags.py
245 +++ b/testing/web-platform/tests/tools/third_party/hyper/hyper/packages/hyperframe/flags.py
246 @@ -11,7 +11,7 @@ import collections
247 Flag = collections.namedtuple("Flag", ["name", "bit"])
248
249
250 -class Flags(collections.MutableSet):
251 +class Flags(collections.abc.MutableSet):
252 """
253 A simple MutableSet implementation that will only accept known flags as elements.
254
255 diff --git a/testing/web-platform/tests/tools/third_party/hyperframe/hyperframe/flags.py b/testing/web-platform/tests/tools/third_party/hyperframe/hyperframe/flags.py
256 index 05b35017e..14c352e10 100644
257 --- a/testing/web-platform/tests/tools/third_party/hyperframe/hyperframe/flags.py
258 +++ b/testing/web-platform/tests/tools/third_party/hyperframe/hyperframe/flags.py
259 @@ -11,7 +11,7 @@ import collections
260 Flag = collections.namedtuple("Flag", ["name", "bit"])
261
262
263 -class Flags(collections.MutableSet):
264 +class Flags(collections.abc.MutableSet):
265 """
266 A simple MutableSet implementation that will only accept known flags as
267 elements.
268 diff --git a/testing/web-platform/tests/tools/wptserve/wptserve/config.py b/testing/web-platform/tests/tools/wptserve/wptserve/config.py
269 index 7766565fe..3c1c36d6f 100644
270 --- a/testing/web-platform/tests/tools/wptserve/wptserve/config.py
271 +++ b/testing/web-platform/tests/tools/wptserve/wptserve/config.py
272 @@ -2,7 +2,8 @@ import copy
273 import logging
274 import os
275
276 -from collections import defaultdict, Mapping
277 +from collections import defaultdict
278 +from collections.abc import Mapping
279 from six import integer_types, iteritems, itervalues, string_types
280
281 from . import sslutils
282 diff --git a/testing/web-platform/tests/webdriver/tests/support/sync.py b/testing/web-platform/tests/webdriver/tests/support/sync.py
283 index 3fc77131c..8e8f6b819 100644
284 --- a/testing/web-platform/tests/webdriver/tests/support/sync.py
285 +++ b/testing/web-platform/tests/webdriver/tests/support/sync.py
286 @@ -81,7 +81,7 @@ class Poll(object):
287
288 exceptions = []
289 if ignored_exceptions is not None:
290 - if isinstance(ignored_exceptions, collections.Iterable):
291 + if isinstance(ignored_exceptions, collections.abc.Iterable):
292 exceptions.extend(iter(ignored_exceptions))
293 else:
294 exceptions.append(ignored_exceptions)
295 --
296 2.31.1
|