package/qt5/qt5webengine-chromium: another fix for Python 3.12 issue

Further down the build:

FAILED: gen/components/resources/ssl/ssl_error_assistant/ssl_error_assistant.pb
/home/thomas/buildroot/buildroot/output/build/qt5webengine-5.15.14/host-bin/python ../../3rdparty/chromium/components/resources/ssl/ssl_error_assistant/gen_ssl_error_assistant_proto.py -w -i ../../3rdparty/chromium/components/resources/ssl/ssl_error_assistant/ssl_error_assistant.asciipb -d gen/components/resources/ssl/ssl_error_assistant -o ssl_error_assistant.pb -p pyproto -p pyproto/components/security_interstitials/content/
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 23, in <module>
    from binary_proto_generator import BinaryProtoGenerator
  File "/home/thomas/buildroot/buildroot/output/build/qt5webengine-5.15.14/src/3rdparty/chromium/components/resources/protobufs/binary_proto_generator.py", line 12, in <module>
    import imp
ModuleNotFoundError: No module named 'imp'

Backport an upstream patch fixing this.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Thomas Petazzoni
2024-07-13 16:25:18 +02:00
parent ca7cedaa8c
commit efc5e6ad52

View File

@@ -0,0 +1,55 @@
From d08221f81f35f2755088c2a174cfdc230eb1dcc4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jacobo=20Aragunde=20P=C3=A9rez?= <jaragunde@igalia.com>
Date: Wed, 25 Oct 2023 06:20:54 +0000
Subject: [PATCH] Replace imp.load_source with importlib equivalent.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The imp module has been deprecated for years and the function
load_source was even removed from the documentation long ago.
It will be removed in Python 3.12, which will be part of Fedora
version 39, due in late October 2023.
Bug: 1487454
Change-Id: If06a2f139225b62c7bdc70c3eaef6e5acb8972d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4894238
Reviewed-by: Mustafa Emre Acer <meacer@chromium.org>
Commit-Queue: Jacobo Aragunde Pérez <jaragunde@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1214660}
Upstream: https://github.com/chromium/chromium/commit/9e0c89a3b5638ba2b9b107fea34a01c774aa7805
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
.../resources/protobufs/binary_proto_generator.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/chromium/components/resources/protobufs/binary_proto_generator.py b/chromium/components/resources/protobufs/binary_proto_generator.py
index 16365515f26..c8b11f1071a 100755
--- a/chromium/components/resources/protobufs/binary_proto_generator.py
+++ b/chromium/components/resources/protobufs/binary_proto_generator.py
@@ -9,7 +9,7 @@
"""
from __future__ import print_function
import abc
-import imp
+from importlib import util as imp_util
import optparse
import os
import re
@@ -68,7 +68,11 @@ class GoogleProtobufModuleImporter:
raise ImportError(fullname)
filepath = self._fullname_to_filepath(fullname)
- return imp.load_source(fullname, filepath)
+ spec = imp_util.spec_from_file_location(fullname, filepath)
+ loaded = imp_util.module_from_spec(spec)
+ spec.loader.exec_module(loaded)
+
+ return loaded
class BinaryProtoGenerator:
--
2.25.1