From 649101f6e65c5345e97229d31f19ea1f8e7b16c4 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Sat, 13 Jul 2024 17:36:15 +0200 Subject: [PATCH] package/qt5/qt5webengine-chromium: fix Python 3.12 issue in protobuf copy Fixes: Traceback (most recent call last): File "/home/thomas/buildroot/buildroot/output/build/qt5webengine-5.15.14/src/core/release/../../3rdparty/chromium/components/resources/ssl/ssl_error_assistant/gen_ssl_error_assistant_proto.py", line 71, in sys.exit(main()) ^^^^^^ File "/home/thomas/buildroot/buildroot/output/build/qt5webengine-5.15.14/src/core/release/../../3rdparty/chromium/components/resources/ssl/ssl_error_assistant/gen_ssl_error_assistant_proto.py", line 68, in main return SSLErrorAssistantProtoGenerator().Run() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/thomas/buildroot/buildroot/output/build/qt5webengine-5.15.14/src/3rdparty/chromium/components/resources/protobufs/binary_proto_generator.py", line 200, in Run self._ImportProtoModules(opts.path) File "/home/thomas/buildroot/buildroot/output/build/qt5webengine-5.15.14/src/3rdparty/chromium/components/resources/protobufs/binary_proto_generator.py", line 107, in _ImportProtoModules self.ImportProtoModule() File "/home/thomas/buildroot/buildroot/output/build/qt5webengine-5.15.14/src/core/release/../../3rdparty/chromium/components/resources/ssl/ssl_error_assistant/gen_ssl_error_assistant_proto.py", line 33, in ImportProtoModule import ssl_error_assistant_pb2 File "/home/thomas/buildroot/buildroot/output/build/qt5webengine-5.15.14/src/core/release/pyproto/components/security_interstitials/content/ssl_error_assistant_pb2.py", line 9, in from google.protobuf import reflection as _reflection File "/home/thomas/buildroot/buildroot/output/build/qt5webengine-5.15.14/src/core/release/pyproto/google/protobuf/reflection.py", line 51, in from google.protobuf import message_factory File "/home/thomas/buildroot/buildroot/output/build/qt5webengine-5.15.14/src/core/release/pyproto/google/protobuf/message_factory.py", line 49, in from google.protobuf.internal import python_message as message_impl File "/home/thomas/buildroot/buildroot/output/build/qt5webengine-5.15.14/src/core/release/pyproto/google/protobuf/internal/python_message.py", line 59, in from six.moves import range ModuleNotFoundError: No module named 'six.moves' Signed-off-by: Thomas Petazzoni --- ...google-protobuf-internal-python_mess.patch | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 package/qt5/qt5webengine-chromium/0008-protobuf-python-google-protobuf-internal-python_mess.patch diff --git a/package/qt5/qt5webengine-chromium/0008-protobuf-python-google-protobuf-internal-python_mess.patch b/package/qt5/qt5webengine-chromium/0008-protobuf-python-google-protobuf-internal-python_mess.patch new file mode 100644 index 0000000000..810e71475a --- /dev/null +++ b/package/qt5/qt5webengine-chromium/0008-protobuf-python-google-protobuf-internal-python_mess.patch @@ -0,0 +1,51 @@ +From f01ebcd09a0b43589671fc8573bd0c00781c618e Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Sat, 13 Jul 2024 17:34:13 +0200 +Subject: [PATCH] protobuf/python/google/protobuf/internal/python_message.py: + fix Python 3.12 compatibility + +This is a part of the larger commit +29527fb6f77bdf5f2393f2327fec590c6deab27f from Chromium, which updates +their internal copy of protobuf to 3.20.0. + +Upstream: https://github.com/chromium/chromium/commit/29527fb6f77bdf5f2393f2327fec590c6deab27f (part of) +Signed-off-by: Thomas Petazzoni +--- + .../python/google/protobuf/internal/python_message.py | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +diff --git a/chromium/third_party/protobuf/python/google/protobuf/internal/python_message.py b/chromium/third_party/protobuf/python/google/protobuf/internal/python_message.py +index 803ae848493..a1954ce88c9 100755 +--- a/chromium/third_party/protobuf/python/google/protobuf/internal/python_message.py ++++ b/chromium/third_party/protobuf/python/google/protobuf/internal/python_message.py +@@ -55,9 +55,6 @@ import struct + import sys + import weakref + +-import six +-from six.moves import range +- + # We use "as" to avoid name collisions with variables. + from google.protobuf.internal import api_implementation + from google.protobuf.internal import containers +@@ -467,7 +464,7 @@ def _ReraiseTypeErrorWithFieldName(message_name, field_name): + exc = TypeError('%s for field %s.%s' % (str(exc), message_name, field_name)) + + # re-raise possibly-amended exception with original traceback: +- six.reraise(type(exc), exc, sys.exc_info()[2]) ++ raise exc.with_traceback(sys.exc_info()[2]) + + + def _AddInitMethod(message_descriptor, cls): +@@ -480,7 +477,7 @@ def _AddInitMethod(message_descriptor, cls): + enum_type with the same name. If the value is not a string, it's + returned as-is. (No conversion or bounds-checking is done.) + """ +- if isinstance(value, six.string_types): ++ if isinstance(value, str): + try: + return enum_type.values_by_name[value].number + except KeyError: +-- +2.25.1 +