]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
python: use deb_system instead of posix_local if prefix = /usr.
authorKarl Berry <karl@freefriends.org>
Sat, 20 Jan 2024 22:33:14 +0000 (14:33 -0800)
committerKarl Berry <karl@freefriends.org>
Sat, 20 Jan 2024 22:33:14 +0000 (14:33 -0800)
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).

NEWS
m4/python.m4

diff --git a/NEWS b/NEWS
index 2b2da0908db94485e4656bdfa25abdb8dabd6074..153cb7733941d9ebaebd9c8405377f318a4909a7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -20,10 +20,12 @@ New in 1.17:
   - AM_TEXI2FLAGS may be defined to pass extra flags to TEXI2DVI & TEXI2PDF.
 
   - New option "posix" to emit the special target .POSIX for make.
+    (bug#55025, bug#67891)
 
   - Systems with non-POSIX "rm -f" behavior are now supported, and the
     prior intent to drop support for them has been reversed.
     The ACCEPT_INFERIOR_RM_PROGRAM setting no longer exists.
+    (bug#10828)
 
   - Variables using escaped \# will trigger portability warnings, but be
     retained when appended.  GNU Make & BSD Makes are known to support it.
@@ -40,6 +42,7 @@ New in 1.17:
     (bug#54063)
 
   - The missing script also supports autoreconf, autogen, and perl.
+    (https://lists.gnu.org/archive/html/automake-patches/2015-08/msg00000.html)
 
 * Bugs fixed
 
@@ -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;
index f90c73d9314602d2c753dd96f40b4789803a71af..0b1db2689122afee50b252d9c80a936fb5138922 100644 (file)
@@ -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'})