diff options
author | Martin Jansa <Martin.Jansa@gmail.com> | 2020-01-23 18:06:01 +0100 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2020-01-23 19:47:04 +0100 |
commit | 4c86f2ade342ad15aaad7898d6d72f5e57b1a1fe (patch) | |
tree | bcd6a7328e87df256baf291f6422a918ac16fbb3 | |
parent | e0d392f2f1a4c168283ce2fccf67bc0d5cc05f42 (diff) | |
download | meta-qt5-upstream/jansa/master-py3.tar.gz |
qtwebengine: Allow to build with python3upstream/jansa/master-py3
I have some changes for the initial build, but there
are many more needed as shown in upstream chromium:
https://bugs.chromium.org/p/chromium/issues/detail?id=942720
https://bugs.chromium.org/p/chromium/issues/list?q=label%3AProj-Python3Migration&can=2
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
3 files changed, 334 insertions, 0 deletions
diff --git a/recipes-qt/qt5/qtwebengine/0001-Allow-to-build-with-python3.patch b/recipes-qt/qt5/qtwebengine/0001-Allow-to-build-with-python3.patch new file mode 100644 index 00000000..fbdacdcf --- /dev/null +++ b/recipes-qt/qt5/qtwebengine/0001-Allow-to-build-with-python3.patch | |||
@@ -0,0 +1,102 @@ | |||
1 | From 717fbe35574a2409f1be28cdb3b1504133560b90 Mon Sep 17 00:00:00 2001 | ||
2 | From: Martin Jansa <Martin.Jansa@gmail.com> | ||
3 | Date: Thu, 23 Jan 2020 17:48:46 +0100 | ||
4 | Subject: [PATCH] Allow to build with python3 | ||
5 | |||
6 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
7 | --- | ||
8 | mkspecs/features/functions.prf | 6 +----- | ||
9 | src/buildtools/config/support.pri | 5 ----- | ||
10 | src/buildtools/configure.json | 14 -------------- | ||
11 | tools/scripts/gn_find_mocables.py | 4 ++-- | ||
12 | 4 files changed, 3 insertions(+), 26 deletions(-) | ||
13 | |||
14 | diff --git a/mkspecs/features/functions.prf b/mkspecs/features/functions.prf | ||
15 | index 512e2523..38bf76cd 100644 | ||
16 | --- a/mkspecs/features/functions.prf | ||
17 | +++ b/mkspecs/features/functions.prf | ||
18 | @@ -39,11 +39,7 @@ defineReplace(which) { | ||
19 | |||
20 | # Returns the unquoted path to the python executable. | ||
21 | defineReplace(pythonPath) { | ||
22 | - isEmpty(QMAKE_PYTHON2) { | ||
23 | - # Fallback for building QtWebEngine with Qt < 5.8 | ||
24 | - QMAKE_PYTHON2 = python | ||
25 | - } | ||
26 | - return($$QMAKE_PYTHON2) | ||
27 | + return("python3") | ||
28 | } | ||
29 | |||
30 | # Returns the python executable for use with shell / make targets. | ||
31 | diff --git a/src/buildtools/config/support.pri b/src/buildtools/config/support.pri | ||
32 | index 5bdd808d..a942d3dc 100644 | ||
33 | --- a/src/buildtools/config/support.pri | ||
34 | +++ b/src/buildtools/config/support.pri | ||
35 | @@ -61,11 +61,6 @@ defineReplace(qtwebengine_checkError) { | ||
36 | return(false) | ||
37 | } | ||
38 | |||
39 | - !qtConfig(webengine-python2) { | ||
40 | - qtwebengine_skipBuild("Python version 2 (2.7.5 or later) is required to build QtWebEngine.") | ||
41 | - return(false) | ||
42 | - } | ||
43 | - | ||
44 | linux:!qtwebengine_checkErrorForLinux():return(false) | ||
45 | win:!qtwebengine_checkErrorForWindows():return(false) | ||
46 | |||
47 | diff --git a/src/buildtools/configure.json b/src/buildtools/configure.json | ||
48 | index a36d0532..24387fe7 100644 | ||
49 | --- a/src/buildtools/configure.json | ||
50 | +++ b/src/buildtools/configure.json | ||
51 | @@ -318,11 +318,6 @@ | ||
52 | "label": "system ninja", | ||
53 | "type": "detectNinja" | ||
54 | }, | ||
55 | - "webengine-python2": { | ||
56 | - "label": "python2", | ||
57 | - "type": "detectPython2", | ||
58 | - "log": "location" | ||
59 | - }, | ||
60 | "webengine-winversion": { | ||
61 | "label": "winversion", | ||
62 | "type": "compile", | ||
63 | @@ -374,7 +369,6 @@ | ||
64 | "webengine-core-support": { | ||
65 | "label": "Support Qt WebEngine Core", | ||
66 | "condition": "module.gui | ||
67 | - && features.webengine-python2 | ||
68 | && features.webengine-gperf | ||
69 | && features.webengine-bison | ||
70 | && features.webengine-flex | ||
71 | @@ -404,14 +398,6 @@ | ||
72 | "autoDetect": "features.private_tests", | ||
73 | "output": [ "privateFeature" ] | ||
74 | }, | ||
75 | - "webengine-python2": { | ||
76 | - "label": "python2", | ||
77 | - "condition": "tests.webengine-python2", | ||
78 | - "output": [ | ||
79 | - "privateFeature", | ||
80 | - { "type": "varAssign", "name": "QMAKE_PYTHON2", "value": "tests.webengine-python2.location" } | ||
81 | - ] | ||
82 | - }, | ||
83 | "webengine-gperf": { | ||
84 | "label": "gperf", | ||
85 | "condition": "tests.webengine-gperf", | ||
86 | diff --git a/tools/scripts/gn_find_mocables.py b/tools/scripts/gn_find_mocables.py | ||
87 | index d1f68245..4dc2576e 100644 | ||
88 | --- a/tools/scripts/gn_find_mocables.py | ||
89 | +++ b/tools/scripts/gn_find_mocables.py | ||
90 | @@ -58,10 +58,10 @@ for f in filter(os.path.isfile, files): | ||
91 | includedMocs.add(im.group(1)) | ||
92 | |||
93 | for mocable in includedMocs: | ||
94 | - print "Found included moc: " + mocable | ||
95 | + print("Found included moc: " + mocable) | ||
96 | |||
97 | assert len(includedMocs) == 0 , "Included mocs are not supported !" | ||
98 | |||
99 | for mocable in mocables: | ||
100 | - print mocable | ||
101 | + print(mocable) | ||
102 | sys.exit(0) | ||
diff --git a/recipes-qt/qt5/qtwebengine/chromium/0001-chromium-Allow-to-build-with-python3.patch b/recipes-qt/qt5/qtwebengine/chromium/0001-chromium-Allow-to-build-with-python3.patch new file mode 100644 index 00000000..bd5b471c --- /dev/null +++ b/recipes-qt/qt5/qtwebengine/chromium/0001-chromium-Allow-to-build-with-python3.patch | |||
@@ -0,0 +1,229 @@ | |||
1 | From db207d9e3a0c0354f91ab753246916623312c06b Mon Sep 17 00:00:00 2001 | ||
2 | From: Martin Jansa <Martin.Jansa@gmail.com> | ||
3 | Date: Thu, 23 Jan 2020 18:04:09 +0100 | ||
4 | Subject: [PATCH] chromium: Allow to build with python3 | ||
5 | |||
6 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
7 | --- | ||
8 | chromium/build/config/linux/pkg-config.py | 2 +- | ||
9 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
10 | |||
11 | diff --git a/chromium/build/config/linux/pkg-config.py b/chromium/build/config/linux/pkg-config.py | ||
12 | index 930810b008a..ea9bf155409 100755 | ||
13 | --- a/chromium/build/config/linux/pkg-config.py | ||
14 | +++ b/chromium/build/config/linux/pkg-config.py | ||
15 | @@ -195,7 +195,7 @@ def main(): | ||
16 | sys.stderr.write('Running: %s\n' % ' '.join(cmd)) | ||
17 | |||
18 | try: | ||
19 | - flag_string = subprocess.check_output(cmd) | ||
20 | + flag_string = subprocess.check_output(cmd).decode('utf8') | ||
21 | except: | ||
22 | sys.stderr.write('Could not run pkg-config.\n') | ||
23 | return 1 | ||
24 | diff --git a/chromium/build/config/posix/sysroot_ld_path.py b/chromium/build/config/posix/sysroot_ld_path.py | ||
25 | index 5fe5623711c..39d019482fe 100644 | ||
26 | --- a/chromium/build/config/posix/sysroot_ld_path.py | ||
27 | +++ b/chromium/build/config/posix/sysroot_ld_path.py | ||
28 | @@ -17,7 +17,7 @@ if len(sys.argv) != 3: | ||
29 | print("Need two arguments") | ||
30 | sys.exit(1) | ||
31 | |||
32 | -result = subprocess.check_output([sys.argv[1], sys.argv[2]]).strip() | ||
33 | +result = subprocess.check_output([sys.argv[1], sys.argv[2]]).strip().decode('utf8') | ||
34 | result = result.replace(" ", "\n") | ||
35 | if result != "": | ||
36 | print(result) | ||
37 | diff --git a/chromium/mojo/public/tools/bindings/mojom_bindings_generator.py b/chromium/mojo/public/tools/bindings/mojom_bindings_generator.py | ||
38 | index f28fb90a1d6..c5a959b2936 100755 | ||
39 | --- a/chromium/mojo/public/tools/bindings/mojom_bindings_generator.py | ||
40 | +++ b/chromium/mojo/public/tools/bindings/mojom_bindings_generator.py | ||
41 | @@ -139,7 +139,7 @@ def ScrambleMethodOrdinals(interfaces, salt): | ||
42 | |||
43 | |||
44 | def ReadFileContents(filename): | ||
45 | - with open(filename, 'rb') as f: | ||
46 | + with open(filename, 'r') as f: | ||
47 | return f.read() | ||
48 | |||
49 | |||
50 | diff --git a/chromium/third_party/blink/renderer/bindings/scripts/utilities.py b/chromium/third_party/blink/renderer/bindings/scripts/utilities.py | ||
51 | index ff1bab337ea..4df72b72a92 100644 | ||
52 | --- a/chromium/third_party/blink/renderer/bindings/scripts/utilities.py | ||
53 | +++ b/chromium/third_party/blink/renderer/bindings/scripts/utilities.py | ||
54 | @@ -8,7 +8,10 @@ Design doc: http://www.chromium.org/developers/design-documents/idl-build | ||
55 | """ | ||
56 | |||
57 | import os | ||
58 | -import cPickle as pickle | ||
59 | +try: | ||
60 | + import cPickle as pickle | ||
61 | +except ImportError: | ||
62 | + import pickle | ||
63 | import re | ||
64 | import shlex | ||
65 | import string | ||
66 | diff --git a/chromium/third_party/blink/renderer/build/scripts/json5_generator.py b/chromium/third_party/blink/renderer/build/scripts/json5_generator.py | ||
67 | index 8bd0c7ab8f9..014b08e330c 100644 | ||
68 | --- a/chromium/third_party/blink/renderer/build/scripts/json5_generator.py | ||
69 | +++ b/chromium/third_party/blink/renderer/build/scripts/json5_generator.py | ||
70 | @@ -103,7 +103,7 @@ def _is_valid(valid_values, value, valid_keys=None): | ||
71 | assert valid_keys, "'valid_keys' must be declared when using a dict value" | ||
72 | return all([(key in valid_keys or key == "default") | ||
73 | and (val in valid_values or val == "") | ||
74 | - for key, val in value.iteritems()]) | ||
75 | + for key, val in value.items()]) | ||
76 | else: | ||
77 | return value in valid_values | ||
78 | |||
79 | diff --git a/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py b/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py | ||
80 | index b5fb70f72e2..e74aa7ef4a4 100755 | ||
81 | --- a/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py | ||
82 | +++ b/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py | ||
83 | @@ -28,7 +28,10 @@ | ||
84 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
85 | |||
86 | import copy | ||
87 | -import cPickle as pickle | ||
88 | +try: | ||
89 | + import cPickle as pickle | ||
90 | +except ImportError: | ||
91 | + import pickle | ||
92 | import os | ||
93 | import sys | ||
94 | |||
95 | diff --git a/chromium/third_party/blink/renderer/build/scripts/template_expander.py b/chromium/third_party/blink/renderer/build/scripts/template_expander.py | ||
96 | index 2cf3ad6a098..722d3dfe96e 100644 | ||
97 | --- a/chromium/third_party/blink/renderer/build/scripts/template_expander.py | ||
98 | +++ b/chromium/third_party/blink/renderer/build/scripts/template_expander.py | ||
99 | @@ -64,6 +64,6 @@ def use_jinja(template_path, filters=None, tests=None, template_cache=None): | ||
100 | parameters = generator(*args, **kwargs) | ||
101 | return apply_template(template_path, parameters, filters=filters, | ||
102 | tests=tests, template_cache=template_cache) | ||
103 | - generator_internal.func_name = generator.func_name | ||
104 | + generator_internal.__name__ = generator.__name__ | ||
105 | return generator_internal | ||
106 | return real_decorator | ||
107 | diff --git a/chromium/third_party/blink/tools/blinkpy/common/message_pool.py b/chromium/third_party/blink/tools/blinkpy/common/message_pool.py | ||
108 | index 15ba177b7f9..ff709af50f7 100644 | ||
109 | --- a/chromium/third_party/blink/tools/blinkpy/common/message_pool.py | ||
110 | +++ b/chromium/third_party/blink/tools/blinkpy/common/message_pool.py | ||
111 | @@ -40,7 +40,10 @@ If you don't need these features, use multiprocessing.Pool or concurrency.future | ||
112 | instead. | ||
113 | """ | ||
114 | |||
115 | -import cPickle | ||
116 | +try: | ||
117 | + import cPickle as pickle | ||
118 | +except ImportError: | ||
119 | + import pickle | ||
120 | import logging | ||
121 | import multiprocessing | ||
122 | import Queue | ||
123 | @@ -160,7 +163,7 @@ class _MessagePool(object): | ||
124 | |||
125 | def _can_pickle(self, host): | ||
126 | try: | ||
127 | - cPickle.dumps(host) | ||
128 | + pickle.dumps(host) | ||
129 | return True | ||
130 | except TypeError: | ||
131 | return False | ||
132 | diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/models/test_failures.py b/chromium/third_party/blink/tools/blinkpy/web_tests/models/test_failures.py | ||
133 | index ade2f8ec5d2..bd3b4c84a26 100644 | ||
134 | --- a/chromium/third_party/blink/tools/blinkpy/web_tests/models/test_failures.py | ||
135 | +++ b/chromium/third_party/blink/tools/blinkpy/web_tests/models/test_failures.py | ||
136 | @@ -26,7 +26,10 @@ | ||
137 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
138 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
139 | |||
140 | -import cPickle | ||
141 | +try: | ||
142 | + import cPickle as pickle | ||
143 | +except ImportError: | ||
144 | + import pickle | ||
145 | |||
146 | from blinkpy.web_tests.models import test_expectations | ||
147 | |||
148 | @@ -102,7 +105,7 @@ class TestFailure(object): | ||
149 | @staticmethod | ||
150 | def loads(s): | ||
151 | """Creates a TestFailure object from the specified string.""" | ||
152 | - return cPickle.loads(s) | ||
153 | + return pickle.loads(s) | ||
154 | |||
155 | def message(self): | ||
156 | """Returns a string describing the failure in more detail.""" | ||
157 | @@ -119,7 +122,7 @@ class TestFailure(object): | ||
158 | |||
159 | def dumps(self): | ||
160 | """Returns the string/JSON representation of a TestFailure.""" | ||
161 | - return cPickle.dumps(self) | ||
162 | + return pickle.dumps(self) | ||
163 | |||
164 | def driver_needs_restart(self): | ||
165 | """Returns True if we should kill the driver before the next test.""" | ||
166 | diff --git a/chromium/third_party/blink/tools/blinkpy/web_tests/models/test_results.py b/chromium/third_party/blink/tools/blinkpy/web_tests/models/test_results.py | ||
167 | index 8c83576888e..ad6cfc86ac3 100644 | ||
168 | --- a/chromium/third_party/blink/tools/blinkpy/web_tests/models/test_results.py | ||
169 | +++ b/chromium/third_party/blink/tools/blinkpy/web_tests/models/test_results.py | ||
170 | @@ -26,7 +26,10 @@ | ||
171 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
172 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
173 | |||
174 | -import cPickle | ||
175 | +try: | ||
176 | + import cPickle as pickle | ||
177 | +except ImportError: | ||
178 | + import pickle | ||
179 | |||
180 | from blinkpy.web_tests.models import test_failures | ||
181 | |||
182 | @@ -36,7 +39,7 @@ class TestResult(object): | ||
183 | |||
184 | @staticmethod | ||
185 | def loads(string): | ||
186 | - return cPickle.loads(string) | ||
187 | + return pickle.loads(string) | ||
188 | |||
189 | def __init__(self, test_name, failures=None, test_run_time=None, has_stderr=False, reftest_type=None, | ||
190 | pid=None, references=None, device_failed=False, has_repaint_overlay=False, crash_site=None): | ||
191 | @@ -69,4 +72,4 @@ class TestResult(object): | ||
192 | return not (self == other) | ||
193 | |||
194 | def dumps(self): | ||
195 | - return cPickle.dumps(self) | ||
196 | + return pickle.dumps(self) | ||
197 | diff --git a/chromium/third_party/jinja2/_compat.py b/chromium/third_party/jinja2/_compat.py | ||
198 | index 61d85301a4a..4e8aebf380f 100644 | ||
199 | --- a/chromium/third_party/jinja2/_compat.py | ||
200 | +++ b/chromium/third_party/jinja2/_compat.py | ||
201 | @@ -57,7 +57,10 @@ else: | ||
202 | itervalues = lambda d: d.itervalues() | ||
203 | iteritems = lambda d: d.iteritems() | ||
204 | |||
205 | - import cPickle as pickle | ||
206 | + try: | ||
207 | + import cPickle as pickle | ||
208 | + except ImportError: | ||
209 | + import pickle | ||
210 | from cStringIO import StringIO as BytesIO, StringIO | ||
211 | NativeStringIO = BytesIO | ||
212 | |||
213 | diff --git a/chromium/third_party/yasm/source/patched-yasm/tools/python-yasm/pyxelator/ir.py b/chromium/third_party/yasm/source/patched-yasm/tools/python-yasm/pyxelator/ir.py | ||
214 | index cfa9c02ead1..df088214b48 100755 | ||
215 | --- a/chromium/third_party/yasm/source/patched-yasm/tools/python-yasm/pyxelator/ir.py | ||
216 | +++ b/chromium/third_party/yasm/source/patched-yasm/tools/python-yasm/pyxelator/ir.py | ||
217 | @@ -9,8 +9,10 @@ version 0.xx | ||
218 | """ | ||
219 | |||
220 | import sys | ||
221 | -#import cPickle as pickle | ||
222 | -import pickle | ||
223 | +try: | ||
224 | + import cPickle as pickle | ||
225 | +except ImportError: | ||
226 | + import pickle | ||
227 | |||
228 | #from lexer import Lexer | ||
229 | from parse_core import Symbols #, Parser | ||
diff --git a/recipes-qt/qt5/qtwebengine_git.bb b/recipes-qt/qt5/qtwebengine_git.bb index c00120b3..fe2b1b57 100644 --- a/recipes-qt/qt5/qtwebengine_git.bb +++ b/recipes-qt/qt5/qtwebengine_git.bb | |||
@@ -24,6 +24,7 @@ DEPENDS += " \ | |||
24 | libdrm fontconfig pixman openssl pango cairo icu pciutils nss \ | 24 | libdrm fontconfig pixman openssl pango cairo icu pciutils nss \ |
25 | libcap \ | 25 | libcap \ |
26 | gperf-native \ | 26 | gperf-native \ |
27 | python3-urllib3-native \ | ||
27 | ${@bb.utils.contains('DISTRO_FEATURES', 'alsa', 'alsa-lib', '', d)} \ | 28 | ${@bb.utils.contains('DISTRO_FEATURES', 'alsa', 'alsa-lib', '', d)} \ |
28 | ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'libxcomposite libxcursor libxi libxrandr libxtst', '', d)} \ | 29 | ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'libxcomposite libxcursor libxi libxrandr libxtst', '', d)} \ |
29 | " | 30 | " |
@@ -149,6 +150,7 @@ QT_MODULE_BRANCH_CHROMIUM = "77-based" | |||
149 | SRC_URI += " \ | 150 | SRC_URI += " \ |
150 | ${QT_GIT}/qtwebengine-chromium.git;name=chromium;branch=${QT_MODULE_BRANCH_CHROMIUM};protocol=${QT_GIT_PROTOCOL};destsuffix=git/src/3rdparty \ | 151 | ${QT_GIT}/qtwebengine-chromium.git;name=chromium;branch=${QT_MODULE_BRANCH_CHROMIUM};protocol=${QT_GIT_PROTOCOL};destsuffix=git/src/3rdparty \ |
151 | file://0001-Force-host-toolchain-configuration.patch \ | 152 | file://0001-Force-host-toolchain-configuration.patch \ |
153 | file://0001-Allow-to-build-with-python3.patch \ | ||
152 | " | 154 | " |
153 | SRC_URI_append_libc-musl = "\ | 155 | SRC_URI_append_libc-musl = "\ |
154 | file://0002-musl-don-t-use-pvalloc-as-it-s-not-available-on-musl.patch \ | 156 | file://0002-musl-don-t-use-pvalloc-as-it-s-not-available-on-musl.patch \ |
@@ -170,6 +172,7 @@ SRC_URI += " \ | |||
170 | file://chromium/0009-chromium-Include-cstddef-for-size_t-definition.patch;patchdir=src/3rdparty \ | 172 | file://chromium/0009-chromium-Include-cstddef-for-size_t-definition.patch;patchdir=src/3rdparty \ |
171 | file://chromium/0010-chromium-Move-CharAllocator-definition-to-a-header-f.patch;patchdir=src/3rdparty \ | 173 | file://chromium/0010-chromium-Move-CharAllocator-definition-to-a-header-f.patch;patchdir=src/3rdparty \ |
172 | file://chromium/0011-chromium-Include-cstddef-and-cstdint.patch;patchdir=src/3rdparty \ | 174 | file://chromium/0011-chromium-Include-cstddef-and-cstdint.patch;patchdir=src/3rdparty \ |
175 | file://chromium/0001-chromium-Allow-to-build-with-python3.patch;patchdir=src/3rdparty \ | ||
173 | " | 176 | " |
174 | 177 | ||
175 | SRC_URI_append_libc-musl = "\ | 178 | SRC_URI_append_libc-musl = "\ |