From 6d12c5ea51512f6e77480372a4d6d6a8e2687cca Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Sat, 16 Nov 2024 09:29:22 -0500 Subject: [PATCH] frr: rebuild for python3-3.13 --- srcpkgs/frr/patches/python-3.13.patch | 79 +++++++++++++++++++++++++++ srcpkgs/frr/template | 2 +- 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/frr/patches/python-3.13.patch diff --git a/srcpkgs/frr/patches/python-3.13.patch b/srcpkgs/frr/patches/python-3.13.patch new file mode 100644 index 00000000000..519c75786fd --- /dev/null +++ b/srcpkgs/frr/patches/python-3.13.patch @@ -0,0 +1,79 @@ +From 9fcc2ae596a1eabfb0b7e663b5d47fa58a124bc2 Mon Sep 17 00:00:00 2001 +From: David Lamparter +Date: Wed, 15 Mar 2023 12:24:36 +0100 +Subject: [PATCH] lib: adapt clippy to Python 3.8+ init API + +The old initialization/config API is deprecated in Python 3.11. Make +clippy use the new one added in 3.8 if it's that version or newer. + +Signed-off-by: David Lamparter +--- + lib/clippy.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 48 insertions(+) + +diff --git a/lib/clippy.c b/lib/clippy.c +index c3c9f5c4016d..d414053c5538 100644 +--- a/lib/clippy.c ++++ b/lib/clippy.c +@@ -14,6 +14,53 @@ + #include "command_graph.h" + #include "clippy.h" + ++#if PY_VERSION_HEX >= 0x03080000 ++/* new python init/config API added in Python 3.8 */ ++int main(int argc, char **argv) ++{ ++ PyStatus status; ++ PyPreConfig preconfig[1]; ++ PyConfig config[1]; ++ ++ PyPreConfig_InitPythonConfig(preconfig); ++ preconfig->configure_locale = 0; ++ preconfig->coerce_c_locale = 1; ++ preconfig->coerce_c_locale_warn = 0; ++ preconfig->isolated = 0; ++ preconfig->utf8_mode = 1; ++ preconfig->parse_argv = 0; ++ ++ status = Py_PreInitializeFromBytesArgs(preconfig, argc, argv); ++ if (PyStatus_Exception(status)) ++ Py_ExitStatusException(status); ++ ++ PyConfig_InitPythonConfig(config); ++#if PY_VERSION_HEX >= 0x030b0000 /* 3.11 */ ++ config->safe_path = 0; ++#endif ++ ++ status = PyConfig_SetBytesArgv(config, argc, argv); ++ if (PyStatus_Exception(status)) ++ Py_ExitStatusException(status); ++ ++ PyConfig_SetBytesString(config, &config->program_name, ++ argc > 0 ? argv[0] : "clippy"); ++ if (argc > 1) ++ PyConfig_SetBytesString(config, &config->run_filename, argv[1]); ++ ++ PyImport_AppendInittab("_clippy", command_py_init); ++ ++ status = Py_InitializeFromConfig(config); ++ if (PyStatus_Exception(status)) ++ Py_ExitStatusException(status); ++ ++ PyConfig_Clear(config); ++ ++ return Py_RunMain(); ++} ++ ++#else /* Python < 3.8 */ ++/* old python init/config API, deprecated in Python 3.11 */ + #if PY_MAJOR_VERSION >= 3 + #define pychar wchar_t + static wchar_t *wconv(const char *s) +@@ -89,6 +136,7 @@ int main(int argc, char **argv) + free(wargv); + return 0; + } ++#endif /* Python < 3.8 */ + + /* and now for the ugly part... provide simplified logging functions so we + * don't need to link libzebra (which would be a circular build dep) */ diff --git a/srcpkgs/frr/template b/srcpkgs/frr/template index d5520d0a6c2..caedf801c89 100644 --- a/srcpkgs/frr/template +++ b/srcpkgs/frr/template @@ -1,7 +1,7 @@ # Template file for 'frr' pkgname=frr version=7.5 -revision=6 +revision=7 build_style=gnu-configure # chroot-texinfo is not able to build frr's docs configure_args="--disable-doc