--- Begin Message ---
Subject: |
[PATCH] python: use the posix_prefix sysconfig scheme on Debian |
Date: |
Tue, 15 Mar 2022 19:30:56 -0400 |
Fixes Debian's bug: https://bugs.debian.org/1006784
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.
Automake 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).
Thank you, Gianfranco Costamagna <locutusofborg@debian.org>, for porting
the patch to automake.
* m4/python.m4: use the posix_prefix sysconfig scheme on Debian
Copyright-paperwork-exempt: yes
---
m4/python.m4 | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/m4/python.m4 b/m4/python.m4
index 6653e4d89..51e050c19 100644
--- a/m4/python.m4
+++ b/m4/python.m4
@@ -255,7 +255,11 @@ except ImportError:
am_cv_python_pythondir=`$PYTHON -c "
$am_python_setup_sysconfig
if can_use_sysconfig:
- sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
+ 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'
+ sitedir = sysconfig.get_path('purelib', scheme,
vars={'base':'$am_py_prefix'})
else:
from distutils import sysconfig
sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
@@ -297,7 +301,11 @@ sys.stdout.write(sitedir)"`
am_cv_python_pyexecdir=`$PYTHON -c "
$am_python_setup_sysconfig
if can_use_sysconfig:
- sitedir = sysconfig.get_path('platlib',
vars={'platbase':'$am_py_exec_prefix'})
+ 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'
+ sitedir = sysconfig.get_path('platlib', scheme,
vars={'platbase':'$am_py_exec_prefix'})
else:
from distutils import sysconfig
sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_exec_prefix')
--
2.35.1
--- End Message ---
--- Begin Message ---
Subject: |
Re: [bug#54412] [PATCH] python: use the posix_prefix sysconfig scheme on Debian |
Date: |
Tue, 23 Jan 2024 14:49:50 -0700 |
Guess it's time to close this one about the Python scheme to use with
Debian. We'll see how it turns out with the next pretest ... --thanks, karl.
--- End Message ---