From 4c86f2ade342ad15aaad7898d6d72f5e57b1a1fe Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Thu, 23 Jan 2020 18:06:01 +0100 Subject: qtwebengine: Allow to build with python3 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 --- .../0001-Allow-to-build-with-python3.patch | 102 +++++++++ ...0001-chromium-Allow-to-build-with-python3.patch | 229 +++++++++++++++++++++ recipes-qt/qt5/qtwebengine_git.bb | 3 + 3 files changed, 334 insertions(+) create mode 100644 recipes-qt/qt5/qtwebengine/0001-Allow-to-build-with-python3.patch create mode 100644 recipes-qt/qt5/qtwebengine/chromium/0001-chromium-Allow-to-build-with-python3.patch 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 @@ +From 717fbe35574a2409f1be28cdb3b1504133560b90 Mon Sep 17 00:00:00 2001 +From: Martin Jansa +Date: Thu, 23 Jan 2020 17:48:46 +0100 +Subject: [PATCH] Allow to build with python3 + +Signed-off-by: Martin Jansa +--- + mkspecs/features/functions.prf | 6 +----- + src/buildtools/config/support.pri | 5 ----- + src/buildtools/configure.json | 14 -------------- + tools/scripts/gn_find_mocables.py | 4 ++-- + 4 files changed, 3 insertions(+), 26 deletions(-) + +diff --git a/mkspecs/features/functions.prf b/mkspecs/features/functions.prf +index 512e2523..38bf76cd 100644 +--- a/mkspecs/features/functions.prf ++++ b/mkspecs/features/functions.prf +@@ -39,11 +39,7 @@ defineReplace(which) { + + # Returns the unquoted path to the python executable. + defineReplace(pythonPath) { +- isEmpty(QMAKE_PYTHON2) { +- # Fallback for building QtWebEngine with Qt < 5.8 +- QMAKE_PYTHON2 = python +- } +- return($$QMAKE_PYTHON2) ++ return("python3") + } + + # Returns the python executable for use with shell / make targets. +diff --git a/src/buildtools/config/support.pri b/src/buildtools/config/support.pri +index 5bdd808d..a942d3dc 100644 +--- a/src/buildtools/config/support.pri ++++ b/src/buildtools/config/support.pri +@@ -61,11 +61,6 @@ defineReplace(qtwebengine_checkError) { + return(false) + } + +- !qtConfig(webengine-python2) { +- qtwebengine_skipBuild("Python version 2 (2.7.5 or later) is required to build QtWebEngine.") +- return(false) +- } +- + linux:!qtwebengine_checkErrorForLinux():return(false) + win:!qtwebengine_checkErrorForWindows():return(false) + +diff --git a/src/buildtools/configure.json b/src/buildtools/configure.json +index a36d0532..24387fe7 100644 +--- a/src/buildtools/configure.json ++++ b/src/buildtools/configure.json +@@ -318,11 +318,6 @@ + "label": "system ninja", + "type": "detectNinja" + }, +- "webengine-python2": { +- "label": "python2", +- "type": "detectPython2", +- "log": "location" +- }, + "webengine-winversion": { + "label": "winversion", + "type": "compile", +@@ -374,7 +369,6 @@ + "webengine-core-support": { + "label": "Support Qt WebEngine Core", + "condition": "module.gui +- && features.webengine-python2 + && features.webengine-gperf + && features.webengine-bison + && features.webengine-flex +@@ -404,14 +398,6 @@ + "autoDetect": "features.private_tests", + "output": [ "privateFeature" ] + }, +- "webengine-python2": { +- "label": "python2", +- "condition": "tests.webengine-python2", +- "output": [ +- "privateFeature", +- { "type": "varAssign", "name": "QMAKE_PYTHON2", "value": "tests.webengine-python2.location" } +- ] +- }, + "webengine-gperf": { + "label": "gperf", + "condition": "tests.webengine-gperf", +diff --git a/tools/scripts/gn_find_mocables.py b/tools/scripts/gn_find_mocables.py +index d1f68245..4dc2576e 100644 +--- a/tools/scripts/gn_find_mocables.py ++++ b/tools/scripts/gn_find_mocables.py +@@ -58,10 +58,10 @@ for f in filter(os.path.isfile, files): + includedMocs.add(im.group(1)) + + for mocable in includedMocs: +- print "Found included moc: " + mocable ++ print("Found included moc: " + mocable) + + assert len(includedMocs) == 0 , "Included mocs are not supported !" + + for mocable in mocables: +- print mocable ++ print(mocable) + 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 @@ +From db207d9e3a0c0354f91ab753246916623312c06b Mon Sep 17 00:00:00 2001 +From: Martin Jansa +Date: Thu, 23 Jan 2020 18:04:09 +0100 +Subject: [PATCH] chromium: Allow to build with python3 + +Signed-off-by: Martin Jansa +--- + chromium/build/config/linux/pkg-config.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/chromium/build/config/linux/pkg-config.py b/chromium/build/config/linux/pkg-config.py +index 930810b008a..ea9bf155409 100755 +--- a/chromium/build/config/linux/pkg-config.py ++++ b/chromium/build/config/linux/pkg-config.py +@@ -195,7 +195,7 @@ def main(): + sys.stderr.write('Running: %s\n' % ' '.join(cmd)) + + try: +- flag_string = subprocess.check_output(cmd) ++ flag_string = subprocess.check_output(cmd).decode('utf8') + except: + sys.stderr.write('Could not run pkg-config.\n') + return 1 +diff --git a/chromium/build/config/posix/sysroot_ld_path.py b/chromium/build/config/posix/sysroot_ld_path.py +index 5fe5623711c..39d019482fe 100644 +--- a/chromium/build/config/posix/sysroot_ld_path.py ++++ b/chromium/build/config/posix/sysroot_ld_path.py +@@ -17,7 +17,7 @@ if len(sys.argv) != 3: + print("Need two arguments") + sys.exit(1) + +-result = subprocess.check_output([sys.argv[1], sys.argv[2]]).strip() ++result = subprocess.check_output([sys.argv[1], sys.argv[2]]).strip().decode('utf8') + result = result.replace(" ", "\n") + if result != "": + print(result) +diff --git a/chromium/mojo/public/tools/bindings/mojom_bindings_generator.py b/chromium/mojo/public/tools/bindings/mojom_bindings_generator.py +index f28fb90a1d6..c5a959b2936 100755 +--- a/chromium/mojo/public/tools/bindings/mojom_bindings_generator.py ++++ b/chromium/mojo/public/tools/bindings/mojom_bindings_generator.py +@@ -139,7 +139,7 @@ def ScrambleMethodOrdinals(interfaces, salt): + + + def ReadFileContents(filename): +- with open(filename, 'rb') as f: ++ with open(filename, 'r') as f: + return f.read() + + +diff --git a/chromium/third_party/blink/renderer/bindings/scripts/utilities.py b/chromium/third_party/blink/renderer/bindings/scripts/utilities.py +index ff1bab337ea..4df72b72a92 100644 +--- a/chromium/third_party/blink/renderer/bindings/scripts/utilities.py ++++ b/chromium/third_party/blink/renderer/bindings/scripts/utilities.py +@@ -8,7 +8,10 @@ Design doc: http://www.chromium.org/developers/design-documents/idl-build + """ + + import os +-import cPickle as pickle ++try: ++ import cPickle as pickle ++except ImportError: ++ import pickle + import re + import shlex + import string +diff --git a/chromium/third_party/blink/renderer/build/scripts/json5_generator.py b/chromium/third_party/blink/renderer/build/scripts/json5_generator.py +index 8bd0c7ab8f9..014b08e330c 100644 +--- a/chromium/third_party/blink/renderer/build/scripts/json5_generator.py ++++ b/chromium/third_party/blink/renderer/build/scripts/json5_generator.py +@@ -103,7 +103,7 @@ def _is_valid(valid_values, value, valid_keys=None): + assert valid_keys, "'valid_keys' must be declared when using a dict value" + return all([(key in valid_keys or key == "default") + and (val in valid_values or val == "") +- for key, val in value.iteritems()]) ++ for key, val in value.items()]) + else: + return value in valid_values + +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 +index b5fb70f72e2..e74aa7ef4a4 100755 +--- a/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py ++++ b/chromium/third_party/blink/renderer/build/scripts/make_runtime_features.py +@@ -28,7 +28,10 @@ + # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + import copy +-import cPickle as pickle ++try: ++ import cPickle as pickle ++except ImportError: ++ import pickle + import os + import sys + +diff --git a/chromium/third_party/blink/renderer/build/scripts/template_expander.py b/chromium/third_party/blink/renderer/build/scripts/template_expander.py +index 2cf3ad6a098..722d3dfe96e 100644 +--- a/chromium/third_party/blink/renderer/build/scripts/template_expander.py ++++ b/chromium/third_party/blink/renderer/build/scripts/template_expander.py +@@ -64,6 +64,6 @@ def use_jinja(template_path, filters=None, tests=None, template_cache=None): + parameters = generator(*args, **kwargs) + return apply_template(template_path, parameters, filters=filters, + tests=tests, template_cache=template_cache) +- generator_internal.func_name = generator.func_name ++ generator_internal.__name__ = generator.__name__ + return generator_internal + return real_decorator +diff --git a/chromium/third_party/blink/tools/blinkpy/common/message_pool.py b/chromium/third_party/blink/tools/blinkpy/common/message_pool.py +index 15ba177b7f9..ff709af50f7 100644 +--- a/chromium/third_party/blink/tools/blinkpy/common/message_pool.py ++++ b/chromium/third_party/blink/tools/blinkpy/common/message_pool.py +@@ -40,7 +40,10 @@ If you don't need these features, use multiprocessing.Pool or concurrency.future + instead. + """ + +-import cPickle ++try: ++ import cPickle as pickle ++except ImportError: ++ import pickle + import logging + import multiprocessing + import Queue +@@ -160,7 +163,7 @@ class _MessagePool(object): + + def _can_pickle(self, host): + try: +- cPickle.dumps(host) ++ pickle.dumps(host) + return True + except TypeError: + return False +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 +index ade2f8ec5d2..bd3b4c84a26 100644 +--- 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 +@@ -26,7 +26,10 @@ + # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +-import cPickle ++try: ++ import cPickle as pickle ++except ImportError: ++ import pickle + + from blinkpy.web_tests.models import test_expectations + +@@ -102,7 +105,7 @@ class TestFailure(object): + @staticmethod + def loads(s): + """Creates a TestFailure object from the specified string.""" +- return cPickle.loads(s) ++ return pickle.loads(s) + + def message(self): + """Returns a string describing the failure in more detail.""" +@@ -119,7 +122,7 @@ class TestFailure(object): + + def dumps(self): + """Returns the string/JSON representation of a TestFailure.""" +- return cPickle.dumps(self) ++ return pickle.dumps(self) + + def driver_needs_restart(self): + """Returns True if we should kill the driver before the next test.""" +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 +index 8c83576888e..ad6cfc86ac3 100644 +--- 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 +@@ -26,7 +26,10 @@ + # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +-import cPickle ++try: ++ import cPickle as pickle ++except ImportError: ++ import pickle + + from blinkpy.web_tests.models import test_failures + +@@ -36,7 +39,7 @@ class TestResult(object): + + @staticmethod + def loads(string): +- return cPickle.loads(string) ++ return pickle.loads(string) + + def __init__(self, test_name, failures=None, test_run_time=None, has_stderr=False, reftest_type=None, + pid=None, references=None, device_failed=False, has_repaint_overlay=False, crash_site=None): +@@ -69,4 +72,4 @@ class TestResult(object): + return not (self == other) + + def dumps(self): +- return cPickle.dumps(self) ++ return pickle.dumps(self) +diff --git a/chromium/third_party/jinja2/_compat.py b/chromium/third_party/jinja2/_compat.py +index 61d85301a4a..4e8aebf380f 100644 +--- a/chromium/third_party/jinja2/_compat.py ++++ b/chromium/third_party/jinja2/_compat.py +@@ -57,7 +57,10 @@ else: + itervalues = lambda d: d.itervalues() + iteritems = lambda d: d.iteritems() + +- import cPickle as pickle ++ try: ++ import cPickle as pickle ++ except ImportError: ++ import pickle + from cStringIO import StringIO as BytesIO, StringIO + NativeStringIO = BytesIO + +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 +index cfa9c02ead1..df088214b48 100755 +--- 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 +@@ -9,8 +9,10 @@ version 0.xx + """ + + import sys +-#import cPickle as pickle +-import pickle ++try: ++ import cPickle as pickle ++except ImportError: ++ import pickle + + #from lexer import Lexer + 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 += " \ libdrm fontconfig pixman openssl pango cairo icu pciutils nss \ libcap \ gperf-native \ + python3-urllib3-native \ ${@bb.utils.contains('DISTRO_FEATURES', 'alsa', 'alsa-lib', '', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'libxcomposite libxcursor libxi libxrandr libxtst', '', d)} \ " @@ -149,6 +150,7 @@ QT_MODULE_BRANCH_CHROMIUM = "77-based" SRC_URI += " \ ${QT_GIT}/qtwebengine-chromium.git;name=chromium;branch=${QT_MODULE_BRANCH_CHROMIUM};protocol=${QT_GIT_PROTOCOL};destsuffix=git/src/3rdparty \ file://0001-Force-host-toolchain-configuration.patch \ + file://0001-Allow-to-build-with-python3.patch \ " SRC_URI_append_libc-musl = "\ file://0002-musl-don-t-use-pvalloc-as-it-s-not-available-on-musl.patch \ @@ -170,6 +172,7 @@ SRC_URI += " \ file://chromium/0009-chromium-Include-cstddef-for-size_t-definition.patch;patchdir=src/3rdparty \ file://chromium/0010-chromium-Move-CharAllocator-definition-to-a-header-f.patch;patchdir=src/3rdparty \ file://chromium/0011-chromium-Include-cstddef-and-cstdint.patch;patchdir=src/3rdparty \ + file://chromium/0001-chromium-Allow-to-build-with-python3.patch;patchdir=src/3rdparty \ " SRC_URI_append_libc-musl = "\ -- cgit v1.2.3