Hi Stefano, I'm not aware of anyone else using posix_local.
Well, I don't know how to check for the deb_system scheme being present, so I made the assumption. How does this change look? Are the descriptions correct? I also pulled out the common "scheme-setting" code into a variable. Thanks, Karl ----------------------------------------------------------------------------- python: use deb_system instead of posix_local if prefix = /usr. Continuing with https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54412. * m4/python.m4 (AM_PATH_PYTHON) <am_python_setup_scheme>: factor out common scheme-related code to this new variable. If the scheme is posix_local and the prefix is /usr, use deb_system (for Debian package builds). * NEWS: more explanations (and unrelated references, en passant). diff --git a/NEWS b/NEWS index 2b2da0908..153cb7733 100644 @@ -67,10 +70,15 @@ New in 1.17: - Compiling Python modules with Python 3.5+ uses multiple optimization levels. (bug#38043) - - The installation directory for Python files again defaults to - "site-packages" under the usual installation prefix, even on systems - (generally Debian-based) that would normally use the "dist-packages" - subdirectory under /usr/local. (bug#54412, bug#64837) + - If the Python installation "scheme" is set to posix_local (Debian), + it is reset to either deb_system (if the prefix = /usr), or + posix_prefix (otherwise). (bug#54412, bug#64837) + + - As a result of the Python scheme change, the installation directory + for Python files again defaults to "site-packages" under the usual + installation prefix, even on systems (generally Debian-based) that + would normally use the "dist-packages" subdirectory under + /usr/local. - When compiling Emacs Lisp files, emacs is run with --no-site-file to disable user config files that might hang or access the terminal; diff --git a/m4/python.m4 b/m4/python.m4 index f90c73d93..0b1db2689 100644 --- a/m4/python.m4 +++ b/m4/python.m4 @@ -237,7 +237,21 @@ try: if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7': can_use_sysconfig = 0 except ImportError: - pass" + pass" # end of am_python_setup_sysconfig + + # More repeated code, for figuring out the installation scheme to use. + am_python_setup_scheme="if hasattr(sysconfig, 'get_default_scheme'): + scheme = sysconfig.get_default_scheme() + else: + scheme = sysconfig._get_default_scheme() + if scheme == 'posix_local': + if '$am_py_prefix' == '/usr': + scheme = 'deb_system' # should only happen during Debian package builds + else: + # Debian's default scheme installs to /usr/local/ but we want to + # follow the prefix, as we always have. + # See bugs#54412, #64837, et al. + scheme = 'posix_prefix'" # end of am_python_setup_scheme dnl emacs-page Set up 4 directories: @@ -258,15 +272,7 @@ except ImportError: $am_python_setup_sysconfig if can_use_sysconfig: try: - 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 - # follow the prefix, as we always have. - # See bugs#54412, #64837, et al. - scheme = 'posix_prefix' + $am_python_setup_scheme sitedir = sysconfig.get_path('purelib', scheme, vars={'base':'$am_py_prefix'}) except: sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) @@ -300,6 +306,7 @@ sys.stdout.write(sitedir)"` dnl 3. pyexecdir: directory for installing python extension modules dnl (shared libraries). dnl Query sysconfig or distutils for this directory. + dnl Much of this is the same as for prefix setup above. dnl AC_CACHE_CHECK([for $am_display_PYTHON extension module directory (pyexecdir)], [am_cv_python_pyexecdir], @@ -312,13 +319,7 @@ sys.stdout.write(sitedir)"` $am_python_setup_sysconfig if can_use_sysconfig: try: - if hasattr(sysconfig, 'get_default_scheme'): - scheme = sysconfig.get_default_scheme() - else: - scheme = sysconfig._get_default_scheme() - if scheme == 'posix_local': - # See scheme comments above. - scheme = 'posix_prefix' + $am_python_setup_scheme sitedir = sysconfig.get_path('platlib', scheme, vars={'platbase':'$am_py_exec_prefix'}) except: sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_exec_prefix'}) compile finished at Sat Jan 20 14:31:01 2024