GNU bug report logs - #54412
[PATCH] python: use the posix_prefix sysconfig scheme on Debian

Previous Next

Package: automake-patches;

Reported by: Stefano Rivera <stefanor <at> debian.org>

Date: Tue, 15 Mar 2022 23:43:02 UTC

Severity: normal

Tags: patch

Done: Karl Berry <karl <at> freefriends.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 54412 in the body.
You can then email your comments to 54412 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to automake-patches <at> gnu.org:
bug#54412; Package automake-patches. (Tue, 15 Mar 2022 23:43:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefano Rivera <stefanor <at> debian.org>:
New bug report received and forwarded. Copy sent to automake-patches <at> gnu.org. (Tue, 15 Mar 2022 23:43:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefano Rivera <stefanor <at> debian.org>
To: automake-patches <at> gnu.org
Cc: Gianfranco Costamagna <locutusofborg <at> debian.org>,
 Stefano Rivera <stefanor <at> debian.org>
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 <at> 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





Information forwarded to automake-patches <at> gnu.org:
bug#54412; Package automake-patches. (Wed, 16 Mar 2022 21:26:01 GMT) Full text and rfc822 format available.

Message #8 received at 54412 <at> debbugs.gnu.org (full text, mbox):

From: Karl Berry <karl <at> freefriends.org>
To: stefanor <at> debian.org
Cc: locutusofborg <at> debian.org, 54412 <at> debbugs.gnu.org
Subject: Re: [bug#54412] [PATCH] python: use the posix_prefix sysconfig scheme
 on Debian
Date: Wed, 16 Mar 2022 15:25:45 -0600
Stefano, Gianfranco - thanks for this. Forgive my ignorance, but I don't
use Debian, or Python, and have never the term "sysconfig scheme" before.

Does your patch change the default behavior of Automake? I gather not,
but ...

Also, it feels like there should be some documentation about this.
Can you write something brief? --thanks, karl.




Information forwarded to automake-patches <at> gnu.org:
bug#54412; Package automake-patches. (Wed, 16 Mar 2022 23:13:02 GMT) Full text and rfc822 format available.

Message #11 received at 54412 <at> debbugs.gnu.org (full text, mbox):

From: stefanor <at> debian.org
To: Karl Berry <karl <at> freefriends.org>
Cc: locutusofborg <at> debian.org, 54412 <at> debbugs.gnu.org
Subject: Re: [bug#54412] [PATCH] python: use the posix_prefix sysconfig
 scheme on Debian
Date: Wed, 16 Mar 2022 23:12:32 +0000
Hi Karl (2022.03.16_21:25:45_+0000)

> Stefano, Gianfranco - thanks for this. Forgive my ignorance, but I don't
> use Debian, or Python, and have never the term "sysconfig scheme" before.
Compare these:

$ python3.9 -m sysconfig
Current installation scheme: "posix_prefix"

Paths: 
        data = "/usr"
        include = "/usr/include/python3.9"
        platinclude = "/usr/include/python3.9"
        platlib = "/usr/lib/python3.9/site-packages"
        platstdlib = "/usr/lib/python3.9"
        purelib = "/usr/lib/python3.9/site-packages"
        scripts = "/usr/bin"
        stdlib = "/usr/lib/python3.9"
...
        prefix = "/usr"
...

To this:
$ python3.10 -m sysconfig
Current installation scheme: "posix_local"

Paths: 
        data = "/usr/local"
        include = "/usr/local/include/python3.10"
        platinclude = "/usr/local/include/python3.10"
        platlib = "/usr/local/lib/python3.10/dist-packages"
        platstdlib = "/usr/lib/python3.10"
        purelib = "/usr/local/lib/python3.10/dist-packages"
        scripts = "/usr/local/bin"
        stdlib = "/usr/lib/python3.10"
...
        prefix = "/usr"
...

The "posix_local" scheme uses {prefix}/local/lib/... That's the issue.

> Does your patch change the default behavior of Automake? I gather not,
> but ...

This patch restores the previous (pre 3.10) behaviour. If you use --prefix
/usr, it installs modules to /usr, with --prefix /usr/local, it installs to
/usr/local.

> Also, it feels like there should be some documentation about this.
> Can you write something brief? --thanks, karl.

I think it shouldn't affect users. If anything needs to be documented, it's:
Automake will select the posix_prefix scheme instead of posix_local, on Debian
Python 3.10+. To install modules into /usr/local, instead of /usr, use --prefix
/usr/local.

SR

-- 
Stefano Rivera
  http://tumbleweed.org.za/
  +1 415 683 3272




Information forwarded to automake-patches <at> gnu.org:
bug#54412; Package automake-patches. (Fri, 18 Mar 2022 13:29:02 GMT) Full text and rfc822 format available.

Message #14 received at 54412 <at> debbugs.gnu.org (full text, mbox):

From: stefanor <at> debian.org
To: Karl Berry <karl <at> freefriends.org>
Cc: locutusofborg <at> debian.org, 54412 <at> debbugs.gnu.org
Subject: Re: [bug#54412] [PATCH] python: use the posix_prefix sysconfig
 scheme on Debian
Date: Fri, 18 Mar 2022 13:28:56 +0000
[Message part 1 (text/plain, inline)]
Hi Karl (2022.03.16_21:25:45_+0000)

Oops, somehow I missed that this patch failed on older versions of
cPython. This version is compatible back to 2.7.4.

SR

-- 
Stefano Rivera
  http://tumbleweed.org.za/
  +1 415 683 3272
[0001-python-use-the-posix_prefix-sysconfig-scheme-on-Debi.patch (text/x-diff, attachment)]

Information forwarded to automake-patches <at> gnu.org:
bug#54412; Package automake-patches. (Tue, 09 Jan 2024 21:48:02 GMT) Full text and rfc822 format available.

Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Bogdan <bogdro_rep <at> gmx.us>
To: automake-patches <at> gnu.org, 54412 <at> debbugs.gnu.org, 64837 <at> debbugs.gnu.org
Subject: [bug#54412] [bug#64837] Fix Python on Debian
Date: Tue, 9 Jan 2024 22:46:51 +0100
[Message part 1 (text/plain, inline)]
Hello.

 Referring to the discussion related to the upcoming release, I
confirm defect #64837 on Debian GNU/Linux 12 (bookworm) and I confirm
that the last patch in #54412 (the one attached in the defect in
Message#14 - https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54412#14,
not the one inlined) fixes the issue.
 I'm also attaching a "double-safe" version, with a simple try-except
added, falling back to the old default, just in case. Also tested,
also fixes the issue.
 You can apply whichever you choose.

--
Regards - Bogdan ('bogdro') D.                 (GNU/Linux & FreeDOS)
X86 assembly (DOS, GNU/Linux):    http://bogdro.evai.pl/index-en.php
Soft(EN): http://bogdro.evai.pl/soft  http://bogdro.evai.pl/soft4asm
www.Xiph.org  www.TorProject.org  www.LibreOffice.org  www.GnuPG.org
[automake-python310-fix-mail.diff (text/x-patch, attachment)]

Information forwarded to automake-patches <at> gnu.org:
bug#54412; Package automake-patches. (Tue, 09 Jan 2024 21:48:02 GMT) Full text and rfc822 format available.

Information forwarded to automake-patches <at> gnu.org:
bug#54412; Package automake-patches. (Wed, 17 Jan 2024 22:49:02 GMT) Full text and rfc822 format available.

Message #23 received at 54412 <at> debbugs.gnu.org (full text, mbox):

From: Karl Berry <karl <at> freefriends.org>
To: stefanor <at> debian.org, locutusofborg <at> debian.org
Cc: 54412 <at> debbugs.gnu.org
Subject: Re: [bug#54412] [PATCH] python: use the posix_prefix sysconfig scheme
 on Debian
Date: Wed, 17 Jan 2024 15:48:30 -0700
Gianfranoc, Stefano - thanks much for the patch wrt Automake and Debian
Python posix_local vs. posix_prefix. Below is what I installed -- the
code change is substantively the same as what you wrote; I just took the
extra try..catch that Bogdan added.

I changed the paragraph in the manual about pythondir. If you could look
at it, that would be great. Is it correct that the basic idea is that,
with this change, Automake again follows --prefix (and related) + using
site-packages instead of Debian's defaults of /usr/local and
dist-packages? --thanks, karl.

-------------------------------------------------------------------------------
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.
diff --git a/NEWS b/NEWS
index c53573a0a..2b2da0908 100644
--- a/NEWS
+++ b/NEWS
+  - 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 <at> 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 <at> 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')

compile finished at Wed Jan 17 14:46:23 2024




Information forwarded to automake-patches <at> gnu.org:
bug#54412; Package automake-patches. (Thu, 18 Jan 2024 00:28:02 GMT) Full text and rfc822 format available.

Message #26 received at 54412 <at> debbugs.gnu.org (full text, mbox):

From: stefanor <at> debian.org
To: Karl Berry <karl <at> freefriends.org>
Cc: locutusofborg <at> debian.org, 54412 <at> debbugs.gnu.org
Subject: Re: [bug#54412] [PATCH] python: use the posix_prefix sysconfig
 scheme on Debian
Date: Thu, 18 Jan 2024 00:27:19 +0000
Hi Karl (2024.01.17_22:48:30_+0000)
> Gianfranoc, Stefano - thanks much for the patch wrt Automake and Debian
> Python posix_local vs. posix_prefix. Below is what I installed -- the
> code change is substantively the same as what you wrote; I just took the
> extra try..catch that Bogdan added.
> 
> I changed the paragraph in the manual about pythondir. If you could look
> at it, that would be great. Is it correct that the basic idea is that,
> with this change, Automake again follows --prefix (and related) + using
> site-packages instead of Debian's defaults of /usr/local and
> dist-packages? --thanks, karl.

Thanks for the review.

You're right about that being a part of this patch. I didn't put much
thought into that bit, because in the context of Debian package builds,
it's inconsequential. (Our Python package tooling will find things that
got installed into site-packages and move them into dist-packages.)

This patch does have the effect of moving the installation destination
from dist-packages to site-packages. But previously (before this patch
was needed) Debian's sysconfig module wasn't patched to know about
dist-packages. So, if we are comparing to that point in time, this is
returning automake behaviour back to what it used to be.

Improving on that gets tricky.

Installs into /usr/local should go into
/usr/local/lib/pythonX.Y/dist-packages.
This is what the posix_local scheme will provide, no matter what prefix
it is specified.

Installs into /usr/ shouldn't happen on a Debian system, outside a
Debian package build. But there, they should go into
/usr/lib/python3/dist-packages.
This is what the deb_system scheme will provide, no matter what prefix
is specified.

Using the posix_prefix scheme was a lazy way to use the prefix, and
restore the old behaviour.

We could special-case both the '/usr' and '/usr/local' prefixes and
select 'posix_local' and 'deb_system' schemes, as appropriate. The logic
would boil down to:

if default_scheme == 'posix_local':  # Debian
   if prefix == '/usr':
       scheme = 'deb_system'  # Should only happen during Debian package builds
   elif prefix != '/usr/local':
       scheme = 'posix_prefix'

How does that sound?

Stefano

-- 
Stefano Rivera
  http://tumbleweed.org.za/
  +1 415 683 3272




Information forwarded to automake-patches <at> gnu.org:
bug#54412; Package automake-patches. (Thu, 18 Jan 2024 22:59:01 GMT) Full text and rfc822 format available.

Message #29 received at 54412 <at> debbugs.gnu.org (full text, mbox):

From: Karl Berry <karl <at> freefriends.org>
To: stefanor <at> debian.org
Cc: locutusofborg <at> debian.org, 54412 <at> debbugs.gnu.org
Subject: Re: [bug#54412] [PATCH] python: use the posix_prefix sysconfig
 scheme on Debian
Date: Thu, 18 Jan 2024 15:58:30 -0700
Hi Stefano,

    returning automake behaviour back to what it used to be.

That seems like a good outcome to me. I wasn't actually looking to
improve on that result :).

    if default_scheme == 'posix_local':  # Debian

posix_local only exists on Debian, not any other system?
The name is generic.

In any case, I guess it would be safe if it's possible to check if the
deb_system scheme exists, and only do the special casing if both
posix_local and deb_system are present.

Wdyt? --thanks, karl.




Information forwarded to automake-patches <at> gnu.org:
bug#54412; Package automake-patches. (Thu, 18 Jan 2024 23:30:02 GMT) Full text and rfc822 format available.

Message #32 received at 54412 <at> debbugs.gnu.org (full text, mbox):

From: stefanor <at> debian.org
To: Karl Berry <karl <at> freefriends.org>
Cc: locutusofborg <at> debian.org, 54412 <at> debbugs.gnu.org
Subject: Re: [bug#54412] [PATCH] python: use the posix_prefix sysconfig
 scheme on Debian
Date: Thu, 18 Jan 2024 23:29:28 +0000
Hi Karl (2024.01.18_22:58:30_+0000)
>     if default_scheme == 'posix_local':  # Debian
> 
> posix_local only exists on Debian, not any other system?
> The name is generic.

Yes, it's a Debianism. It was the best way to get "setup.py install" to
direct to /usr/local by default, on Debian systems, at the time. And
we've had to carry that API since.

> In any case, I guess it would be safe if it's possible to check if the
> deb_system scheme exists, and only do the special casing if both
> posix_local and deb_system are present.

Yeah that sounds nice and safe. But I'm not aware of anyone else using
posix_local.

Stefano

-- 
Stefano Rivera
  http://tumbleweed.org.za/
  +1 415 683 3272




Information forwarded to automake-patches <at> gnu.org:
bug#54412; Package automake-patches. (Sat, 20 Jan 2024 22:41:01 GMT) Full text and rfc822 format available.

Message #35 received at 54412 <at> debbugs.gnu.org (full text, mbox):

From: Karl Berry <karl <at> freefriends.org>
To: stefanor <at> debian.org
Cc: locutusofborg <at> debian.org, 54412 <at> debbugs.gnu.org
Subject: Re: [bug#54412] [PATCH] python: use the posix_prefix sysconfig
 scheme on Debian
Date: Sat, 20 Jan 2024 15:40:38 -0700
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




Information forwarded to automake-patches <at> gnu.org:
bug#54412; Package automake-patches. (Tue, 23 Jan 2024 21:51:02 GMT) Full text and rfc822 format available.

Message #38 received at 54412 <at> debbugs.gnu.org (full text, mbox):

From: Karl Berry <karl <at> freefriends.org>
To: stefanor <at> debian.org, 54412 <at> debbugs.gnu.org
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.




Reply sent to Karl Berry <karl <at> freefriends.org>:
You have taken responsibility. (Tue, 23 Jan 2024 21:51:02 GMT) Full text and rfc822 format available.

Notification sent to Stefano Rivera <stefanor <at> debian.org>:
bug acknowledged by developer. (Tue, 23 Jan 2024 21:51:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 21 Feb 2024 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 64 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.