commit:     2d9fa2ef2f89fb72275dab73204ad2404b22d666
Author:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 16 21:24:55 2024 +0000
Commit:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Tue Jul 16 21:24:55 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2d9fa2ef

www-client/elinks: fix python3.12 support

Closes: https://bugs.gentoo.org/929876
Bug: https://bugs.gentoo.org/919372
Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>

 www-client/elinks/elinks-0.16.1.1-r3.ebuild        |  2 ++
 ...-0.16.1.1-ecmascript-implicit-declaration.patch | 36 ++++++++++++++++++++++
 .../elinks/files/elinks-0.16.1.1-python-3.12.patch | 26 ++++++++++++++++
 3 files changed, 64 insertions(+)

diff --git a/www-client/elinks/elinks-0.16.1.1-r3.ebuild 
b/www-client/elinks/elinks-0.16.1.1-r3.ebuild
index bef5b7bb9a45..a56703fb7e56 100644
--- a/www-client/elinks/elinks-0.16.1.1-r3.ebuild
+++ b/www-client/elinks/elinks-0.16.1.1-r3.ebuild
@@ -72,7 +72,9 @@ BDEPEND="
 "
 
 PATCHES=(
+       "${FILESDIR}"/${PN}-0.16.1.1-ecmascript-implicit-declaration.patch
        "${FILESDIR}"/${PN}-0.16.1.1-perl-5.38.patch
+       "${FILESDIR}"/${PN}-0.16.1.1-python-3.12.patch
 )
 
 pkg_setup() {

diff --git 
a/www-client/elinks/files/elinks-0.16.1.1-ecmascript-implicit-declaration.patch 
b/www-client/elinks/files/elinks-0.16.1.1-ecmascript-implicit-declaration.patch
new file mode 100644
index 000000000000..58c98cc27da0
--- /dev/null
+++ 
b/www-client/elinks/files/elinks-0.16.1.1-ecmascript-implicit-declaration.patch
@@ -0,0 +1,36 @@
+--- elinks-0.16.1.1/src/document/html/parser/general.c 2024-06-06 
07:10:40.163191871 +0200
++++ elinks-0.16.1.1/src/document/html/parser/general.c 2024-06-06 
07:11:45.913711031 +0200
+@@ -38,6 +38,10 @@
+ #include "util/memory.h"
+ #include "util/string.h"
+ 
++#ifdef CONFIG_ECMASCRIPT
++#include "ecmascript/ecmascript.h"
++#endif
++
+ /* Unsafe macros */
+ #include "document/html/internal.h"
+ 
+--- elinks-0.16.1.1/src/document/html/parser/stack.c   2023-05-01 
10:45:22.000000000 +0200
++++ elinks-0.16.1.1/src/document/html/parser/stack.c   2024-06-06 
07:11:29.892765184 +0200
+@@ -24,6 +24,10 @@
+ #include "util/memory.h"
+ #include "util/string.h"
+ 
++#ifdef CONFIG_ECMASCRIPT
++#include "ecmascript/ecmascript.h"
++#endif
++
+ /* Unsafe macros */
+ #include "document/html/internal.h"
+ 
+--- elinks-0.16.1.1/src/ecmascript/ecmascript.h.orig   2024-06-06 
07:18:53.237018842 +0200
++++ elinks-0.16.1.1/src/ecmascript/ecmascript.h        2024-06-06 
07:20:04.434093077 +0200
+@@ -26,6 +26,7 @@
+ #include "main/module.h"
+ #include "main/timer.h"
+ #include "util/time.h"
++#include <stdbool.h>
+ 
+ //#define ECMASCRIPT_DEBUG 1
+ 

diff --git a/www-client/elinks/files/elinks-0.16.1.1-python-3.12.patch 
b/www-client/elinks/files/elinks-0.16.1.1-python-3.12.patch
new file mode 100644
index 000000000000..e6ac9f004463
--- /dev/null
+++ b/www-client/elinks/files/elinks-0.16.1.1-python-3.12.patch
@@ -0,0 +1,26 @@
+From 2577da89420ce2a1d58fadd7f2e6809d2ba70dd8 Mon Sep 17 00:00:00 2001
+From: Witold Filipczyk <[email protected]>
+Date: Mon, 10 Jun 2024 13:07:23 +0200
+Subject: [PATCH] [python] module imp is deprecated. Refs #313
+
+---
+ src/scripting/python/core.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/scripting/python/core.c b/src/scripting/python/core.c
+index 185561108..4a69e4293 100644
+--- a/src/scripting/python/core.c
++++ b/src/scripting/python/core.c
+@@ -138,10 +138,10 @@ hooks_module_exists(void)
+        * indicates that no such module was found; any other exception will
+        * be reported as an error.
+        */
+-      imp_module = PyImport_ImportModule("imp");
++      imp_module = PyImport_ImportModule("importlib.util");
+       if (!imp_module) goto python_error;
+ 
+-      result = PyObject_CallMethod(imp_module, "find_module", "s", "hooks");
++      result = PyObject_CallMethod(imp_module, "find_spec", "s", "hooks");
+       if (result) {
+               found_hooks = 1;
+               goto end;

Reply via email to