From 076a487717b5aef2972eaa01ec435caafa0631af Mon Sep 17 00:00:00 2001 From: Tom Schoonjans Date: Sun, 20 Jun 2021 15:38:38 +0100 Subject: [PATCH] python: do not use distutils in autoconf macros --- m4/m4-ax_python_devel.m4 | 76 +++++++++++++--------------------------- 1 file changed, 24 insertions(+), 52 deletions(-) diff --git a/m4/m4-ax_python_devel.m4 b/m4/m4-ax_python_devel.m4 index 5b1a908b..f10edbd4 100644 --- a/m4/m4-ax_python_devel.m4 +++ b/m4/m4-ax_python_devel.m4 @@ -138,34 +138,16 @@ variable to configure. See ``configure --help'' for reference. fi fi - # - # Check if you have distutils, else fail - # - if test x$PYTHON != x ; then - AC_MSG_CHECKING([for the distutils Python package]) - ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` - if test -z "$ac_distutils_result"; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - AC_MSG_WARN([cannot import Python module "distutils". -Please check your Python installation. The error was: -$ac_distutils_result]) - PYTHON_VERSION="" - PYTHON="" - fi - fi - # # Check for Python include path # if test x$PYTHON != x ; then AC_MSG_CHECKING([for Python include path]) if test -z "$PYTHON_CPPFLAGS"; then - python_path=`$PYTHON -c "import distutils.sysconfig; \ - print (distutils.sysconfig.get_python_inc ());"` - plat_python_path=`$PYTHON -c "import distutils.sysconfig; \ - print (distutils.sysconfig.get_python_inc (plat_specific=1));"` + python_path=`$PYTHON -c "import sysconfig; \ + print(sysconfig.get_path('include'));"` + plat_python_path=`$PYTHON -c "import sysconfig; \ + print(sysconfig.get_path('platinclude'));"` if test -n "${python_path}"; then if test "${plat_python_path}" != "${python_path}"; then python_path="-I$python_path -I$plat_python_path" @@ -194,7 +176,7 @@ $ac_distutils_result]) # join all versioning strings, on some systems # major/minor numbers could be in different list elements -from distutils.sysconfig import * +from sysconfig import * e = get_config_var('VERSION') if e is not None: print(e) @@ -217,8 +199,8 @@ EOD` ac_python_libdir=`cat<