Since 'distutils' will be removed in Python 3.12, use setuptools instead
to build the bindings. Thanks to the python devs that removed the only
facility to build native extensions from the core distribution.
See https://peps.python.org/pep-0632/
Change-Id: Ib515931d2352416bcc92e18be6b5a3981fb3f067
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8846
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
AS_IF([test "x$have_python_dev" = xno], [
AC_MSG_ERROR([Cannot find a suitable python-config. You can override the python-config path with the PYTHON_CONFIG environment variable.])
])
+
+ AX_COMPARE_VERSION(["$PYTHON_VERSION"], [ge], ["3.12"], [
+ AC_MSG_CHECKING([for python setuptools])
+ AS_IF(["$PYTHON" -c "import setuptools" 2>/dev/null], [
+ AC_MSG_RESULT([yes])
+ ], [
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([Python >= 3.12 removed 'distutils', the 'setuptools' module needs to be installed for the selected interpreter.])
+ ])
+ ])
])
AE_IF_FEATURE_ENABLED([python-bindings-doc],
import os
import sysconfig
-from distutils.core import setup, Extension
+if sys.version_info < (3, 12):
+ from distutils.core import setup, Extension
+else:
+ from setuptools import setup, Extension
PY_PATH_WARN_MSG = """
-------------------------------------WARNING------------------------------------