summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorStefano Rivera <stefanor@debian.org>2022-08-28 18:43:54 +0200
committerBastien Roucariès <rouca@debian.org>2022-08-29 19:03:22 +0000
commit7839f7ebd114b1274895c21f1f306df8980a0834 (patch)
tree6352160fd56c6263bbb733e27a33aeacb2068e83 /m4
parent5773790e8b71c12450aa8d1d234a54c44b86b18f (diff)
downloadautoconf-archive-7839f7ebd114b1274895c21f1f306df8980a0834.tar.gz
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).
Diffstat (limited to 'm4')
-rw-r--r--m4/ax_python_devel.m432
1 files 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; \