automake-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[automake-commit] branch master updated: python: use posix_prefix instea


From: Karl Berry
Subject: [automake-commit] branch master updated: python: use posix_prefix instead of posix_local on Debian.
Date: Wed, 17 Jan 2024 17:48:24 -0500

This is an automated email from the git hooks/post-receive script.

karl pushed a commit to branch master
in repository automake.

View the commit online:
https://git.savannah.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=ac64ce260abd4a7e5f6ea72dcdabf191aad9536d

The following commit(s) were added to refs/heads/master by this push:
     new ac64ce260 python: use posix_prefix instead of posix_local on Debian.
ac64ce260 is described below

commit ac64ce260abd4a7e5f6ea72dcdabf191aad9536d
Author: Gianfranco Costamagna <locutusofborg@debian.org>
AuthorDate: Wed Jan 17 14:48:13 2024 -0800

    python: use posix_prefix instead of posix_local on Debian.
    
    From https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54412#17.
    (Patch slightly adapted by Bogdan from original by Gianfranco,
    as posted by Stefano Rivera in message#14.)
    
    * m4/python.m4 (AM_PATH_PYTHON): replace Debian's posix_local
    scheme with posix_prefix.
    * doc/automake.texi (Python) <pythondir>: say a bit more.
    * NEWS: mention this.
---
 NEWS              |  9 +++++++--
 doc/automake.texi | 14 ++++++++++++--
 m4/python.m4      | 32 +++++++++++++++++++++++++++-----
 3 files changed, 46 insertions(+), 9 deletions(-)

diff --git a/NEWS b/NEWS
index c53573a0a..2b2da0908 100644
--- a/NEWS
+++ b/NEWS
@@ -50,7 +50,7 @@ New in 1.17:
     well as a Perl, sleep utility, and filesystem that supports
     sub-second resolution; otherwise, we fall back to one-second
     granularity as before. When everything is supported, a line
-    `Features: subsecond-mtime' is now printed by automake --version
+    "Features: subsecond-mtime" is now printed by automake --version
     and autom4te --version. (bug#64756, bug#67670)
 
   - The default value of $ARFLAGS is now "cr" instead of "cru", to better
@@ -61,12 +61,17 @@ New in 1.17:
     only for compression, not decompression, because of the same system.
     (bug#68151)
 
-  - Dependency files are now empty, instead of '# dummy', for speed.
+  - Dependency files are now empty, instead of "# dummy", for speed.
     (https://lists.gnu.org/archive/html/automake/2022-05/msg00006.html)
 
   - 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)
+
   - When compiling Emacs Lisp files, emacs is run with --no-site-file to
     disable user config files that might hang or access the terminal;
     and -Q is not used, since its support and behavior varies. (bug#58102)
diff --git a/doc/automake.texi b/doc/automake.texi
index c63279a9e..ecefe2dc6 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -7987,8 +7987,18 @@ building Python extensions.
 
 @item pythondir
 @cindex @file{site-packages} Python directory
-The directory name for the @file{site-packages} subdirectory of the
-standard Python install tree.
+@cindex @file{dist-packages} Python directory
+The subdirectory of the Python install tree in which to install Python
+scripts. By default this is, on all systems,
+@file{$PYTHON_PREFIX/lib/python@var{version}/site-packages}, where
+@code{$PYTHON_PREFIX} is described above, and @var{version} is the
+Python version.  (For those knowledgeable about Python installation
+details: systems generally have their own Python installation scheme,
+such as @code{posix_local} on Debian and related (as of
+Python@tie{}3.10), which ends up using a directory named
+@file{dist-packages}; Automake uses the @code{posix_prefix} scheme and
+@file{site-packages}.)
+@c https://bugs.gnu.org/54412 et al.
 
 @item pkgpythondir
 This is the directory under @code{pythondir} that is named after the
diff --git a/m4/python.m4 b/m4/python.m4
index 2de57c52a..f90c73d93 100644
--- a/m4/python.m4
+++ b/m4/python.m4
@@ -243,9 +243,9 @@ except ImportError:
 
   dnl 1. pythondir: where to install python scripts.  This is the
   dnl    site-packages directory, not the python standard library
-  dnl    directory like in previous automake betas.  This behavior
+  dnl    directory as in early automake betas.  This behavior
   dnl    is more consistent with lispdir.m4 for example.
-  dnl Query distutils for this directory.
+  dnl Query sysconfig or distutils (per above) for this directory.
   dnl
   AC_CACHE_CHECK([for $am_display_PYTHON script directory (pythondir)],
   [am_cv_python_pythondir],
@@ -257,7 +257,19 @@ 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'})
+  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'
+    sitedir = sysconfig.get_path('purelib', scheme, 
vars={'base':'$am_py_prefix'})
+  except:
+    sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'})
 else:
   from distutils import sysconfig
   sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix')
@@ -287,7 +299,7 @@ sys.stdout.write(sitedir)"`
 
   dnl 3. pyexecdir: directory for installing python extension modules
   dnl    (shared libraries).
-  dnl Query distutils for this directory.
+  dnl Query sysconfig or distutils for this directory.
   dnl
   AC_CACHE_CHECK([for $am_display_PYTHON extension module directory 
(pyexecdir)],
   [am_cv_python_pyexecdir],
@@ -299,7 +311,17 @@ 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'})
+  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'
+    sitedir = sysconfig.get_path('platlib', scheme, 
vars={'platbase':'$am_py_exec_prefix'})
+  except:
+    sitedir = sysconfig.get_path('platlib', 
vars={'platbase':'$am_py_exec_prefix'})
 else:
   from distutils import sysconfig
   sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_exec_prefix')



reply via email to

[Prev in Thread] Current Thread [Next in Thread]