]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: (python): work around python 3.12 bug
authorThomas Weißschuh <thomas@t-8ch.de>
Sun, 9 Jul 2023 08:18:15 +0000 (10:18 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 16 Aug 2023 09:23:58 +0000 (11:23 +0200)
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 <thomas@t-8ch.de>
configure.ac
libmount/python/meson.build

index 2cb236ffe160ce8615cb8f1c54e0761c624c6099..445db70df1fdecffec33d5a28c08b6722b8738be 100644 (file)
@@ -2607,8 +2607,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])
+         ])
+       ]
   )
 ])
 
index 57d9a2880bae5ecafd607b8ca1e3a8ec036547a0..c5feb7bccd8a54f46f7656241a4022d52828fbdf 100644 (file)
@@ -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