From cdd4be04e6301a8ab2ebd7b7ba225659743f9d23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Wed, 21 Sep 2022 22:18:07 +0700 Subject: [PATCH] collectd: fix build with Python 3.11 --- .../collectd/patches/python-3.11-more.patch | 42 +++++++++++++++++++ srcpkgs/collectd/patches/python-3.11.patch | 10 +++++ 2 files changed, 52 insertions(+) create mode 100644 srcpkgs/collectd/patches/python-3.11-more.patch create mode 100644 srcpkgs/collectd/patches/python-3.11.patch diff --git a/srcpkgs/collectd/patches/python-3.11-more.patch b/srcpkgs/collectd/patches/python-3.11-more.patch new file mode 100644 index 00000000000..b575613e0e7 --- /dev/null +++ b/srcpkgs/collectd/patches/python-3.11-more.patch @@ -0,0 +1,42 @@ +From 17d2fbe443b656bb0f74c204eb003cea22f94e60 Mon Sep 17 00:00:00 2001 +From: Paul +Date: Fri, 18 Jun 2021 14:48:29 +0200 +Subject: [PATCH] ChangeLog: python: Fix compile-time errors about deprecation + via ifdefs. + +--- + src/python.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/src/python.c b/src/python.c +index 119ffe21742..318883ecfff 100644 +--- a/src/python.c ++++ b/src/python.c +@@ -1141,7 +1141,13 @@ static void *cpy_interactive(void *pipefd) { + #else + PyOS_AfterFork_Child(); + #endif ++#if PY_VERSION_HEX < 0x03090000 ++ // deprecated. Called by Py_Initialize(). Removed in Py3.11 ++ // https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads + PyEval_InitThreads(); ++#else ++ Py_Initialize(); ++#endif + close(*(int *)pipefd); + PyRun_InteractiveLoop(stdin, ""); + PyOS_setsig(SIGINT, cur_sig); +@@ -1178,7 +1184,13 @@ static int cpy_init(void) { + ; + (void)close(pipefd[0]); + } else { ++#if PY_VERSION_HEX < 0x03090000 ++ // deprecated. Called by Py_Initialize(). Removed in Py3.11 ++ // https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads + PyEval_InitThreads(); ++#else ++ Py_Initialize(); ++#endif + state = PyEval_SaveThread(); + } + CPY_LOCK_THREADS diff --git a/srcpkgs/collectd/patches/python-3.11.patch b/srcpkgs/collectd/patches/python-3.11.patch new file mode 100644 index 00000000000..2b7c7b7baff --- /dev/null +++ b/srcpkgs/collectd/patches/python-3.11.patch @@ -0,0 +1,10 @@ +--- a/src/cpython.h ++++ b/src/cpython.h +@@ -26,7 +26,6 @@ + + /* Some python versions don't include this by default. */ + +-#include + + /* These two macros are basically Py_BEGIN_ALLOW_THREADS and + * Py_BEGIN_ALLOW_THREADS