From c6cdefd733d0911e9a042e621d4f6ca55cb44505 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Sun, 9 Jul 2023 10:18:15 +0200 Subject: [PATCH] libmount: (python): work around python 3.12 bug MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Python 3.12 introduced a -Wredundant-decls warning. Work around it by not breaking the build. See https://github.com/python/cpython/issues/106560 Closes: #2366 Signed-off-by: Thomas Weißschuh --- configure.ac | 10 ++++++++-- libmount/python/meson.build | 8 +++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 8906e8e7fc..7e4a5b91cc 100644 --- a/configure.ac +++ b/configure.ac @@ -2637,8 +2637,14 @@ AS_IF([test "x$with_python" != xno], [ [AC_MSG_WARN([python interpreter not found, do not build python bindings])], [*:yes], # check for python development stuff - [PKG_CHECK_MODULES([PYTHON], [python-$PYTHON_VERSION], - [have_libpython=yes], [have_libpython=no])] + [ + PKG_CHECK_MODULES([PYTHON], [python-$PYTHON_VERSION], [have_libpython=yes], [have_libpython=no]) + + # https://github.com/util-linux/util-linux/issues/2366 + AX_COMPARE_VERSION([$PYTHON_VERSION], [ge], [3.12], [ + UL_WARN_ADD([-Wno-error=redundant-decls], [PYTHON_CFLAGS]) + ]) + ] ) ]) diff --git a/libmount/python/meson.build b/libmount/python/meson.build index 57d9a2880b..c5feb7bccd 100644 --- a/libmount/python/meson.build +++ b/libmount/python/meson.build @@ -24,7 +24,13 @@ python.extension_module( subdir : 'libmount', link_with : lib_mount, dependencies : python.dependency(), - c_args : [ '-Wno-cast-function-type' ], + c_args : [ + '-Wno-cast-function-type', + + # https://github.com/util-linux/util-linux/issues/2366 + python.language_version().version_compare('>=3.12') ? + [ '-Wno-error=redundant-decls' ] : [], + ], install : true) if build_python -- 2.47.3