Merge ~liushuyu-011/ubuntu/+source/qt6-webengine:ubuntu/devel into ubuntu/+source/qt6-webengine:ubuntu/devel
- Git
- lp:~liushuyu-011/ubuntu/+source/qt6-webengine
- ubuntu/devel
- Merge into ubuntu/devel
Proposed by
Zixing Liu
Status: | Superseded |
---|---|
Proposed branch: | ~liushuyu-011/ubuntu/+source/qt6-webengine:ubuntu/devel |
Merge into: | ubuntu/+source/qt6-webengine:ubuntu/devel |
Diff against target: |
2186 lines (+2158/-0) 4 files modified
debian/changelog (+7/-0) debian/patches/drop_python2_support.patch (+1836/-0) debian/patches/remove_six_moves_from_protobuf.patch (+313/-0) debian/patches/series (+2/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Steve Langasek (community) | Approve | ||
Review via email: mp+462529@code.launchpad.net |
Commit message
Description of the change
This MP fixes a minor issue with Python 3.12 removing the imp module, but several Chromium build scripts still reference it.
The patches are cherry-picked from Chromium upstream.
To post a comment you must log in.
Revision history for this message
Steve Langasek (vorlon) : | # |
review:
Approve
- 05b7380... by Zixing Liu
-
Add another round of patches from Chromium/v8 upstream
Unmerged commits
- 05b7380... by Zixing Liu
-
Add another round of patches from Chromium/v8 upstream
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/debian/changelog b/debian/changelog |
2 | index 201cbfb..77e8472 100644 |
3 | --- a/debian/changelog |
4 | +++ b/debian/changelog |
5 | @@ -1,3 +1,10 @@ |
6 | +qt6-webengine (6.4.2-final+dfsg-12ubuntu4) UNRELEASED; urgency=medium |
7 | + |
8 | + * Add another batch of patches from Chromium and v8 upstream to fix |
9 | + futher Python 3.12 compatibility issues. |
10 | + |
11 | + -- Zixing Liu <zixing.liu@canonical.com> Fri, 15 Mar 2024 20:16:14 -0600 |
12 | + |
13 | qt6-webengine (6.4.2-final+dfsg-12ubuntu3) noble; urgency=medium |
14 | |
15 | * Add patches from Chromium upstream to fix Python 3.12 compatibility |
16 | diff --git a/debian/patches/drop_python2_support.patch b/debian/patches/drop_python2_support.patch |
17 | new file mode 100644 |
18 | index 0000000..923fb68 |
19 | --- /dev/null |
20 | +++ b/debian/patches/drop_python2_support.patch |
21 | @@ -0,0 +1,1836 @@ |
22 | +From b3abd7e4c9467415da3a5e13d9500d2ab3abc2ec Mon Sep 17 00:00:00 2001 |
23 | +From: Takuto Ikuta <tikuta@chromium.org> |
24 | +Date: Tue, 17 Jan 2023 01:16:33 +0000 |
25 | +Subject: [PATCH] grit: drop python2 compatibility |
26 | + |
27 | +We use python3 only for build now. |
28 | + |
29 | +Bug: 1406153 |
30 | +Change-Id: I7a06b7976bb7ffe4d045f7f10367a18ecafc2808 |
31 | +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4170036 |
32 | +Auto-Submit: Takuto Ikuta <tikuta@chromium.org> |
33 | +Reviewed-by: Andrew Grieve <agrieve@chromium.org> |
34 | +Commit-Queue: Takuto Ikuta <tikuta@chromium.org> |
35 | +Cr-Commit-Position: refs/heads/main@{#1093176} |
36 | +--- |
37 | + tools/grit/grit/format/c_format.py | 6 +-- |
38 | + tools/grit/grit/format/c_format_unittest.py | 11 ++-- |
39 | + .../format/chrome_messages_json_unittest.py | 19 +++---- |
40 | + tools/grit/grit/format/data_pack.py | 7 +-- |
41 | + .../format/gen_predetermined_ids_unittest.py | 11 ++-- |
42 | + tools/grit/grit/format/minifier.py | 4 -- |
43 | + tools/grit/grit/format/rc.py | 10 ++-- |
44 | + tools/grit/grit/format/rc_unittest.py | 31 ++++++----- |
45 | + .../grit/gather/admin_template_unittest.py | 34 ++++++------ |
46 | + tools/grit/grit/gather/interface.py | 6 +-- |
47 | + tools/grit/grit/gather/policy_json.py | 10 ++-- |
48 | + .../grit/grit/gather/policy_json_unittest.py | 31 +++++------ |
49 | + tools/grit/grit/gather/rc_unittest.py | 50 ++++++++++------- |
50 | + tools/grit/grit/gather/skeleton_gatherer.py | 11 ++-- |
51 | + tools/grit/grit/gather/tr_html.py | 14 ++--- |
52 | + tools/grit/grit/gather/tr_html_unittest.py | 46 ++++++++-------- |
53 | + tools/grit/grit/gather/txt_unittest.py | 12 ++--- |
54 | + tools/grit/grit/grd_reader_unittest.py | 40 +++++++------- |
55 | + tools/grit/grit/grit_runner_unittest.py | 11 ++-- |
56 | + tools/grit/grit/node/base.py | 54 ++++++++----------- |
57 | + tools/grit/grit/node/base_unittest.py | 11 ++-- |
58 | + tools/grit/grit/node/message.py | 8 +-- |
59 | + tools/grit/grit/node/misc.py | 6 +-- |
60 | + tools/grit/grit/node/misc_unittest.py | 45 ++++++++-------- |
61 | + tools/grit/grit/node/node_io_unittest.py | 19 +++---- |
62 | + tools/grit/grit/pseudolocales_unittest.py | 8 +-- |
63 | + tools/grit/grit/shortcuts_unittest.py | 12 ++--- |
64 | + tools/grit/grit/tclib_unittest.py | 16 +++--- |
65 | + tools/grit/grit/tool/buildinfo_unittest.py | 7 +-- |
66 | + tools/grit/grit/util.py | 20 +++---- |
67 | + 30 files changed, 243 insertions(+), 327 deletions(-) |
68 | + |
69 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/format/c_format.py |
70 | +=================================================================== |
71 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/format/c_format.py |
72 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/format/c_format.py |
73 | +@@ -5,14 +5,10 @@ |
74 | + """Formats as a .C file for compilation. |
75 | + """ |
76 | + |
77 | +-from __future__ import print_function |
78 | +- |
79 | + import codecs |
80 | + import os |
81 | + import re |
82 | + |
83 | +-import six |
84 | +- |
85 | + from grit import util |
86 | + |
87 | + |
88 | +@@ -37,7 +33,7 @@ def _FormatHeader(root, output_dir): |
89 | + def Format(root, lang='en', output_dir='.'): |
90 | + """Outputs a C switch statement representing the string table.""" |
91 | + from grit.node import message |
92 | +- assert isinstance(lang, six.string_types) |
93 | ++ assert isinstance(lang, str) |
94 | + |
95 | + yield _FormatHeader(root, output_dir) |
96 | + |
97 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/format/c_format_unittest.py |
98 | +=================================================================== |
99 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/format/c_format_unittest.py |
100 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/format/c_format_unittest.py |
101 | +@@ -6,16 +6,13 @@ |
102 | + """Unittest for c_format.py. |
103 | + """ |
104 | + |
105 | +-from __future__ import print_function |
106 | +- |
107 | ++import io |
108 | + import os |
109 | + import sys |
110 | +-if __name__ == '__main__': |
111 | +- sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
112 | +- |
113 | + import unittest |
114 | + |
115 | +-from six import StringIO |
116 | ++if __name__ == '__main__': |
117 | ++ sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
118 | + |
119 | + from grit import util |
120 | + from grit.tool import build |
121 | +@@ -41,7 +38,7 @@ Statement. Two all. Game point. |
122 | + </messages> |
123 | + """) |
124 | + |
125 | +- buf = StringIO() |
126 | ++ buf = io.StringIO() |
127 | + build.RcBuilder.ProcessNode(root, DummyOutput('c_format', 'en'), buf) |
128 | + output = util.StripBlankLinesAndComments(buf.getvalue()) |
129 | + self.assertEqual(u"""\ |
130 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/format/chrome_messages_json_unittest.py |
131 | +=================================================================== |
132 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/format/chrome_messages_json_unittest.py |
133 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/format/chrome_messages_json_unittest.py |
134 | +@@ -6,17 +6,14 @@ |
135 | + """Unittest for chrome_messages_json.py. |
136 | + """ |
137 | + |
138 | +-from __future__ import print_function |
139 | +- |
140 | ++import io |
141 | + import json |
142 | + import os |
143 | + import sys |
144 | +-if __name__ == '__main__': |
145 | +- sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
146 | +- |
147 | + import unittest |
148 | + |
149 | +-from six import StringIO |
150 | ++if __name__ == '__main__': |
151 | ++ sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
152 | + |
153 | + from grit import grd_reader |
154 | + from grit import util |
155 | +@@ -61,7 +58,7 @@ class ChromeMessagesJsonFormatUnittest(u |
156 | + </messages> |
157 | + """) |
158 | + |
159 | +- buf = StringIO() |
160 | ++ buf = io.StringIO() |
161 | + build.RcBuilder.ProcessNode(root, DummyOutput('chrome_messages_json', 'en'), |
162 | + buf) |
163 | + output = buf.getvalue() |
164 | +@@ -115,7 +112,7 @@ class ChromeMessagesJsonFormatUnittest(u |
165 | + </messages> |
166 | + """) |
167 | + |
168 | +- buf = StringIO() |
169 | ++ buf = io.StringIO() |
170 | + build.RcBuilder.ProcessNode(root, DummyOutput('chrome_messages_json', 'fr'), |
171 | + buf) |
172 | + output = buf.getvalue() |
173 | +@@ -143,9 +140,9 @@ class ChromeMessagesJsonFormatUnittest(u |
174 | + </messages> |
175 | + </release> |
176 | + </grit>""" |
177 | +- root = grd_reader.Parse(StringIO(grd), dir=".") |
178 | ++ root = grd_reader.Parse(io.StringIO(grd), dir=".") |
179 | + |
180 | +- buf = StringIO() |
181 | ++ buf = io.StringIO() |
182 | + build.RcBuilder.ProcessNode(root, DummyOutput('chrome_messages_json', 'fr'), |
183 | + buf) |
184 | + output = buf.getvalue() |
185 | +@@ -161,7 +158,7 @@ class ChromeMessagesJsonFormatUnittest(u |
186 | + </messages> |
187 | + """) |
188 | + |
189 | +- buf = StringIO() |
190 | ++ buf = io.StringIO() |
191 | + build.RcBuilder.ProcessNode(root, DummyOutput('chrome_messages_json', 'en'), |
192 | + buf) |
193 | + output = buf.getvalue() |
194 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/format/data_pack.py |
195 | +=================================================================== |
196 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/format/data_pack.py |
197 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/format/data_pack.py |
198 | +@@ -7,17 +7,14 @@ |
199 | + files. |
200 | + """ |
201 | + |
202 | +-from __future__ import print_function |
203 | +- |
204 | + import collections |
205 | + import os |
206 | + import struct |
207 | + import sys |
208 | ++ |
209 | + if __name__ == '__main__': |
210 | + sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
211 | + |
212 | +-import six |
213 | +- |
214 | + from grit import util |
215 | + from grit.node import include |
216 | + from grit.node import message |
217 | +@@ -180,7 +177,7 @@ def WriteDataPackToString(resources, enc |
218 | + if resource_id in alias_map: |
219 | + continue |
220 | + data = resources[resource_id] |
221 | +- if isinstance(data, six.text_type): |
222 | ++ if isinstance(data, str): |
223 | + data = data.encode('utf-8') |
224 | + index_by_id[resource_id] = index |
225 | + ret.append(struct.pack('<HI', resource_id, data_offset)) |
226 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/format/gen_predetermined_ids_unittest.py |
227 | +=================================================================== |
228 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/format/gen_predetermined_ids_unittest.py |
229 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/format/gen_predetermined_ids_unittest.py |
230 | +@@ -5,16 +5,13 @@ |
231 | + |
232 | + '''Unit tests for the gen_predetermined_ids module.''' |
233 | + |
234 | +-from __future__ import print_function |
235 | +- |
236 | ++import io |
237 | + import os |
238 | + import sys |
239 | +-if __name__ == '__main__': |
240 | +- sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
241 | +- |
242 | + import unittest |
243 | + |
244 | +-from six import StringIO |
245 | ++if __name__ == '__main__': |
246 | ++ sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
247 | + |
248 | + from grit.format import gen_predetermined_ids |
249 | + |
250 | +@@ -27,7 +24,7 @@ class GenPredeterminedIdsUnittest(unitte |
251 | + self.assertEqual({101: 'C', 102: 'B', 103: 'E'}, mapping) |
252 | + |
253 | + def testReadResourceIdsFromFile(self): |
254 | +- f = StringIO(''' |
255 | ++ f = io.StringIO(''' |
256 | + // This file is automatically generated by GRIT. Do not edit. |
257 | + |
258 | + #pragma once |
259 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/format/minifier.py |
260 | +=================================================================== |
261 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/format/minifier.py |
262 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/format/minifier.py |
263 | +@@ -3,14 +3,10 @@ |
264 | + # found in the LICENSE file. |
265 | + """Framework for stripping whitespace and comments from resource files""" |
266 | + |
267 | +-from __future__ import print_function |
268 | +- |
269 | + from os import path |
270 | + import subprocess |
271 | + import sys |
272 | + |
273 | +-import six |
274 | +- |
275 | + __js_minifier = None |
276 | + __css_minifier = None |
277 | + |
278 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/format/rc.py |
279 | +=================================================================== |
280 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/format/rc.py |
281 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/format/rc.py |
282 | +@@ -5,14 +5,10 @@ |
283 | + '''Support for formatting an RC file for compilation. |
284 | + ''' |
285 | + |
286 | +-from __future__ import print_function |
287 | +- |
288 | + import os |
289 | + import re |
290 | + from functools import partial |
291 | + |
292 | +-import six |
293 | +- |
294 | + from grit import util |
295 | + from grit.node import misc |
296 | + |
297 | +@@ -322,7 +318,7 @@ def RcSubstitutions(substituter, lang): |
298 | + |
299 | + def _FormatHeader(root, lang, output_dir): |
300 | + '''Returns the required preamble for RC files.''' |
301 | +- assert isinstance(lang, six.string_types) |
302 | ++ assert isinstance(lang, str) |
303 | + assert isinstance(root, misc.GritNode) |
304 | + # Find the location of the resource header file, so that we can include |
305 | + # it. |
306 | +@@ -380,7 +376,7 @@ def FormatMessage(item, lang): |
307 | + |
308 | + def _FormatSection(item, lang, output_dir): |
309 | + '''Writes out an .rc file section.''' |
310 | +- assert isinstance(lang, six.string_types) |
311 | ++ assert isinstance(lang, str) |
312 | + from grit.node import structure |
313 | + assert isinstance(item, structure.StructureNode) |
314 | + |
315 | +@@ -409,7 +405,7 @@ def FormatInclude(item, lang, output_dir |
316 | + StructureNode) |
317 | + process_html: False/True (ignored unless item is a StructureNode) |
318 | + ''' |
319 | +- assert isinstance(lang, six.string_types) |
320 | ++ assert isinstance(lang, str) |
321 | + from grit.node import structure |
322 | + from grit.node import include |
323 | + assert isinstance(item, (structure.StructureNode, include.IncludeNode)) |
324 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/format/rc_unittest.py |
325 | +=================================================================== |
326 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/format/rc_unittest.py |
327 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/format/rc_unittest.py |
328 | +@@ -5,18 +5,15 @@ |
329 | + |
330 | + '''Unit tests for grit.format.rc''' |
331 | + |
332 | +-from __future__ import print_function |
333 | +- |
334 | ++import io |
335 | + import os |
336 | + import re |
337 | + import sys |
338 | +-if __name__ == '__main__': |
339 | +- sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
340 | +- |
341 | + import tempfile |
342 | + import unittest |
343 | + |
344 | +-from six import StringIO |
345 | ++if __name__ == '__main__': |
346 | ++ sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
347 | + |
348 | + from grit import grd_reader |
349 | + from grit import util |
350 | +@@ -69,7 +66,7 @@ Sting sting |
351 | + </messages> |
352 | + """) |
353 | + |
354 | +- buf = StringIO() |
355 | ++ buf = io.StringIO() |
356 | + build.RcBuilder.ProcessNode(root, DummyOutput('rc_all', 'en'), buf) |
357 | + output = util.StripBlankLinesAndComments(buf.getvalue()) |
358 | + self.assertEqual(_PREAMBLE + u'''\ |
359 | +@@ -91,7 +88,7 @@ END''', output) |
360 | + root.SetOutputLanguage('en') |
361 | + root.RunGatherers() |
362 | + |
363 | +- buf = StringIO() |
364 | ++ buf = io.StringIO() |
365 | + build.RcBuilder.ProcessNode(root, DummyOutput('rc_all', 'en'), buf) |
366 | + output = util.StripBlankLinesAndComments(buf.getvalue()) |
367 | + expected = _PREAMBLE + u'''\ |
368 | +@@ -168,7 +165,7 @@ END'''.strip() |
369 | + </structures>''', base_dir = '/temp') |
370 | + # We do not run gatherers as it is not needed and wouldn't find the file |
371 | + |
372 | +- buf = StringIO() |
373 | ++ buf = io.StringIO() |
374 | + build.RcBuilder.ProcessNode(root, DummyOutput('rc_all', 'en'), buf) |
375 | + output = util.StripBlankLinesAndComments(buf.getvalue()) |
376 | + expected = (_PREAMBLE + |
377 | +@@ -187,7 +184,7 @@ END'''.strip() |
378 | + <include type="TXT" name="TEXT_TWO" file="bingo2.txt" filenameonly="true" /> |
379 | + </includes>''', base_dir = '/temp') |
380 | + |
381 | +- buf = StringIO() |
382 | ++ buf = io.StringIO() |
383 | + build.RcBuilder.ProcessNode(root, DummyOutput('rc_all', 'en'), buf) |
384 | + output = util.StripBlankLinesAndComments(buf.getvalue()) |
385 | + expected = (_PREAMBLE + |
386 | +@@ -207,7 +204,7 @@ END'''.strip() |
387 | + <include name="HTML_FILE1" flattenhtml="true" file="%s" type="BINDATA" /> |
388 | + </includes>''' % input_file) |
389 | + |
390 | +- buf = StringIO() |
391 | ++ buf = io.StringIO() |
392 | + build.RcBuilder.ProcessNode(root, DummyOutput('rc_all', 'en', output_file), |
393 | + buf) |
394 | + output = util.StripBlankLinesAndComments(buf.getvalue()) |
395 | +@@ -274,7 +271,7 @@ END'''.strip() |
396 | + root.SetOutputLanguage('en') |
397 | + root.RunGatherers() |
398 | + |
399 | +- buf = StringIO() |
400 | ++ buf = io.StringIO() |
401 | + build.RcBuilder.ProcessNode(root, DummyOutput('rc_all', 'en', output_file), |
402 | + buf) |
403 | + output = util.StripBlankLinesAndComments(buf.getvalue()) |
404 | +@@ -294,7 +291,8 @@ END'''.strip() |
405 | + |
406 | + def testSubstitutionHtml(self): |
407 | + input_file = util.PathFromRoot('grit/testdata/toolbar_about.html') |
408 | +- root = grd_reader.Parse(StringIO('''<?xml version="1.0" encoding="UTF-8"?> |
409 | ++ root = grd_reader.Parse( |
410 | ++ io.StringIO('''<?xml version="1.0" encoding="UTF-8"?> |
411 | + <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir="."> |
412 | + <release seq="1" allow_pseudo="False"> |
413 | + <structures fallback_to_english="True"> |
414 | +@@ -327,7 +325,7 @@ END'''.strip() |
415 | + root.SetOutputLanguage('en') |
416 | + root.RunGatherers() |
417 | + |
418 | +- buf = StringIO() |
419 | ++ buf = io.StringIO() |
420 | + formatter = build.RcBuilder.ProcessNode( |
421 | + root, DummyOutput('rc_all', 'bingobongo'), buf) |
422 | + output = util.StripBlankLinesAndComments(buf.getvalue()) |
423 | +@@ -348,7 +346,8 @@ END''', output) |
424 | + |
425 | + |
426 | + def testSubstitutionRc(self): |
427 | +- root = grd_reader.Parse(StringIO(r'''<?xml version="1.0" encoding="UTF-8"?> |
428 | ++ root = grd_reader.Parse( |
429 | ++ io.StringIO(r'''<?xml version="1.0" encoding="UTF-8"?> |
430 | + <grit latest_public_release="2" source_lang_id="en-US" current_release="3" |
431 | + base_dir="."> |
432 | + <outputs> |
433 | +@@ -371,7 +370,7 @@ END''', output) |
434 | + root.SetOutputLanguage('en') |
435 | + root.RunGatherers() |
436 | + |
437 | +- buf = StringIO() |
438 | ++ buf = io.StringIO() |
439 | + build.RcBuilder.ProcessNode(root, DummyOutput('rc_all', 'en'), buf) |
440 | + output = buf.getvalue() |
441 | + self.assertEqual(''' |
442 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/gather/admin_template_unittest.py |
443 | +=================================================================== |
444 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/gather/admin_template_unittest.py |
445 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/gather/admin_template_unittest.py |
446 | +@@ -5,16 +5,13 @@ |
447 | + |
448 | + '''Unit tests for the admin template gatherer.''' |
449 | + |
450 | +-from __future__ import print_function |
451 | +- |
452 | ++import io |
453 | + import os |
454 | + import sys |
455 | +-if __name__ == '__main__': |
456 | +- sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
457 | +- |
458 | + import unittest |
459 | + |
460 | +-from six import StringIO |
461 | ++if __name__ == '__main__': |
462 | ++ sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
463 | + |
464 | + from grit.gather import admin_template |
465 | + from grit import util |
466 | +@@ -25,12 +22,12 @@ from grit.tool import build |
467 | + |
468 | + class AdmGathererUnittest(unittest.TestCase): |
469 | + def testParsingAndTranslating(self): |
470 | +- pseudofile = StringIO( |
471 | +- 'bingo bongo\n' |
472 | +- 'ding dong\n' |
473 | +- '[strings] \n' |
474 | +- 'whatcha="bingo bongo"\n' |
475 | +- 'gotcha = "bingolabongola "the wise" fingulafongula" \n') |
476 | ++ pseudofile = io.StringIO( |
477 | ++ 'bingo bongo\n' |
478 | ++ 'ding dong\n' |
479 | ++ '[strings] \n' |
480 | ++ 'whatcha="bingo bongo"\n' |
481 | ++ 'gotcha = "bingolabongola "the wise" fingulafongula" \n') |
482 | + gatherer = admin_template.AdmGatherer(pseudofile) |
483 | + gatherer.Parse() |
484 | + self.failUnless(len(gatherer.GetCliques()) == 2) |
485 | +@@ -41,11 +38,11 @@ class AdmGathererUnittest(unittest.TestC |
486 | + self.failUnless(translation == gatherer.GetText().strip()) |
487 | + |
488 | + def testErrorHandling(self): |
489 | +- pseudofile = StringIO( |
490 | +- 'bingo bongo\n' |
491 | +- 'ding dong\n' |
492 | +- 'whatcha="bingo bongo"\n' |
493 | +- 'gotcha = "bingolabongola "the wise" fingulafongula" \n') |
494 | ++ pseudofile = io.StringIO( |
495 | ++ 'bingo bongo\n' |
496 | ++ 'ding dong\n' |
497 | ++ 'whatcha="bingo bongo"\n' |
498 | ++ 'gotcha = "bingolabongola "the wise" fingulafongula" \n') |
499 | + gatherer = admin_template.AdmGatherer(pseudofile) |
500 | + self.assertRaises(admin_template.MalformedAdminTemplateException, |
501 | + gatherer.Parse) |
502 | +@@ -73,7 +70,8 @@ class AdmGathererUnittest(unittest.TestC |
503 | + self.VerifyCliquesFromAdmFile(cliques) |
504 | + |
505 | + def MakeGrd(self): |
506 | +- grd = grd_reader.Parse(StringIO('''<?xml version="1.0" encoding="UTF-8"?> |
507 | ++ grd = grd_reader.Parse( |
508 | ++ io.StringIO('''<?xml version="1.0" encoding="UTF-8"?> |
509 | + <grit latest_public_release="2" source_lang_id="en-US" current_release="3"> |
510 | + <release seq="3"> |
511 | + <structures> |
512 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/gather/interface.py |
513 | +=================================================================== |
514 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/gather/interface.py |
515 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/gather/interface.py |
516 | +@@ -5,12 +5,8 @@ |
517 | + '''Interface for all gatherers. |
518 | + ''' |
519 | + |
520 | +-from __future__ import print_function |
521 | +- |
522 | + import os.path |
523 | + |
524 | +-import six |
525 | +- |
526 | + from grit import clique |
527 | + from grit import util |
528 | + |
529 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/gather/policy_json.py |
530 | +=================================================================== |
531 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/gather/policy_json.py |
532 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/gather/policy_json.py |
533 | +@@ -84,8 +84,8 @@ class PolicyJson(skeleton_gatherer.Skele |
534 | + try: |
535 | + node = minidom.parseString(xml).childNodes[0] |
536 | + except ExpatError: |
537 | +- reason = '''Input isn't valid XML (has < & > been escaped?): ''' + string |
538 | +- six.reraise(Exception, reason, sys.exc_info()[2]) |
539 | ++ raise Exception('''Input isn't valid XML (has < & > been escaped?): ''' + |
540 | ++ string) |
541 | + |
542 | + for child in node.childNodes: |
543 | + if child.nodeType == minidom.Node.TEXT_NODE: |
544 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/gather/policy_json_unittest.py |
545 | +=================================================================== |
546 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/gather/policy_json_unittest.py |
547 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/gather/policy_json_unittest.py |
548 | +@@ -5,18 +5,15 @@ |
549 | + |
550 | + '''Unit tests for grit.gather.policy_json''' |
551 | + |
552 | +-from __future__ import print_function |
553 | +- |
554 | ++import io |
555 | + import json |
556 | + import os |
557 | + import re |
558 | + import sys |
559 | +-if __name__ == '__main__': |
560 | +- sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
561 | +- |
562 | + import unittest |
563 | + |
564 | +-from six import StringIO |
565 | ++if __name__ == '__main__': |
566 | ++ sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
567 | + |
568 | + from grit.gather import policy_json |
569 | + |
570 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/gather/rc_unittest.py |
571 | +=================================================================== |
572 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/gather/rc_unittest.py |
573 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/gather/rc_unittest.py |
574 | +@@ -5,16 +5,13 @@ |
575 | + |
576 | + '''Unit tests for grit.gather.rc''' |
577 | + |
578 | +-from __future__ import print_function |
579 | +- |
580 | ++import io |
581 | + import os |
582 | + import sys |
583 | +-if __name__ == '__main__': |
584 | +- sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
585 | +- |
586 | + import unittest |
587 | + |
588 | +-from six import StringIO |
589 | ++if __name__ == '__main__': |
590 | ++ sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
591 | + |
592 | + from grit.gather import rc |
593 | + from grit import util |
594 | +@@ -42,7 +39,7 @@ BEGIN |
595 | + END |
596 | + ''' % self.part_we_want |
597 | + |
598 | +- f = StringIO(buf) |
599 | ++ f = io.StringIO(buf) |
600 | + |
601 | + out = rc.Section(f, 'IDC_KLONKACC') |
602 | + out.ReadSection() |
603 | +@@ -59,7 +56,8 @@ END |
604 | + |
605 | + |
606 | + def testDialog(self): |
607 | +- dlg = rc.Dialog(StringIO('''IDD_ABOUTBOX DIALOGEX 22, 17, 230, 75 |
608 | ++ dlg = rc.Dialog( |
609 | ++ io.StringIO('''IDD_ABOUTBOX DIALOGEX 22, 17, 230, 75 |
610 | + STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU |
611 | + CAPTION "About" |
612 | + FONT 8, "System", 0, 0, 0x0 |
613 | +@@ -86,7 +84,8 @@ END |
614 | + self.failUnless(transl.strip() == dlg.GetText().strip()) |
615 | + |
616 | + def testAlternateSkeleton(self): |
617 | +- dlg = rc.Dialog(StringIO('''IDD_ABOUTBOX DIALOGEX 22, 17, 230, 75 |
618 | ++ dlg = rc.Dialog( |
619 | ++ io.StringIO('''IDD_ABOUTBOX DIALOGEX 22, 17, 230, 75 |
620 | + STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU |
621 | + CAPTION "About" |
622 | + FONT 8, "System", 0, 0, 0x0 |
623 | +@@ -97,7 +96,8 @@ END |
624 | + '''), 'IDD_ABOUTBOX') |
625 | + dlg.Parse() |
626 | + |
627 | +- alt_dlg = rc.Dialog(StringIO('''IDD_ABOUTBOX DIALOGEX 040704, 17, 230, 75 |
628 | ++ alt_dlg = rc.Dialog( |
629 | ++ io.StringIO('''IDD_ABOUTBOX DIALOGEX 040704, 17, 230, 75 |
630 | + STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU |
631 | + CAPTION "XXXXXXXXX" |
632 | + FONT 8, "System", 0, 0, 0x0 |
633 | +@@ -114,7 +114,8 @@ END |
634 | + self.failUnless(transl.count('Yipee skippy')) |
635 | + |
636 | + def testMenu(self): |
637 | +- menu = rc.Menu(StringIO('''IDC_KLONK MENU |
638 | ++ menu = rc.Menu( |
639 | ++ io.StringIO('''IDC_KLONK MENU |
640 | + BEGIN |
641 | + POPUP "&File """ |
642 | + BEGIN |
643 | +@@ -143,7 +144,8 @@ END'''), 'IDC_KLONK') |
644 | + self.failUnless(transl.strip() == menu.GetText().strip()) |
645 | + |
646 | + def testVersion(self): |
647 | +- version = rc.Version(StringIO(''' |
648 | ++ version = rc.Version( |
649 | ++ io.StringIO(''' |
650 | + VS_VERSION_INFO VERSIONINFO |
651 | + FILEVERSION 1,0,0,1 |
652 | + PRODUCTVERSION 1,0,0,1 |
653 | +@@ -186,7 +188,8 @@ END |
654 | + |
655 | + |
656 | + def testRegressionDialogBox(self): |
657 | +- dialog = rc.Dialog(StringIO(''' |
658 | ++ dialog = rc.Dialog( |
659 | ++ io.StringIO(''' |
660 | + IDD_SIDEBAR_WEATHER_PANEL_PROPPAGE DIALOGEX 0, 0, 205, 157 |
661 | + STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD |
662 | + FONT 8, "MS Shell Dlg", 400, 0, 0x1 |
663 | +@@ -210,7 +213,8 @@ END'''.strip()), 'IDD_SIDEBAR_WEATHER_PA |
664 | + |
665 | + |
666 | + def testRegressionDialogBox2(self): |
667 | +- dialog = rc.Dialog(StringIO(''' |
668 | ++ dialog = rc.Dialog( |
669 | ++ io.StringIO(''' |
670 | + IDD_SIDEBAR_EMAIL_PANEL_PROPPAGE DIALOG DISCARDABLE 0, 0, 264, 220 |
671 | + STYLE WS_CHILD |
672 | + FONT 8, "MS Shell Dlg" |
673 | +@@ -230,7 +234,8 @@ END'''.strip()), 'IDD_SIDEBAR_EMAIL_PANE |
674 | + |
675 | + |
676 | + def testRegressionMenuId(self): |
677 | +- menu = rc.Menu(StringIO(''' |
678 | ++ menu = rc.Menu( |
679 | ++ io.StringIO(''' |
680 | + IDR_HYPERMENU_FOLDER MENU |
681 | + BEGIN |
682 | + POPUP "HyperFolder" |
683 | +@@ -242,7 +247,8 @@ END'''.strip()), 'IDR_HYPERMENU_FOLDER') |
684 | + self.failUnless(len(menu.GetTextualIds()) == 2) |
685 | + |
686 | + def testRegressionNewlines(self): |
687 | +- menu = rc.Menu(StringIO(''' |
688 | ++ menu = rc.Menu( |
689 | ++ io.StringIO(''' |
690 | + IDR_HYPERMENU_FOLDER MENU |
691 | + BEGIN |
692 | + POPUP "Hyper\\nFolder" |
693 | +@@ -256,7 +262,8 @@ END'''.strip()), 'IDR_HYPERMENU_FOLDER') |
694 | + self.failUnless(transl.find('\\\\n') == -1) |
695 | + |
696 | + def testRegressionTabs(self): |
697 | +- menu = rc.Menu(StringIO(''' |
698 | ++ menu = rc.Menu( |
699 | ++ io.StringIO(''' |
700 | + IDR_HYPERMENU_FOLDER MENU |
701 | + BEGIN |
702 | + POPUP "Hyper\\tFolder" |
703 | +@@ -282,7 +289,8 @@ END'''.strip()), 'IDR_HYPERMENU_FOLDER') |
704 | + self.failUnless(unescaped == '..\\..\\trs\\res\\nav_first.gif') |
705 | + |
706 | + def testRegressionDialogItemsTextOnly(self): |
707 | +- dialog = rc.Dialog(StringIO('''IDD_OPTIONS_SEARCH DIALOGEX 0, 0, 280, 292 |
708 | ++ dialog = rc.Dialog( |
709 | ++ io.StringIO('''IDD_OPTIONS_SEARCH DIALOGEX 0, 0, 280, 292 |
710 | + STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | |
711 | + WS_DISABLED | WS_CAPTION | WS_SYSMENU |
712 | + CAPTION "Search" |
713 | +@@ -303,7 +311,8 @@ END'''), 'IDD_OPTIONS_SEARCH') |
714 | + self.failUnless('Use Google site:' in translateables) |
715 | + |
716 | + def testAccelerators(self): |
717 | +- acc = rc.Accelerators(StringIO('''\ |
718 | ++ acc = rc.Accelerators( |
719 | ++ io.StringIO('''\ |
720 | + IDR_ACCELERATOR1 ACCELERATORS |
721 | + BEGIN |
722 | + "^C", ID_ACCELERATOR32770, ASCII, NOINVERT |
723 | +@@ -320,7 +329,8 @@ END |
724 | + |
725 | + |
726 | + def testRegressionEmptyString(self): |
727 | +- dlg = rc.Dialog(StringIO('''\ |
728 | ++ dlg = rc.Dialog( |
729 | ++ io.StringIO('''\ |
730 | + IDD_CONFIRM_QUIT_GD_DLG DIALOGEX 0, 0, 267, 108 |
731 | + STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | |
732 | + WS_CAPTION |
733 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/gather/skeleton_gatherer.py |
734 | +=================================================================== |
735 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/gather/skeleton_gatherer.py |
736 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/gather/skeleton_gatherer.py |
737 | +@@ -6,10 +6,6 @@ |
738 | + list. |
739 | + ''' |
740 | + |
741 | +-from __future__ import print_function |
742 | +- |
743 | +-import six |
744 | +- |
745 | + from grit.gather import interface |
746 | + from grit import clique |
747 | + from grit import exception |
748 | +@@ -78,17 +74,16 @@ class SkeletonGatherer(interface.Gathere |
749 | + |
750 | + out = [] |
751 | + for ix in range(len(self.skeleton_)): |
752 | +- if isinstance(self.skeleton_[ix], six.string_types): |
753 | ++ if isinstance(self.skeleton_[ix], str): |
754 | + if skeleton_gatherer: |
755 | + # Make sure the skeleton is like the original |
756 | +- assert(isinstance(skeleton_gatherer.skeleton_[ix], six.string_types)) |
757 | ++ assert (isinstance(skeleton_gatherer.skeleton_[ix], str)) |
758 | + out.append(skeleton_gatherer.skeleton_[ix]) |
759 | + else: |
760 | + out.append(self.skeleton_[ix]) |
761 | + else: |
762 | + if skeleton_gatherer: # Make sure the skeleton is like the original |
763 | +- assert(not isinstance(skeleton_gatherer.skeleton_[ix], |
764 | +- six.string_types)) |
765 | ++ assert (not isinstance(skeleton_gatherer.skeleton_[ix], str)) |
766 | + msg = self.skeleton_[ix].MessageForLanguage(lang, |
767 | + pseudo_if_not_available, |
768 | + fallback_to_english) |
769 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/gather/tr_html.py |
770 | +=================================================================== |
771 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/gather/tr_html.py |
772 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/gather/tr_html.py |
773 | +@@ -49,12 +49,8 @@ This implementation borrows some code, c |
774 | + extern.tclib.api.handlers.html.TCHTMLParser. |
775 | + ''' |
776 | + |
777 | +-from __future__ import print_function |
778 | +- |
779 | + import re |
780 | + |
781 | +-import six |
782 | +- |
783 | + from grit import clique |
784 | + from grit import exception |
785 | + from grit import lazy_re |
786 | +@@ -571,7 +567,7 @@ def HtmlToMessage(html, include_block_ta |
787 | + current += m.end() |
788 | + continue |
789 | + |
790 | +- if len(parts) and isinstance(parts[-1], six.string_types): |
791 | ++ if len(parts) and isinstance(parts[-1], str): |
792 | + parts[-1] += html[current] |
793 | + else: |
794 | + parts.append(html[current]) |
795 | +@@ -592,7 +588,7 @@ def HtmlToMessage(html, include_block_ta |
796 | + description=description) |
797 | + content = msg.GetContent() |
798 | + for ix in range(len(content)): |
799 | +- if isinstance(content[ix], six.string_types): |
800 | ++ if isinstance(content[ix], str): |
801 | + content[ix] = util.UnescapeHtml(content[ix], replace_nbsp=False) |
802 | + |
803 | + return msg |
804 | +@@ -656,7 +652,7 @@ class TrHtml(interface.GathererBase): |
805 | + |
806 | + out = [] |
807 | + for item in self.skeleton_: |
808 | +- if isinstance(item, six.string_types): |
809 | ++ if isinstance(item, str): |
810 | + out.append(item) |
811 | + else: |
812 | + msg = item.MessageForLanguage(lang, |
813 | +@@ -716,8 +712,8 @@ class TrHtml(interface.GathererBase): |
814 | + if isinstance(self.skeleton_[ix], clique.MessageClique): |
815 | + msg = self.skeleton_[ix].GetMessage() |
816 | + for item in msg.GetContent(): |
817 | +- if (isinstance(item, six.string_types) |
818 | +- and _NON_WHITESPACE.search(item) and item != ' '): |
819 | ++ if (isinstance(item, str) and _NON_WHITESPACE.search(item) |
820 | ++ and item != ' '): |
821 | + got_text = True |
822 | + break |
823 | + if not got_text: |
824 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/gather/tr_html_unittest.py |
825 | +=================================================================== |
826 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/gather/tr_html_unittest.py |
827 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/gather/tr_html_unittest.py |
828 | +@@ -5,17 +5,13 @@ |
829 | + |
830 | + '''Unit tests for grit.gather.tr_html''' |
831 | + |
832 | +-from __future__ import print_function |
833 | +- |
834 | ++import io |
835 | + import os |
836 | + import sys |
837 | +-if __name__ == '__main__': |
838 | +- sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
839 | +- |
840 | + import unittest |
841 | + |
842 | +-import six |
843 | +-from six import StringIO |
844 | ++if __name__ == '__main__': |
845 | ++ sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
846 | + |
847 | + from grit.gather import tr_html |
848 | + from grit import clique |
849 | +@@ -264,7 +260,7 @@ and BEGIN_LINK_2Privacy FAQEND_LINK_2 on |
850 | + |
851 | + class TrHtmlUnittest(unittest.TestCase): |
852 | + def testSetAttributes(self): |
853 | +- html = tr_html.TrHtml(StringIO('')) |
854 | ++ html = tr_html.TrHtml(io.StringIO('')) |
855 | + self.failUnlessEqual(html.fold_whitespace_, False) |
856 | + html.SetAttributes({}) |
857 | + self.failUnlessEqual(html.fold_whitespace_, False) |
858 | +@@ -276,19 +272,20 @@ class TrHtmlUnittest(unittest.TestCase): |
859 | + def testFoldWhitespace(self): |
860 | + text = '<td> Test Message </td>' |
861 | + |
862 | +- html = tr_html.TrHtml(StringIO(text)) |
863 | ++ html = tr_html.TrHtml(io.StringIO(text)) |
864 | + html.Parse() |
865 | + self.failUnlessEqual(html.skeleton_[1].GetMessage().GetPresentableContent(), |
866 | + 'Test Message') |
867 | + |
868 | +- html = tr_html.TrHtml(StringIO(text)) |
869 | ++ html = tr_html.TrHtml(io.StringIO(text)) |
870 | + html.fold_whitespace_ = True |
871 | + html.Parse() |
872 | + self.failUnlessEqual(html.skeleton_[1].GetMessage().GetPresentableContent(), |
873 | + 'Test Message') |
874 | + |
875 | + def testTable(self): |
876 | +- html = tr_html.TrHtml(StringIO('''<table class="shaded-header"><tr> |
877 | ++ html = tr_html.TrHtml( |
878 | ++ io.StringIO('''<table class="shaded-header"><tr> |
879 | + <td class="header-element b expand">Preferences</td> |
880 | + <td class="header-element s"> |
881 | + <a href="http://desktop.google.com/preferences.html">Preferences Help</a> |
882 | +@@ -299,7 +296,8 @@ class TrHtmlUnittest(unittest.TestCase): |
883 | + 'BEGIN_LINKPreferences HelpEND_LINK') |
884 | + |
885 | + def testSubmitAttribute(self): |
886 | +- html = tr_html.TrHtml(StringIO('''</td> |
887 | ++ html = tr_html.TrHtml( |
888 | ++ io.StringIO('''</td> |
889 | + <td class="header-element"><input type=submit value="Save Preferences" |
890 | + name=submit2></td> |
891 | + </tr></table>''')) |
892 | +@@ -312,13 +310,14 @@ name=submit2></td> |
893 | + of a translateable section the inline tag will be included. |
894 | + ''' |
895 | + html = tr_html.TrHtml( |
896 | +- StringIO('''<label for=DISPLAYNONE><font size=-1> Hello</font>''')) |
897 | ++ io.StringIO('''<label for=DISPLAYNONE><font size=-1> Hello</font>''')) |
898 | + html.Parse() |
899 | + self.failUnless(html.skeleton_[1].GetMessage().GetRealContent() == |
900 | + '<font size=-1> Hello</font>') |
901 | + |
902 | + def testSillyHeader(self): |
903 | +- html = tr_html.TrHtml(StringIO('''[!] |
904 | ++ html = tr_html.TrHtml( |
905 | ++ io.StringIO('''[!] |
906 | + title\tHello |
907 | + bingo |
908 | + bongo |
909 | +@@ -336,16 +335,16 @@ bla |
910 | + |
911 | + def testExplicitDescriptions(self): |
912 | + html = tr_html.TrHtml( |
913 | +- StringIO('Hello [USER]<br/><!-- desc=explicit -->' |
914 | +- '<input type="button">Go!</input>')) |
915 | ++ io.StringIO('Hello [USER]<br/><!-- desc=explicit -->' |
916 | ++ '<input type="button">Go!</input>')) |
917 | + html.Parse() |
918 | + msg = html.GetCliques()[1].GetMessage() |
919 | + self.failUnlessEqual(msg.GetDescription(), 'explicit') |
920 | + self.failUnlessEqual(msg.GetRealContent(), 'Go!') |
921 | + |
922 | + html = tr_html.TrHtml( |
923 | +- StringIO('Hello [USER]<br/><!-- desc=explicit\nmultiline -->' |
924 | +- '<input type="button">Go!</input>')) |
925 | ++ io.StringIO('Hello [USER]<br/><!-- desc=explicit\nmultiline -->' |
926 | ++ '<input type="button">Go!</input>')) |
927 | + html.Parse() |
928 | + msg = html.GetCliques()[1].GetMessage() |
929 | + self.failUnlessEqual(msg.GetDescription(), 'explicit multiline') |
930 | +@@ -369,7 +368,7 @@ bla |
931 | + # For manual results inspection only... |
932 | + list = [] |
933 | + for item in html.skeleton_: |
934 | +- if isinstance(item, six.string_types): |
935 | ++ if isinstance(item, str): |
936 | + list.append(item) |
937 | + else: |
938 | + list.append(item.GetMessage().GetPresentableContent()) |
939 | +@@ -446,7 +445,8 @@ bla |
940 | + # character itself. So for this test we choose some relatively complex |
941 | + # HTML without character entities (but with because that's handled |
942 | + # specially). |
943 | +- html = tr_html.TrHtml(StringIO(''' <script> |
944 | ++ html = tr_html.TrHtml( |
945 | ++ io.StringIO(''' <script> |
946 | + <!-- |
947 | + function checkOffice() { var w = document.getElementById("h7"); |
948 | + var e = document.getElementById("h8"); var o = document.getElementById("h10"); |
949 | +@@ -516,8 +516,10 @@ bla |
950 | + |
951 | + def testRegressionCpuHang(self): |
952 | + # If this regression occurs, the unit test will never return |
953 | +- html = tr_html.TrHtml(StringIO( |
954 | +- '''<input type=text size=12 id=advFileTypeEntry [~SHOW-FILETYPE-BOX~] value="[EXT]" name=ext>''')) |
955 | ++ html = tr_html.TrHtml( |
956 | ++ io.StringIO( |
957 | ++ '''<input type=text size=12 id=advFileTypeEntry [~SHOW-FILETYPE-BOX~] value="[EXT]" name=ext>''' |
958 | ++ )) |
959 | + html.Parse() |
960 | + |
961 | + if __name__ == '__main__': |
962 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/gather/txt_unittest.py |
963 | +=================================================================== |
964 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/gather/txt_unittest.py |
965 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/gather/txt_unittest.py |
966 | +@@ -5,24 +5,20 @@ |
967 | + |
968 | + '''Unit tests for TxtFile gatherer''' |
969 | + |
970 | +-from __future__ import print_function |
971 | +- |
972 | + import os |
973 | + import sys |
974 | +-if __name__ == '__main__': |
975 | +- sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
976 | +- |
977 | +- |
978 | + import unittest |
979 | ++import io |
980 | + |
981 | +-from six import StringIO |
982 | ++if __name__ == '__main__': |
983 | ++ sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
984 | + |
985 | + from grit.gather import txt |
986 | + |
987 | + |
988 | + class TxtUnittest(unittest.TestCase): |
989 | + def testGather(self): |
990 | +- input = StringIO('Hello there\nHow are you?') |
991 | ++ input = io.StringIO('Hello there\nHow are you?') |
992 | + gatherer = txt.TxtFile(input) |
993 | + gatherer.Parse() |
994 | + self.failUnless(gatherer.GetText() == input.getvalue()) |
995 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/grd_reader_unittest.py |
996 | +=================================================================== |
997 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/grd_reader_unittest.py |
998 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/grd_reader_unittest.py |
999 | +@@ -5,17 +5,13 @@ |
1000 | + |
1001 | + '''Unit tests for grd_reader package''' |
1002 | + |
1003 | +-from __future__ import print_function |
1004 | +- |
1005 | ++import io |
1006 | + import os |
1007 | + import sys |
1008 | +-if __name__ == '__main__': |
1009 | +- sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
1010 | +- |
1011 | + import unittest |
1012 | + |
1013 | +-import six |
1014 | +-from six import StringIO |
1015 | ++if __name__ == '__main__': |
1016 | ++ sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
1017 | + |
1018 | + from grit import exception |
1019 | + from grit import grd_reader |
1020 | +@@ -54,9 +50,9 @@ class GrdReaderUnittest(unittest.TestCas |
1021 | + <output filename="resource.rc" lang="en-US" type="rc_all" /> |
1022 | + </outputs> |
1023 | + </grit>''' |
1024 | +- pseudo_file = StringIO(input) |
1025 | ++ pseudo_file = io.StringIO(input) |
1026 | + tree = grd_reader.Parse(pseudo_file, '.') |
1027 | +- output = six.text_type(tree) |
1028 | ++ output = str(tree) |
1029 | + expected_output = input.replace(u' base_dir="."', u'') |
1030 | + self.assertEqual(expected_output, output) |
1031 | + self.failUnless(tree.GetNodeById('IDS_GREETING')) |
1032 | +@@ -75,7 +71,7 @@ class GrdReaderUnittest(unittest.TestCas |
1033 | + </includes> |
1034 | + </release> |
1035 | + </grit>''' |
1036 | +- pseudo_file = StringIO(input) |
1037 | ++ pseudo_file = io.StringIO(input) |
1038 | + tree = grd_reader.Parse(pseudo_file, '.', stop_after='outputs') |
1039 | + # only an <outputs> child |
1040 | + self.failUnless(len(tree.children) == 1) |
1041 | +@@ -94,7 +90,7 @@ class GrdReaderUnittest(unittest.TestCas |
1042 | + </messages> |
1043 | + </release> |
1044 | + </grit>''' |
1045 | +- pseudo_file = StringIO(input) |
1046 | ++ pseudo_file = io.StringIO(input) |
1047 | + tree = grd_reader.Parse(pseudo_file, '.') |
1048 | + |
1049 | + greeting = tree.GetNodeById('IDS_GREETING') |
1050 | +@@ -114,7 +110,7 @@ class GrdReaderUnittest(unittest.TestCas |
1051 | + </messages> |
1052 | + </release> |
1053 | + </grit>''' % first_ids_path |
1054 | +- pseudo_file = StringIO(input) |
1055 | ++ pseudo_file = io.StringIO(input) |
1056 | + grit_root_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), |
1057 | + '..') |
1058 | + fake_input_path = os.path.join( |
1059 | +@@ -151,7 +147,7 @@ class GrdReaderUnittest(unittest.TestCas |
1060 | + </messages> |
1061 | + </release> |
1062 | + </grit>''' |
1063 | +- pseudo_file = StringIO(input) |
1064 | ++ pseudo_file = io.StringIO(input) |
1065 | + grit_root_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), |
1066 | + '..') |
1067 | + fake_input_path = os.path.join(grit_root_dir, "grit/testdata/test.grd") |
1068 | +@@ -178,7 +174,7 @@ class GrdReaderUnittest(unittest.TestCas |
1069 | + </messages> |
1070 | + </release> |
1071 | + </grit>''' |
1072 | +- pseudo_file = StringIO(input) |
1073 | ++ pseudo_file = io.StringIO(input) |
1074 | + root = grd_reader.Parse(pseudo_file, '.', defines={'hello': '1'}) |
1075 | + |
1076 | + # Check if the ID is set to the name. In the past, there was a bug |
1077 | +@@ -206,7 +202,7 @@ class GrdReaderUnittest(unittest.TestCas |
1078 | + </messages> |
1079 | + </release> |
1080 | + </grit>''' |
1081 | +- pseudo_file = StringIO(input) |
1082 | ++ pseudo_file = io.StringIO(input) |
1083 | + root = grd_reader.Parse(pseudo_file, '.', defines={'hello': '1'}) |
1084 | + |
1085 | + # Check if the ID is set to the name. In the past, there was a bug |
1086 | +@@ -274,8 +270,7 @@ class GrdReaderUnittest(unittest.TestCas |
1087 | + |
1088 | + with util.TempDir({'sub.grp': sub_grd, |
1089 | + 'subsub.grp': subsub_grd}) as tmp_sub_dir: |
1090 | +- output = grd_reader.Parse(StringIO(top_grd), |
1091 | +- tmp_sub_dir.GetPath()) |
1092 | ++ output = grd_reader.Parse(io.StringIO(top_grd), tmp_sub_dir.GetPath()) |
1093 | + correct_sources = { |
1094 | + 'IDS_TEST': None, |
1095 | + 'IDS_TEST2': tmp_sub_dir.GetPath('sub.grp'), |
1096 | +@@ -306,7 +301,7 @@ class GrdReaderUnittest(unittest.TestCas |
1097 | + (exception.FileNotFound, u'<part file="yet_created_x" />'), |
1098 | + ] |
1099 | + for raises, data in part_failures: |
1100 | +- data = StringIO(template % data) |
1101 | ++ data = io.StringIO(template % data) |
1102 | + self.assertRaises(raises, grd_reader.Parse, data, '.') |
1103 | + |
1104 | + gritpart_failures = [ |
1105 | +@@ -314,7 +309,7 @@ class GrdReaderUnittest(unittest.TestCas |
1106 | + (exception.MissingElement, u'<output filename="x" type="y" />'), |
1107 | + ] |
1108 | + for raises, data in gritpart_failures: |
1109 | +- top_grd = StringIO(template % u'<part file="bad.grp" />') |
1110 | ++ top_grd = io.StringIO(template % u'<part file="bad.grp" />') |
1111 | + with util.TempDir({'bad.grp': data}) as temp_dir: |
1112 | + self.assertRaises(raises, grd_reader.Parse, top_grd, temp_dir.GetPath()) |
1113 | + |
1114 | +@@ -338,7 +333,8 @@ class GrdReaderUnittest(unittest.TestCas |
1115 | + </release> |
1116 | + </grit>''' % sys.platform |
1117 | + with util.TempDir({}) as temp_dir: |
1118 | +- grd_reader.Parse(StringIO(grd_text), temp_dir.GetPath(), |
1119 | ++ grd_reader.Parse(io.StringIO(grd_text), |
1120 | ++ temp_dir.GetPath(), |
1121 | + target_platform='android') |
1122 | + |
1123 | + |
1124 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/grit_runner_unittest.py |
1125 | +=================================================================== |
1126 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/grit_runner_unittest.py |
1127 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/grit_runner_unittest.py |
1128 | +@@ -5,23 +5,20 @@ |
1129 | + |
1130 | + '''Unit tests for grit.py''' |
1131 | + |
1132 | +-from __future__ import print_function |
1133 | +- |
1134 | ++import io |
1135 | + import os |
1136 | + import sys |
1137 | +-if __name__ == '__main__': |
1138 | +- sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
1139 | +- |
1140 | + import unittest |
1141 | + |
1142 | +-from six import StringIO |
1143 | ++if __name__ == '__main__': |
1144 | ++ sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
1145 | + |
1146 | + from grit import util |
1147 | + import grit.grit_runner |
1148 | + |
1149 | + class OptionArgsUnittest(unittest.TestCase): |
1150 | + def setUp(self): |
1151 | +- self.buf = StringIO() |
1152 | ++ self.buf = io.StringIO() |
1153 | + self.old_stdout = sys.stdout |
1154 | + sys.stdout = self.buf |
1155 | + |
1156 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/node/base.py |
1157 | +=================================================================== |
1158 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/node/base.py |
1159 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/node/base.py |
1160 | +@@ -5,16 +5,12 @@ |
1161 | + '''Base types for nodes in a GRIT resource tree. |
1162 | + ''' |
1163 | + |
1164 | +-from __future__ import print_function |
1165 | +- |
1166 | + import ast |
1167 | + import os |
1168 | + import struct |
1169 | + import sys |
1170 | + from xml.sax import saxutils |
1171 | + |
1172 | +-import six |
1173 | +- |
1174 | + from grit import constants |
1175 | + from grit import clique |
1176 | + from grit import exception |
1177 | +@@ -67,7 +63,7 @@ class Node(object): |
1178 | + |
1179 | + def __exit__(self, exc_type, exc_value, traceback): |
1180 | + if exc_type is not None: |
1181 | +- print(u'Error processing node %s: %s' % (six.text_type(self), exc_value)) |
1182 | ++ print(u'Error processing node %s: %s' % (str(self), exc_value)) |
1183 | + |
1184 | + def __iter__(self): |
1185 | + '''A preorder iteration through the tree that this node is the root of.''' |
1186 | +@@ -120,7 +116,7 @@ class Node(object): |
1187 | + name: u'elementname' |
1188 | + parent: grit.node.base.Node or subclass or None |
1189 | + ''' |
1190 | +- assert isinstance(name, six.string_types) |
1191 | ++ assert isinstance(name, str) |
1192 | + assert not parent or isinstance(parent, Node) |
1193 | + self.name = name |
1194 | + self.parent = parent |
1195 | +@@ -163,7 +159,7 @@ class Node(object): |
1196 | + Return: |
1197 | + None |
1198 | + ''' |
1199 | +- assert isinstance(content, six.string_types) |
1200 | ++ assert isinstance(content, str) |
1201 | + if self._ContentType() != self._CONTENT_TYPE_NONE: |
1202 | + self.mixed_content.append(content) |
1203 | + elif content.strip() != '': |
1204 | +@@ -180,8 +176,8 @@ class Node(object): |
1205 | + Return: |
1206 | + None |
1207 | + ''' |
1208 | +- assert isinstance(attrib, six.string_types) |
1209 | +- assert isinstance(value, six.string_types) |
1210 | ++ assert isinstance(attrib, str) |
1211 | ++ assert isinstance(value, str) |
1212 | + if self._IsValidAttribute(attrib, value): |
1213 | + self.attrs[attrib] = value |
1214 | + else: |
1215 | +@@ -192,34 +188,32 @@ class Node(object): |
1216 | + |
1217 | + # TODO(joi) Rewrite this, it's extremely ugly! |
1218 | + if len(self.mixed_content): |
1219 | +- if isinstance(self.mixed_content[0], six.string_types): |
1220 | ++ if isinstance(self.mixed_content[0], str): |
1221 | + # Remove leading and trailing chunks of pure whitespace. |
1222 | +- while (len(self.mixed_content) and |
1223 | +- isinstance(self.mixed_content[0], six.string_types) and |
1224 | +- self.mixed_content[0].strip() == ''): |
1225 | ++ while (len(self.mixed_content) |
1226 | ++ and isinstance(self.mixed_content[0], str) |
1227 | ++ and self.mixed_content[0].strip() == ''): |
1228 | + self.mixed_content = self.mixed_content[1:] |
1229 | + # Strip leading and trailing whitespace from mixed content chunks |
1230 | + # at front and back. |
1231 | +- if (len(self.mixed_content) and |
1232 | +- isinstance(self.mixed_content[0], six.string_types)): |
1233 | ++ if (len(self.mixed_content) and isinstance(self.mixed_content[0], str)): |
1234 | + self.mixed_content[0] = self.mixed_content[0].lstrip() |
1235 | + # Remove leading and trailing ''' (used to demarcate whitespace) |
1236 | +- if (len(self.mixed_content) and |
1237 | +- isinstance(self.mixed_content[0], six.string_types)): |
1238 | ++ if (len(self.mixed_content) and isinstance(self.mixed_content[0], str)): |
1239 | + if self.mixed_content[0].startswith("'''"): |
1240 | + self.mixed_content[0] = self.mixed_content[0][3:] |
1241 | + if len(self.mixed_content): |
1242 | +- if isinstance(self.mixed_content[-1], six.string_types): |
1243 | ++ if isinstance(self.mixed_content[-1], str): |
1244 | + # Same stuff all over again for the tail end. |
1245 | +- while (len(self.mixed_content) and |
1246 | +- isinstance(self.mixed_content[-1], six.string_types) and |
1247 | +- self.mixed_content[-1].strip() == ''): |
1248 | ++ while (len(self.mixed_content) |
1249 | ++ and isinstance(self.mixed_content[-1], str) |
1250 | ++ and self.mixed_content[-1].strip() == ''): |
1251 | + self.mixed_content = self.mixed_content[:-1] |
1252 | +- if (len(self.mixed_content) and |
1253 | +- isinstance(self.mixed_content[-1], six.string_types)): |
1254 | ++ if (len(self.mixed_content) |
1255 | ++ and isinstance(self.mixed_content[-1], str)): |
1256 | + self.mixed_content[-1] = self.mixed_content[-1].rstrip() |
1257 | +- if (len(self.mixed_content) and |
1258 | +- isinstance(self.mixed_content[-1], six.string_types)): |
1259 | ++ if (len(self.mixed_content) |
1260 | ++ and isinstance(self.mixed_content[-1], str)): |
1261 | + if self.mixed_content[-1].endswith("'''"): |
1262 | + self.mixed_content[-1] = self.mixed_content[-1][:-3] |
1263 | + |
1264 | +@@ -259,8 +253,7 @@ class Node(object): |
1265 | + def GetCdata(self): |
1266 | + '''Returns all CDATA of this element, concatenated into a single |
1267 | + string. Note that this ignores any elements embedded in CDATA.''' |
1268 | +- return ''.join([c for c in self.mixed_content |
1269 | +- if isinstance(c, six.string_types)]) |
1270 | ++ return ''.join([c for c in self.mixed_content if isinstance(c, str)]) |
1271 | + |
1272 | + def __str__(self): |
1273 | + '''Returns this node and all nodes below it as an XML document in a Unicode |
1274 | +@@ -278,7 +271,7 @@ class Node(object): |
1275 | + children and CDATA are layed out in a way that preserves internal |
1276 | + whitespace. |
1277 | + ''' |
1278 | +- assert isinstance(indent, six.string_types) |
1279 | ++ assert isinstance(indent, str) |
1280 | + |
1281 | + content_one_line = (one_line or |
1282 | + self._ContentType() == self._CONTENT_TYPE_MIXED) |
1283 | +@@ -313,7 +306,7 @@ class Node(object): |
1284 | + def ContentsAsXml(self, indent, one_line): |
1285 | + '''Returns the contents of this node (CDATA and child elements) in XML |
1286 | + format. If 'one_line' is true, the content will be laid out on one line.''' |
1287 | +- assert isinstance(indent, six.string_types) |
1288 | ++ assert isinstance(indent, str) |
1289 | + |
1290 | + # Build the contents of the element. |
1291 | + inside_parts = [] |
1292 | +@@ -339,8 +332,7 @@ class Node(object): |
1293 | + |
1294 | + # If the last item is a string (not a node) and ends with whitespace, |
1295 | + # we need to add the ''' delimiter. |
1296 | +- if (isinstance(last_item, six.string_types) and |
1297 | +- last_item.rstrip() != last_item): |
1298 | ++ if (isinstance(last_item, str) and last_item.rstrip() != last_item): |
1299 | + inside_parts[-1] = inside_parts[-1] + u"'''" |
1300 | + |
1301 | + return u''.join(inside_parts) |
1302 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/node/base_unittest.py |
1303 | +=================================================================== |
1304 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/node/base_unittest.py |
1305 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/node/base_unittest.py |
1306 | +@@ -5,16 +5,13 @@ |
1307 | + |
1308 | + '''Unit tests for base.Node functionality (as used in various subclasses)''' |
1309 | + |
1310 | +-from __future__ import print_function |
1311 | +- |
1312 | ++import io |
1313 | + import os |
1314 | + import sys |
1315 | +-if __name__ == '__main__': |
1316 | +- sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
1317 | +- |
1318 | + import unittest |
1319 | + |
1320 | +-from six import StringIO |
1321 | ++if __name__ == '__main__': |
1322 | ++ sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
1323 | + |
1324 | + from grit import grd_reader |
1325 | + from grit import util |
1326 | +@@ -186,7 +183,7 @@ class NodeUnittest(unittest.TestCase): |
1327 | + </messages> |
1328 | + </release> |
1329 | + </grit>''' |
1330 | +- grd = grd_reader.Parse(StringIO(xml), |
1331 | ++ grd = grd_reader.Parse(io.StringIO(xml), |
1332 | + util.PathFromRoot('grit/test/data')) |
1333 | + from grit.node import node_io |
1334 | + output_nodes = grd.GetChildrenOfType(node_io.OutputNode) |
1335 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/node/message.py |
1336 | +=================================================================== |
1337 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/node/message.py |
1338 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/node/message.py |
1339 | +@@ -5,12 +5,8 @@ |
1340 | + '''Handling of the <message> element. |
1341 | + ''' |
1342 | + |
1343 | +-from __future__ import print_function |
1344 | +- |
1345 | + import re |
1346 | + |
1347 | +-import six |
1348 | +- |
1349 | + from grit.node import base |
1350 | + |
1351 | + from grit import clique |
1352 | +@@ -170,7 +166,7 @@ class MessageNode(base.ContentNode): |
1353 | + placeholders = [] |
1354 | + |
1355 | + for item in self.mixed_content: |
1356 | +- if isinstance(item, six.string_types): |
1357 | ++ if isinstance(item, str): |
1358 | + # Not a <ph> element: fail if any <ph> formatters are detected. |
1359 | + if _FORMATTERS.search(item): |
1360 | + print(_BAD_PLACEHOLDER_MSG % (item, self.source)) |
1361 | +@@ -309,7 +305,7 @@ class MessageNode(base.ContentNode): |
1362 | + |
1363 | + items = message.GetContent() |
1364 | + for ix, item in enumerate(items): |
1365 | +- if isinstance(item, six.string_types): |
1366 | ++ if isinstance(item, str): |
1367 | + # Ensure whitespace at front and back of message is correctly handled. |
1368 | + if ix == 0: |
1369 | + item = "'''" + item |
1370 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/node/misc.py |
1371 | +=================================================================== |
1372 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/node/misc.py |
1373 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/node/misc.py |
1374 | +@@ -5,14 +5,10 @@ |
1375 | + """Miscellaneous node types. |
1376 | + """ |
1377 | + |
1378 | +-from __future__ import print_function |
1379 | +- |
1380 | + import os.path |
1381 | + import re |
1382 | + import sys |
1383 | + |
1384 | +-import six |
1385 | +- |
1386 | + from grit import constants |
1387 | + from grit import exception |
1388 | + from grit import util |
1389 | +@@ -600,7 +596,7 @@ class GritNode(base.Node): |
1390 | + assert self._id_map is None, 'AssignFirstIds() after InitializeIds()' |
1391 | + # If the input is a stream, then we're probably in a unit test and |
1392 | + # should skip this step. |
1393 | +- if not isinstance(filename_or_stream, six.string_types): |
1394 | ++ if not isinstance(filename_or_stream, str): |
1395 | + return |
1396 | + |
1397 | + # Nothing to do if the first_ids_filename attribute isn't set. |
1398 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/node/misc_unittest.py |
1399 | +=================================================================== |
1400 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/node/misc_unittest.py |
1401 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/node/misc_unittest.py |
1402 | +@@ -5,9 +5,8 @@ |
1403 | + |
1404 | + '''Unit tests for misc.GritNode''' |
1405 | + |
1406 | +-from __future__ import print_function |
1407 | +- |
1408 | + import contextlib |
1409 | ++import io |
1410 | + import os |
1411 | + import sys |
1412 | + import tempfile |
1413 | +@@ -16,7 +15,6 @@ import unittest |
1414 | + if __name__ == '__main__': |
1415 | + sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
1416 | + |
1417 | +-from six import StringIO |
1418 | + |
1419 | + from grit import grd_reader |
1420 | + import grit.exception |
1421 | +@@ -104,8 +102,7 @@ class GritNodeUnittest(unittest.TestCase |
1422 | + </release> |
1423 | + </grit>''' % chrome_html_path |
1424 | + |
1425 | +- grd = grd_reader.Parse(StringIO(xml), |
1426 | +- util.PathFromRoot('grit/testdata')) |
1427 | ++ grd = grd_reader.Parse(io.StringIO(xml), util.PathFromRoot('grit/testdata')) |
1428 | + expected = ['chrome_html.html', 'default_100_percent/a.png', |
1429 | + 'default_100_percent/b.png', 'included_sample.html', |
1430 | + 'special_100_percent/a.png'] |
1431 | +@@ -133,7 +130,7 @@ class GritNodeUnittest(unittest.TestCase |
1432 | + </release> |
1433 | + </grit>''' % chrome_html_path |
1434 | + |
1435 | +- grd = grd_reader.Parse(StringIO(xml), util.PathFromRoot('grit/testdata')) |
1436 | ++ grd = grd_reader.Parse(io.StringIO(xml), util.PathFromRoot('grit/testdata')) |
1437 | + expected = ['chrome_html.html', 'included_sample.html'] |
1438 | + actual = [os.path.relpath(path, util.PathFromRoot('grit/testdata')) for |
1439 | + path in grd.GetInputFiles()] |
1440 | +@@ -223,7 +220,7 @@ class GritNodeUnittest(unittest.TestCase |
1441 | + |
1442 | + class IfNodeUnittest(unittest.TestCase): |
1443 | + def testIffyness(self): |
1444 | +- grd = grd_reader.Parse(StringIO(''' |
1445 | ++ grd = grd_reader.Parse(io.StringIO(''' |
1446 | + <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir="."> |
1447 | + <release seq="3"> |
1448 | + <messages> |
1449 | +@@ -247,7 +244,8 @@ class IfNodeUnittest(unittest.TestCase): |
1450 | + </if> |
1451 | + </messages> |
1452 | + </release> |
1453 | +- </grit>'''), dir='.') |
1454 | ++ </grit>'''), |
1455 | ++ dir='.') |
1456 | + |
1457 | + messages_node = grd.children[0].children[0] |
1458 | + bingo_message = messages_node.children[0].children[0] |
1459 | +@@ -331,7 +329,7 @@ class IfNodeUnittest(unittest.TestCase): |
1460 | + self.assertEqual(['IDS_YES1', 'IDS_YES2', 'IDS_YES3', 'IDS_YES4'], included) |
1461 | + |
1462 | + def testIffynessWithOutputNodes(self): |
1463 | +- grd = grd_reader.Parse(StringIO(''' |
1464 | ++ grd = grd_reader.Parse(io.StringIO(''' |
1465 | + <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir="."> |
1466 | + <outputs> |
1467 | + <output filename="uncond1.rc" type="rc_data" /> |
1468 | +@@ -347,7 +345,8 @@ class IfNodeUnittest(unittest.TestCase): |
1469 | + <emit emit_type='prepend'></emit> |
1470 | + </output> |
1471 | + </outputs> |
1472 | +- </grit>'''), dir='.') |
1473 | ++ </grit>'''), |
1474 | ++ dir='.') |
1475 | + |
1476 | + outputs_node = grd.children[0] |
1477 | + uncond1_output = outputs_node.children[0] |
1478 | +@@ -395,7 +394,7 @@ class IfNodeUnittest(unittest.TestCase): |
1479 | + self.assertNotEquals(outputs, ['uncond1.rc', 'uncond2.adm', 'iftest.h']) |
1480 | + |
1481 | + def testChildrenAccepted(self): |
1482 | +- grd_reader.Parse(StringIO(r'''<?xml version="1.0"?> |
1483 | ++ grd_reader.Parse(io.StringIO(r'''<?xml version="1.0"?> |
1484 | + <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir="."> |
1485 | + <release seq="3"> |
1486 | + <includes> |
1487 | +@@ -439,11 +438,12 @@ class IfNodeUnittest(unittest.TestCase): |
1488 | + </if> |
1489 | + </if> |
1490 | + </translations> |
1491 | +- </grit>'''), dir='.') |
1492 | ++ </grit>'''), |
1493 | ++ dir='.') |
1494 | + |
1495 | + def testIfBadChildrenNesting(self): |
1496 | + # includes |
1497 | +- xml = StringIO(r'''<?xml version="1.0"?> |
1498 | ++ xml = io.StringIO(r'''<?xml version="1.0"?> |
1499 | + <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir="."> |
1500 | + <release seq="3"> |
1501 | + <includes> |
1502 | +@@ -455,7 +455,7 @@ class IfNodeUnittest(unittest.TestCase): |
1503 | + </grit>''') |
1504 | + self.assertRaises(grit.exception.UnexpectedChild, grd_reader.Parse, xml) |
1505 | + # messages |
1506 | +- xml = StringIO(r'''<?xml version="1.0"?> |
1507 | ++ xml = io.StringIO(r'''<?xml version="1.0"?> |
1508 | + <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir="."> |
1509 | + <release seq="3"> |
1510 | + <messages> |
1511 | +@@ -467,7 +467,7 @@ class IfNodeUnittest(unittest.TestCase): |
1512 | + </grit>''') |
1513 | + self.assertRaises(grit.exception.UnexpectedChild, grd_reader.Parse, xml) |
1514 | + # structures |
1515 | +- xml = StringIO('''<?xml version="1.0"?> |
1516 | ++ xml = io.StringIO('''<?xml version="1.0"?> |
1517 | + <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir="."> |
1518 | + <release seq="3"> |
1519 | + <structures> |
1520 | +@@ -479,7 +479,7 @@ class IfNodeUnittest(unittest.TestCase): |
1521 | + </grit>''') |
1522 | + # translations |
1523 | + self.assertRaises(grit.exception.UnexpectedChild, grd_reader.Parse, xml) |
1524 | +- xml = StringIO('''<?xml version="1.0"?> |
1525 | ++ xml = io.StringIO('''<?xml version="1.0"?> |
1526 | + <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir="."> |
1527 | + <translations> |
1528 | + <if expr="'bingo' in defs"> |
1529 | +@@ -489,7 +489,7 @@ class IfNodeUnittest(unittest.TestCase): |
1530 | + </grit>''') |
1531 | + self.assertRaises(grit.exception.UnexpectedChild, grd_reader.Parse, xml) |
1532 | + # same with nesting |
1533 | +- xml = StringIO(r'''<?xml version="1.0"?> |
1534 | ++ xml = io.StringIO(r'''<?xml version="1.0"?> |
1535 | + <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir="."> |
1536 | + <release seq="3"> |
1537 | + <includes> |
1538 | +@@ -502,7 +502,7 @@ class IfNodeUnittest(unittest.TestCase): |
1539 | + </release> |
1540 | + </grit>''') |
1541 | + self.assertRaises(grit.exception.UnexpectedChild, grd_reader.Parse, xml) |
1542 | +- xml = StringIO(r'''<?xml version="1.0"?> |
1543 | ++ xml = io.StringIO(r'''<?xml version="1.0"?> |
1544 | + <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir="."> |
1545 | + <release seq="3"> |
1546 | + <messages> |
1547 | +@@ -515,7 +515,7 @@ class IfNodeUnittest(unittest.TestCase): |
1548 | + </release> |
1549 | + </grit>''') |
1550 | + self.assertRaises(grit.exception.UnexpectedChild, grd_reader.Parse, xml) |
1551 | +- xml = StringIO('''<?xml version="1.0"?> |
1552 | ++ xml = io.StringIO('''<?xml version="1.0"?> |
1553 | + <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir="."> |
1554 | + <release seq="3"> |
1555 | + <structures> |
1556 | +@@ -528,7 +528,7 @@ class IfNodeUnittest(unittest.TestCase): |
1557 | + </release> |
1558 | + </grit>''') |
1559 | + self.assertRaises(grit.exception.UnexpectedChild, grd_reader.Parse, xml) |
1560 | +- xml = StringIO('''<?xml version="1.0"?> |
1561 | ++ xml = io.StringIO('''<?xml version="1.0"?> |
1562 | + <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir="."> |
1563 | + <translations> |
1564 | + <if expr="'bingo' in defs"> |
1565 | +@@ -543,7 +543,8 @@ class IfNodeUnittest(unittest.TestCase): |
1566 | + |
1567 | + class ReleaseNodeUnittest(unittest.TestCase): |
1568 | + def testPseudoControl(self): |
1569 | +- grd = grd_reader.Parse(StringIO('''<?xml version="1.0" encoding="UTF-8"?> |
1570 | ++ grd = grd_reader.Parse( |
1571 | ++ io.StringIO('''<?xml version="1.0" encoding="UTF-8"?> |
1572 | + <grit latest_public_release="1" source_lang_id="en-US" current_release="2" base_dir="."> |
1573 | + <release seq="1" allow_pseudo="false"> |
1574 | + <messages> |
1575 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/node/node_io_unittest.py |
1576 | +=================================================================== |
1577 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/node/node_io_unittest.py |
1578 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/node/node_io_unittest.py |
1579 | +@@ -5,17 +5,14 @@ |
1580 | + |
1581 | + '''Unit tests for node_io.FileNode''' |
1582 | + |
1583 | +-from __future__ import print_function |
1584 | +- |
1585 | + import os |
1586 | + import sys |
1587 | + import unittest |
1588 | ++import io |
1589 | + |
1590 | + if __name__ == '__main__': |
1591 | + sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
1592 | + |
1593 | +-from six import StringIO |
1594 | +- |
1595 | + from grit.node import misc |
1596 | + from grit.node import node_io |
1597 | + from grit.node import empty |
1598 | +@@ -69,14 +66,14 @@ class FileNodeUnittest(unittest.TestCase |
1599 | + </messages> |
1600 | + </release> |
1601 | + </grit>''' |
1602 | +- grd = grd_reader.Parse(StringIO(xml), |
1603 | +- util.PathFromRoot('grit/testdata')) |
1604 | ++ grd = grd_reader.Parse(io.StringIO(xml), util.PathFromRoot('grit/testdata')) |
1605 | + grd.SetOutputLanguage('en') |
1606 | + grd.RunGatherers() |
1607 | + self.VerifyCliquesContainEnglishAndFrenchAndNothingElse(_GetAllCliques(grd)) |
1608 | + |
1609 | + def testIffyness(self): |
1610 | +- grd = grd_reader.Parse(StringIO('''<?xml version="1.0" encoding="UTF-8"?> |
1611 | ++ grd = grd_reader.Parse( |
1612 | ++ io.StringIO('''<?xml version="1.0" encoding="UTF-8"?> |
1613 | + <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir="."> |
1614 | + <translations> |
1615 | + <if expr="lang == 'fr'"> |
1616 | +@@ -121,8 +118,7 @@ class FileNodeUnittest(unittest.TestCase |
1617 | + </messages> |
1618 | + </release> |
1619 | + </grit>''' |
1620 | +- grd = grd_reader.Parse(StringIO(xml), |
1621 | +- util.PathFromRoot('grit/testdata')) |
1622 | ++ grd = grd_reader.Parse(io.StringIO(xml), util.PathFromRoot('grit/testdata')) |
1623 | + grd.SetOutputLanguage('en') |
1624 | + grd.RunGatherers() |
1625 | + self.VerifyCliquesContainEnglishAndFrenchAndNothingElse(_GetAllCliques(grd)) |
1626 | +@@ -146,7 +142,7 @@ class FileNodeUnittest(unittest.TestCase |
1627 | + </messages> |
1628 | + </release> |
1629 | + </grit>''' |
1630 | +- grd = grd_reader.Parse(StringIO(xml), |
1631 | ++ grd = grd_reader.Parse(io.StringIO(xml), |
1632 | + util.PathFromRoot('grit/test/data'), |
1633 | + defines={}) |
1634 | + grd.SetOutputLanguage('en') |
1635 | +@@ -163,7 +159,8 @@ class FileNodeUnittest(unittest.TestCase |
1636 | + # Verify that 'iw' and 'no' language codes in xtb files are mapped to 'he' and |
1637 | + # 'nb'. |
1638 | + def testLangCodeMapping(self): |
1639 | +- grd = grd_reader.Parse(StringIO('''<?xml version="1.0" encoding="UTF-8"?> |
1640 | ++ grd = grd_reader.Parse( |
1641 | ++ io.StringIO('''<?xml version="1.0" encoding="UTF-8"?> |
1642 | + <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir="."> |
1643 | + <translations> |
1644 | + <file path="generated_resources_no.xtb" lang="nb" /> |
1645 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/pseudolocales_unittest.py |
1646 | +=================================================================== |
1647 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/pseudolocales_unittest.py |
1648 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/pseudolocales_unittest.py |
1649 | +@@ -4,16 +4,12 @@ |
1650 | + # found in the LICENSE file. |
1651 | + '''Unit tests for grit.pseudolocales''' |
1652 | + |
1653 | +-from __future__ import print_function |
1654 | +- |
1655 | + import sys |
1656 | + import os.path |
1657 | +-if __name__ == '__main__': |
1658 | +- sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
1659 | +- |
1660 | + import unittest |
1661 | + |
1662 | +-import six |
1663 | ++if __name__ == '__main__': |
1664 | ++ sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
1665 | + |
1666 | + import grit.pseudolocales as pl |
1667 | + |
1668 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/shortcuts_unittest.py |
1669 | +=================================================================== |
1670 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/shortcuts_unittest.py |
1671 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/shortcuts_unittest.py |
1672 | +@@ -6,16 +6,13 @@ |
1673 | + '''Unit tests for grit.shortcuts |
1674 | + ''' |
1675 | + |
1676 | +-from __future__ import print_function |
1677 | +- |
1678 | ++import io |
1679 | + import os |
1680 | + import sys |
1681 | +-if __name__ == '__main__': |
1682 | +- sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
1683 | +- |
1684 | + import unittest |
1685 | + |
1686 | +-from six import StringIO |
1687 | ++if __name__ == '__main__': |
1688 | ++ sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
1689 | + |
1690 | + from grit import shortcuts |
1691 | + from grit import clique |
1692 | +@@ -46,7 +43,8 @@ class ShortcutsUnittest(unittest.TestCas |
1693 | + self.failUnless(len(warnings) == 0) |
1694 | + |
1695 | + def testDialog(self): |
1696 | +- dlg = rc.Dialog(StringIO('''\ |
1697 | ++ dlg = rc.Dialog( |
1698 | ++ io.StringIO('''\ |
1699 | + IDD_SIDEBAR_RSS_PANEL_PROPPAGE DIALOGEX 0, 0, 239, 221 |
1700 | + STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD |
1701 | + FONT 8, "MS Shell Dlg", 400, 0, 0x1 |
1702 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/tclib_unittest.py |
1703 | +=================================================================== |
1704 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/tclib_unittest.py |
1705 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/tclib_unittest.py |
1706 | +@@ -5,16 +5,12 @@ |
1707 | + |
1708 | + '''Unit tests for grit.tclib''' |
1709 | + |
1710 | +-from __future__ import print_function |
1711 | +- |
1712 | + import sys |
1713 | + import os.path |
1714 | +-if __name__ == '__main__': |
1715 | +- sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
1716 | +- |
1717 | + import unittest |
1718 | + |
1719 | +-import six |
1720 | ++if __name__ == '__main__': |
1721 | ++ sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
1722 | + |
1723 | + from grit import tclib |
1724 | + |
1725 | +@@ -27,14 +23,14 @@ class TclibUnittest(unittest.TestCase): |
1726 | + msg = tclib.Message(text=u'Hello Earthlings', |
1727 | + description='Greetings\n\t message') |
1728 | + self.failUnlessEqual(msg.GetPresentableContent(), 'Hello Earthlings') |
1729 | +- self.failUnless(isinstance(msg.GetPresentableContent(), six.string_types)) |
1730 | ++ self.failUnless(isinstance(msg.GetPresentableContent(), str)) |
1731 | + self.failUnlessEqual(msg.GetDescription(), 'Greetings message') |
1732 | + |
1733 | + def testGetAttr(self): |
1734 | + msg = tclib.Message() |
1735 | + msg.AppendText(u'Hello') # Tests __getattr__ |
1736 | + self.failUnless(msg.GetPresentableContent() == 'Hello') |
1737 | +- self.failUnless(isinstance(msg.GetPresentableContent(), six.string_types)) |
1738 | ++ self.failUnless(isinstance(msg.GetPresentableContent(), str)) |
1739 | + |
1740 | + def testAll(self): |
1741 | + text = u'Howdie USERNAME' |
1742 | +@@ -44,7 +40,7 @@ class TclibUnittest(unittest.TestCase): |
1743 | + |
1744 | + trans = tclib.Translation(text=text, placeholders=phs) |
1745 | + self.failUnless(trans.GetPresentableContent() == 'Howdie USERNAME') |
1746 | +- self.failUnless(isinstance(trans.GetPresentableContent(), six.string_types)) |
1747 | ++ self.failUnless(isinstance(trans.GetPresentableContent(), str)) |
1748 | + |
1749 | + def testUnicodeReturn(self): |
1750 | + text = u'\u00fe' |
1751 | +@@ -66,7 +62,7 @@ class TclibUnittest(unittest.TestCase): |
1752 | + transl = tclib.Translation(text=msg.GetPresentableContent(), |
1753 | + placeholders=msg.GetPlaceholders()) |
1754 | + content = transl.GetContent() |
1755 | +- self.failUnless(isinstance(content[3], six.string_types)) |
1756 | ++ self.failUnless(isinstance(content[3], str)) |
1757 | + |
1758 | + def testFingerprint(self): |
1759 | + # This has Windows line endings. That is on purpose. |
1760 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/tool/buildinfo_unittest.py |
1761 | +=================================================================== |
1762 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/tool/buildinfo_unittest.py |
1763 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/tool/buildinfo_unittest.py |
1764 | +@@ -6,8 +6,7 @@ |
1765 | + """Unit tests for the 'grit buildinfo' tool. |
1766 | + """ |
1767 | + |
1768 | +-from __future__ import print_function |
1769 | +- |
1770 | ++import io |
1771 | + import os |
1772 | + import sys |
1773 | + import unittest |
1774 | +@@ -16,8 +15,6 @@ import unittest |
1775 | + if __name__ == '__main__': |
1776 | + sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) |
1777 | + |
1778 | +-from six import StringIO |
1779 | +- |
1780 | + # pylint: disable-msg=C6204 |
1781 | + from grit.tool import buildinfo |
1782 | + |
1783 | +@@ -28,7 +25,7 @@ class BuildInfoUnittest(unittest.TestCas |
1784 | + # Change CWD to make tests work independently of callers CWD. |
1785 | + os.chdir(os.path.dirname(__file__)) |
1786 | + os.chdir('..') |
1787 | +- self.buf = StringIO() |
1788 | ++ self.buf = io.StringIO() |
1789 | + self.old_stdout = sys.stdout |
1790 | + sys.stdout = self.buf |
1791 | + |
1792 | +Index: qt6-webengine/src/3rdparty/chromium/tools/grit/grit/util.py |
1793 | +=================================================================== |
1794 | +--- qt6-webengine.orig/src/3rdparty/chromium/tools/grit/grit/util.py |
1795 | ++++ qt6-webengine/src/3rdparty/chromium/tools/grit/grit/util.py |
1796 | +@@ -5,20 +5,16 @@ |
1797 | + '''Utilities used by GRIT. |
1798 | + ''' |
1799 | + |
1800 | +-from __future__ import print_function |
1801 | +- |
1802 | + import codecs |
1803 | ++import html.entities |
1804 | + import io |
1805 | + import os |
1806 | + import re |
1807 | + import shutil |
1808 | + import sys |
1809 | + import tempfile |
1810 | +-from xml.sax import saxutils |
1811 | + |
1812 | +-import six |
1813 | +-from six import StringIO |
1814 | +-from six.moves import html_entities as entities |
1815 | ++from xml.sax import saxutils |
1816 | + |
1817 | + from grit import lazy_re |
1818 | + |
1819 | +@@ -224,7 +220,7 @@ def WrapOutputStream(stream, encoding = |
1820 | + def ChangeStdoutEncoding(encoding = 'utf-8'): |
1821 | + '''Changes STDOUT to print characters using the specified encoding.''' |
1822 | + # If we're unittesting, don't reconfigure. |
1823 | +- if isinstance(sys.stdout, StringIO): |
1824 | ++ if isinstance(sys.stdout, io.StringIO): |
1825 | + return |
1826 | + |
1827 | + if sys.version_info.major < 3: |
1828 | +@@ -270,16 +266,16 @@ def UnescapeHtml(text, replace_nbsp=True |
1829 | + def Replace(match): |
1830 | + groups = match.groupdict() |
1831 | + if groups['hex']: |
1832 | +- return six.unichr(int(groups['hex'], 16)) |
1833 | ++ return chr(int(groups['hex'], 16)) |
1834 | + elif groups['decimal']: |
1835 | +- return six.unichr(int(groups['decimal'], 10)) |
1836 | ++ return chr(int(groups['decimal'], 10)) |
1837 | + else: |
1838 | + name = groups['named'] |
1839 | + if name == 'nbsp' and not replace_nbsp: |
1840 | + return match.group() # Don't replace |
1841 | + assert name != None |
1842 | +- if name in entities.name2codepoint: |
1843 | +- return six.unichr(entities.name2codepoint[name]) |
1844 | ++ if name in html.entities.name2codepoint: |
1845 | ++ return chr(html.entities.name2codepoint[name]) |
1846 | + else: |
1847 | + return match.group() # Unknown HTML character entity - don't replace |
1848 | + |
1849 | +@@ -347,7 +343,7 @@ def ParseGrdForUnittest(body, base_dir=N |
1850 | + base_dir: The base_dir attribute of the <grit> tag. |
1851 | + ''' |
1852 | + from grit import grd_reader |
1853 | +- if isinstance(body, six.text_type): |
1854 | ++ if isinstance(body, str): |
1855 | + body = body.encode('utf-8') |
1856 | + if base_dir is None: |
1857 | + base_dir = PathFromRoot('.') |
1858 | diff --git a/debian/patches/remove_six_moves_from_protobuf.patch b/debian/patches/remove_six_moves_from_protobuf.patch |
1859 | new file mode 100644 |
1860 | index 0000000..feb7384 |
1861 | --- /dev/null |
1862 | +++ b/debian/patches/remove_six_moves_from_protobuf.patch |
1863 | @@ -0,0 +1,313 @@ |
1864 | +Index: qt6-webengine/src/3rdparty/chromium/third_party/protobuf/python/google/protobuf/internal/python_message.py |
1865 | +=================================================================== |
1866 | +--- qt6-webengine.orig/src/3rdparty/chromium/third_party/protobuf/python/google/protobuf/internal/python_message.py |
1867 | ++++ qt6-webengine/src/3rdparty/chromium/third_party/protobuf/python/google/protobuf/internal/python_message.py |
1868 | +@@ -55,9 +55,6 @@ import struct |
1869 | + import sys |
1870 | + import weakref |
1871 | + |
1872 | +-import six |
1873 | +-from six.moves import range |
1874 | +- |
1875 | + # We use "as" to avoid name collisions with variables. |
1876 | + from google.protobuf.internal import api_implementation |
1877 | + from google.protobuf.internal import containers |
1878 | +@@ -284,13 +281,6 @@ def _IsMessageMapField(field): |
1879 | + return value_type.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE |
1880 | + |
1881 | + |
1882 | +-def _IsStrictUtf8Check(field): |
1883 | +- if field.containing_type.syntax != 'proto3': |
1884 | +- return False |
1885 | +- enforce_utf8 = True |
1886 | +- return enforce_utf8 |
1887 | +- |
1888 | +- |
1889 | + def _AttachFieldHelpers(cls, field_descriptor): |
1890 | + is_repeated = (field_descriptor.label == _FieldDescriptor.LABEL_REPEATED) |
1891 | + is_packable = (is_repeated and |
1892 | +@@ -348,11 +338,10 @@ def _AttachFieldHelpers(cls, field_descr |
1893 | + field_descriptor, _GetInitializeDefaultForMap(field_descriptor), |
1894 | + is_message_map) |
1895 | + elif decode_type == _FieldDescriptor.TYPE_STRING: |
1896 | +- is_strict_utf8_check = _IsStrictUtf8Check(field_descriptor) |
1897 | + field_decoder = decoder.StringDecoder( |
1898 | + field_descriptor.number, is_repeated, is_packed, |
1899 | + field_descriptor, field_descriptor._default_constructor, |
1900 | +- is_strict_utf8_check, clear_if_default) |
1901 | ++ clear_if_default) |
1902 | + elif field_descriptor.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE: |
1903 | + field_decoder = type_checkers.TYPE_TO_DECODER[decode_type]( |
1904 | + field_descriptor.number, is_repeated, is_packed, |
1905 | +@@ -485,7 +474,7 @@ def _ReraiseTypeErrorWithFieldName(messa |
1906 | + exc = TypeError('%s for field %s.%s' % (str(exc), message_name, field_name)) |
1907 | + |
1908 | + # re-raise possibly-amended exception with original traceback: |
1909 | +- six.reraise(type(exc), exc, sys.exc_info()[2]) |
1910 | ++ raise exc.with_traceback(sys.exc_info()[2]) |
1911 | + |
1912 | + |
1913 | + def _AddInitMethod(message_descriptor, cls): |
1914 | +@@ -498,7 +487,7 @@ def _AddInitMethod(message_descriptor, c |
1915 | + enum_type with the same name. If the value is not a string, it's |
1916 | + returned as-is. (No conversion or bounds-checking is done.) |
1917 | + """ |
1918 | +- if isinstance(value, six.string_types): |
1919 | ++ if isinstance(value, str): |
1920 | + try: |
1921 | + return enum_type.values_by_name[value].number |
1922 | + except KeyError: |
1923 | +@@ -1133,12 +1122,6 @@ def _AddSerializePartialToStringMethod(m |
1924 | + def _AddMergeFromStringMethod(message_descriptor, cls): |
1925 | + """Helper for _AddMessageMethods().""" |
1926 | + def MergeFromString(self, serialized): |
1927 | +- if isinstance(serialized, memoryview) and six.PY2: |
1928 | +- raise TypeError( |
1929 | +- 'memoryview not supported in Python 2 with the pure Python proto ' |
1930 | +- 'implementation: this is to maintain compatibility with the C++ ' |
1931 | +- 'implementation') |
1932 | +- |
1933 | + serialized = memoryview(serialized) |
1934 | + length = len(serialized) |
1935 | + try: |
1936 | +@@ -1311,6 +1294,14 @@ def _AddIsInitializedMethod(message_desc |
1937 | + cls.FindInitializationErrors = FindInitializationErrors |
1938 | + |
1939 | + |
1940 | ++def _FullyQualifiedClassName(klass): |
1941 | ++ module = klass.__module__ |
1942 | ++ name = getattr(klass, '__qualname__', klass.__name__) |
1943 | ++ if module in (None, 'builtins', '__builtin__'): |
1944 | ++ return name |
1945 | ++ return module + '.' + name |
1946 | ++ |
1947 | ++ |
1948 | + def _AddMergeFromMethod(cls): |
1949 | + LABEL_REPEATED = _FieldDescriptor.LABEL_REPEATED |
1950 | + CPPTYPE_MESSAGE = _FieldDescriptor.CPPTYPE_MESSAGE |
1951 | +@@ -1319,7 +1310,8 @@ def _AddMergeFromMethod(cls): |
1952 | + if not isinstance(msg, cls): |
1953 | + raise TypeError( |
1954 | + 'Parameter to MergeFrom() must be instance of same class: ' |
1955 | +- 'expected %s got %s.' % (cls.__name__, msg.__class__.__name__)) |
1956 | ++ 'expected %s got %s.' % (_FullyQualifiedClassName(cls), |
1957 | ++ _FullyQualifiedClassName(msg.__class__))) |
1958 | + |
1959 | + assert msg is not self |
1960 | + self._Modified() |
1961 | +Index: qt6-webengine/src/3rdparty/chromium/third_party/protobuf/python/google/protobuf/text_format.py |
1962 | +=================================================================== |
1963 | +--- qt6-webengine.orig/src/3rdparty/chromium/third_party/protobuf/python/google/protobuf/text_format.py |
1964 | ++++ qt6-webengine/src/3rdparty/chromium/third_party/protobuf/python/google/protobuf/text_format.py |
1965 | +@@ -48,16 +48,12 @@ import encodings.unicode_escape # pylin |
1966 | + import io |
1967 | + import math |
1968 | + import re |
1969 | +-import six |
1970 | + |
1971 | + from google.protobuf.internal import decoder |
1972 | + from google.protobuf.internal import type_checkers |
1973 | + from google.protobuf import descriptor |
1974 | + from google.protobuf import text_encoding |
1975 | + |
1976 | +-if six.PY3: |
1977 | +- long = int # pylint: disable=redefined-builtin,invalid-name |
1978 | +- |
1979 | + # pylint: disable=g-import-not-at-top |
1980 | + __all__ = ['MessageToString', 'Parse', 'PrintMessage', 'PrintField', |
1981 | + 'PrintFieldValue', 'Merge', 'MessageToBytes'] |
1982 | +@@ -102,15 +98,9 @@ class ParseError(Error): |
1983 | + class TextWriter(object): |
1984 | + |
1985 | + def __init__(self, as_utf8): |
1986 | +- if six.PY2: |
1987 | +- self._writer = io.BytesIO() |
1988 | +- else: |
1989 | +- self._writer = io.StringIO() |
1990 | ++ self._writer = io.StringIO() |
1991 | + |
1992 | + def write(self, val): |
1993 | +- if six.PY2: |
1994 | +- if isinstance(val, six.text_type): |
1995 | +- val = val.encode('utf-8') |
1996 | + return self._writer.write(val) |
1997 | + |
1998 | + def close(self): |
1999 | +@@ -541,7 +531,7 @@ class _Printer(object): |
2000 | + # For groups, use the capitalized name. |
2001 | + out.write(field.message_type.name) |
2002 | + else: |
2003 | +- out.write(field.name) |
2004 | ++ out.write(field.name) |
2005 | + |
2006 | + if (self.force_colon or |
2007 | + field.cpp_type != descriptor.FieldDescriptor.CPPTYPE_MESSAGE): |
2008 | +@@ -562,13 +552,11 @@ class _Printer(object): |
2009 | + # Note: this is called only when value has at least one element. |
2010 | + self._PrintFieldName(field) |
2011 | + self.out.write(' [') |
2012 | +- for i in six.moves.range(len(value) - 1): |
2013 | ++ for i in range(len(value) - 1): |
2014 | + self.PrintFieldValue(field, value[i]) |
2015 | + self.out.write(', ') |
2016 | + self.PrintFieldValue(field, value[-1]) |
2017 | + self.out.write(']') |
2018 | +- if self.force_colon: |
2019 | +- self.out.write(':') |
2020 | + self.out.write(' ' if self.as_one_line else '\n') |
2021 | + |
2022 | + def _PrintMessageFieldValue(self, value): |
2023 | +@@ -610,7 +598,7 @@ class _Printer(object): |
2024 | + out.write(str(value)) |
2025 | + elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_STRING: |
2026 | + out.write('\"') |
2027 | +- if isinstance(value, six.text_type) and (six.PY2 or not self.as_utf8): |
2028 | ++ if isinstance(value, str) and not self.as_utf8: |
2029 | + out_value = value.encode('utf-8') |
2030 | + else: |
2031 | + out_value = value |
2032 | +@@ -841,12 +829,9 @@ class _Parser(object): |
2033 | + ParseError: On text parsing problems. |
2034 | + """ |
2035 | + # Tokenize expects native str lines. |
2036 | +- if six.PY2: |
2037 | +- str_lines = (line if isinstance(line, str) else line.encode('utf-8') |
2038 | +- for line in lines) |
2039 | +- else: |
2040 | +- str_lines = (line if isinstance(line, str) else line.decode('utf-8') |
2041 | +- for line in lines) |
2042 | ++ str_lines = ( |
2043 | ++ line if isinstance(line, str) else line.decode('utf-8') |
2044 | ++ for line in lines) |
2045 | + tokenizer = Tokenizer(str_lines) |
2046 | + while not tokenizer.AtEnd(): |
2047 | + self._MergeField(tokenizer, message) |
2048 | +@@ -882,8 +867,11 @@ class _Parser(object): |
2049 | + raise tokenizer.ParseErrorPreviousToken('Expected "%s".' % |
2050 | + (expanded_any_end_token,)) |
2051 | + self._MergeField(tokenizer, expanded_any_sub_message) |
2052 | ++ deterministic = False |
2053 | ++ |
2054 | + message.Pack(expanded_any_sub_message, |
2055 | +- type_url_prefix=type_url_prefix) |
2056 | ++ type_url_prefix=type_url_prefix, |
2057 | ++ deterministic=deterministic) |
2058 | + return |
2059 | + |
2060 | + if tokenizer.TryConsume('['): |
2061 | +@@ -899,6 +887,8 @@ class _Parser(object): |
2062 | + # pylint: disable=protected-access |
2063 | + field = message.Extensions._FindExtensionByName(name) |
2064 | + # pylint: enable=protected-access |
2065 | ++ |
2066 | ++ |
2067 | + if not field: |
2068 | + if self.allow_unknown_extension: |
2069 | + field = None |
2070 | +@@ -985,6 +975,7 @@ class _Parser(object): |
2071 | + if not tokenizer.TryConsume(','): |
2072 | + tokenizer.TryConsume(';') |
2073 | + |
2074 | ++ |
2075 | + def _ConsumeAnyTypeUrl(self, tokenizer): |
2076 | + """Consumes a google.protobuf.Any type URL and returns the type name.""" |
2077 | + # Consume "type.googleapis.com/". |
2078 | +@@ -1054,7 +1045,7 @@ class _Parser(object): |
2079 | + value_cpptype = field.message_type.fields_by_name['value'].cpp_type |
2080 | + if value_cpptype == descriptor.FieldDescriptor.CPPTYPE_MESSAGE: |
2081 | + value = getattr(message, field.name)[sub_message.key] |
2082 | +- value.MergeFrom(sub_message.value) |
2083 | ++ value.CopyFrom(sub_message.value) |
2084 | + else: |
2085 | + getattr(message, field.name)[sub_message.key] = sub_message.value |
2086 | + |
2087 | +@@ -1391,17 +1382,14 @@ class Tokenizer(object): |
2088 | + |
2089 | + def TryConsumeInteger(self): |
2090 | + try: |
2091 | +- # Note: is_long only affects value type, not whether an error is raised. |
2092 | + self.ConsumeInteger() |
2093 | + return True |
2094 | + except ParseError: |
2095 | + return False |
2096 | + |
2097 | +- def ConsumeInteger(self, is_long=False): |
2098 | ++ def ConsumeInteger(self): |
2099 | + """Consumes an integer number. |
2100 | + |
2101 | +- Args: |
2102 | +- is_long: True if the value should be returned as a long integer. |
2103 | + Returns: |
2104 | + The integer parsed. |
2105 | + |
2106 | +@@ -1409,7 +1397,7 @@ class Tokenizer(object): |
2107 | + ParseError: If an integer couldn't be consumed. |
2108 | + """ |
2109 | + try: |
2110 | +- result = _ParseAbstractInteger(self.token, is_long=is_long) |
2111 | ++ result = _ParseAbstractInteger(self.token) |
2112 | + except ValueError as e: |
2113 | + raise self.ParseError(str(e)) |
2114 | + self.NextToken() |
2115 | +@@ -1472,7 +1460,7 @@ class Tokenizer(object): |
2116 | + """ |
2117 | + the_bytes = self.ConsumeByteString() |
2118 | + try: |
2119 | +- return six.text_type(the_bytes, 'utf-8') |
2120 | ++ return str(the_bytes, 'utf-8') |
2121 | + except UnicodeDecodeError as e: |
2122 | + raise self._StringParseError(e) |
2123 | + |
2124 | +@@ -1646,14 +1634,6 @@ def _ConsumeUint64(tokenizer): |
2125 | + return _ConsumeInteger(tokenizer, is_signed=False, is_long=True) |
2126 | + |
2127 | + |
2128 | +-def _TryConsumeInteger(tokenizer, is_signed=False, is_long=False): |
2129 | +- try: |
2130 | +- _ConsumeInteger(tokenizer, is_signed=is_signed, is_long=is_long) |
2131 | +- return True |
2132 | +- except ParseError: |
2133 | +- return False |
2134 | +- |
2135 | +- |
2136 | + def _ConsumeInteger(tokenizer, is_signed=False, is_long=False): |
2137 | + """Consumes an integer number from tokenizer. |
2138 | + |
2139 | +@@ -1691,7 +1671,7 @@ def ParseInteger(text, is_signed=False, |
2140 | + ValueError: Thrown Iff the text is not a valid integer. |
2141 | + """ |
2142 | + # Do the actual parsing. Exception handling is propagated to caller. |
2143 | +- result = _ParseAbstractInteger(text, is_long=is_long) |
2144 | ++ result = _ParseAbstractInteger(text) |
2145 | + |
2146 | + # Check if the integer is sane. Exceptions handled by callers. |
2147 | + checker = _INTEGER_CHECKERS[2 * int(is_long) + int(is_signed)] |
2148 | +@@ -1699,12 +1679,11 @@ def ParseInteger(text, is_signed=False, |
2149 | + return result |
2150 | + |
2151 | + |
2152 | +-def _ParseAbstractInteger(text, is_long=False): |
2153 | ++def _ParseAbstractInteger(text): |
2154 | + """Parses an integer without checking size/signedness. |
2155 | + |
2156 | + Args: |
2157 | + text: The text to parse. |
2158 | +- is_long: True if the value should be returned as a long integer. |
2159 | + |
2160 | + Returns: |
2161 | + The integer value. |
2162 | +@@ -1720,13 +1699,7 @@ def _ParseAbstractInteger(text, is_long= |
2163 | + # we always use the '0o' prefix for multi-digit numbers starting with 0. |
2164 | + text = c_octal_match.group(1) + '0o' + c_octal_match.group(2) |
2165 | + try: |
2166 | +- # We force 32-bit values to int and 64-bit values to long to make |
2167 | +- # alternate implementations where the distinction is more significant |
2168 | +- # (e.g. the C++ implementation) simpler. |
2169 | +- if is_long: |
2170 | +- return long(text, 0) |
2171 | +- else: |
2172 | +- return int(text, 0) |
2173 | ++ return int(text, 0) |
2174 | + except ValueError: |
2175 | + raise ValueError('Couldn\'t parse integer: %s' % orig_text) |
2176 | + |
2177 | diff --git a/debian/patches/series b/debian/patches/series |
2178 | index cf41616..88f730a 100644 |
2179 | --- a/debian/patches/series |
2180 | +++ b/debian/patches/series |
2181 | @@ -23,3 +23,5 @@ qtwebengine-icu74.patch |
2182 | |
2183 | remove_imp_imports_mojom.patch |
2184 | remove_imp_imports_protobufs.patch |
2185 | +drop_python2_support.patch |
2186 | +remove_six_moves_from_protobuf.patch |
please include a changelog entry for this.