From 7839f7ebd114b1274895c21f1f306df8980a0834 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Sun, 28 Aug 2022 18:43:54 +0200 Subject: Support Debian's posix_local sysconfig scheme in ax_python_devel Debian adds a custom sysconfig scheme to system python installs, "posix_local". This is the default scheme, and it redirects local users' Python module installs to /usr/local even though Python is installed with a /usr prefix. Both are on Debian's python's sys.path module search path. Autoconf and its users understand prefixes, and are likely to select /usr/local, explicitly. Select the "posix_prefix" scheme, with the user-supplied prefix. Previously this custom sysconfig scheme was specified in distutils.sysconfig, but not sysconfig itself. As distutils is being deprecated, the custom scheme is now specified in sysconfig, since Debian's Python 3.10 (3.10.2-4). --- m4/ax_python_devel.m4 | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/m4/ax_python_devel.m4 b/m4/ax_python_devel.m4 index 0a71592..eabfeeb 100644 --- a/m4/ax_python_devel.m4 +++ b/m4/ax_python_devel.m4 @@ -295,8 +295,20 @@ EOD` AC_MSG_CHECKING([for Python site-packages path]) if test -z "$PYTHON_SITE_PKG"; then if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then - PYTHON_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \ - print (sysconfig.get_path('purelib'));"` + PYTHON_SITE_PKG=`$PYTHON -c " +$IMPORT_SYSCONFIG; +if hasattr(sysconfig, 'get_default_scheme'): + scheme = sysconfig.get_default_scheme() +else: + scheme = sysconfig._get_default_scheme() +if scheme == 'posix_local': + # Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/ + scheme = 'posix_prefix' +prefix = '$prefix' +if prefix == 'NONE': + prefix = '$ac_default_prefix' +sitedir = sysconfig.get_path('purelib', scheme, vars={'base': prefix}) +print(sitedir)"` else # distutils.sysconfig way PYTHON_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \ @@ -312,8 +324,20 @@ EOD` AC_MSG_CHECKING([for Python platform specific site-packages path]) if test -z "$PYTHON_SITE_PKG"; then if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then - PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \ - print (sysconfig.get_path('platlib'));"` + PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c " +$IMPORT_SYSCONFIG; +if hasattr(sysconfig, 'get_default_scheme'): + scheme = sysconfig.get_default_scheme() +else: + scheme = sysconfig._get_default_scheme() +if scheme == 'posix_local': + # Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/ + scheme = 'posix_prefix' +prefix = '$prefix' +if prefix == 'NONE': + prefix = '$ac_default_prefix' +sitedir = sysconfig.get_path('platlib', scheme, vars={'platbase': prefix}) +print(sitedir)"` else # distutils.sysconfig way PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \ -- cgit v1.2.1 From 51a23283fb93e44a77e397912ff3a28b36ff1135 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Sun, 28 Aug 2022 18:44:44 +0200 Subject: Fix typo, check for PYTHON_PLATFORM_SITE_PKG not PYTHON_SITE_PKG --- m4/ax_python_devel.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/m4/ax_python_devel.m4 b/m4/ax_python_devel.m4 index eabfeeb..6a74f29 100644 --- a/m4/ax_python_devel.m4 +++ b/m4/ax_python_devel.m4 @@ -67,7 +67,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 25 +#serial 26 AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL]) AC_DEFUN([AX_PYTHON_DEVEL],[ @@ -322,7 +322,7 @@ print(sitedir)"` # Check for platform-specific site packages # AC_MSG_CHECKING([for Python platform specific site-packages path]) - if test -z "$PYTHON_SITE_PKG"; then + if test -z "$PYTHON_PLATFORM_SITE_PKG"; then if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c " $IMPORT_SYSCONFIG; -- cgit v1.2.1 From 2f9fe41516189695ddc1e469ba3530432255919d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastien=20Roucari=C3=A8s?= Date: Mon, 29 Aug 2022 19:05:23 +0000 Subject: Add more python version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a few python version 3.12 3.11 3.10 Signed-off-by: Bastien Roucariès --- m4/ax_python.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/m4/ax_python.m4 b/m4/ax_python.m4 index 7c9f511..68dd655 100644 --- a/m4/ax_python.m4 +++ b/m4/ax_python.m4 @@ -50,12 +50,12 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 19 +#serial 20 AC_DEFUN([AX_PYTHON], [AC_MSG_CHECKING(for python build information) AC_MSG_RESULT([]) -for python in python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python; do +for python in python3.12 python3.11 python3.10 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python; do AC_CHECK_PROGS(PYTHON_BIN, [$python]) ax_python_bin=$PYTHON_BIN if test x$ax_python_bin != x; then -- cgit v1.2.1