https://github.com/python/cpython/commit/7f497c3c7107feecd9b1e7ff20caac1160a33689
commit: 7f497c3c7107feecd9b1e7ff20caac1160a33689
branch: main
author: Filipe Laíns <[email protected]>
committer: FFY00 <[email protected]>
date: 2025-12-09T19:14:51Z
summary:

GH-108819: fix LIBDEST not honoring --with-platlibdir (#133163)

* GH-108819: fix LIBDEST not honoring --with-platlibdir

We look for the pure-Python part of the standard library in
PLATSTDLIBDIR, which may not match the default LIBDIR subdir.

>From ``getpath.py``:

```python
    ...
    STDLIB_SUBDIR = 
f'{platlibdir}/python{VERSION_MAJOR}.{VERSION_MINOR}{ABI_THREAD}'
    STDLIB_LANDMARKS = [f'{STDLIB_SUBDIR}/os.py', f'{STDLIB_SUBDIR}/os.pyc']
    PLATSTDLIB_LANDMARK = 
f'{platlibdir}/python{VERSION_MAJOR}.{VERSION_MINOR}{ABI_THREAD}/lib-dynload'
    ...
```

Signed-off-by: Filipe Laíns <[email protected]>

* Add news

Signed-off-by: Filipe Laíns <[email protected]>

* Always set LIBDEST and BINLIBDEST based on PLATLIBDIR

Signed-off-by: Filipe Laíns <[email protected]>

* Add XXX comment on PLATLIBDIR default value

Signed-off-by: Filipe Laíns <[email protected]>

* Regen configure

Signed-off-by: Filipe Laíns <[email protected]>

---------

Signed-off-by: Filipe Laíns <[email protected]>

files:
A Misc/NEWS.d/next/Build/2025-04-29-18-25-34.gh-issue-108819.qMUTRB.rst
M Makefile.pre.in
M configure
M configure.ac

diff --git a/Makefile.pre.in b/Makefile.pre.in
index 3aaf47ae6068b3..a6beb96d12a3f2 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -166,7 +166,7 @@ WHEEL_PKG_DIR=      @WHEEL_PKG_DIR@
 
 # Detailed destination directories
 BINLIBDEST=    @BINLIBDEST@
-LIBDEST=       $(SCRIPTDIR)/python$(VERSION)$(ABI_THREAD)
+LIBDEST=       @LIBDEST@
 INCLUDEPY=     $(INCLUDEDIR)/python$(LDVERSION)
 CONFINCLUDEPY= $(CONFINCLUDEDIR)/python$(LDVERSION)
 
diff --git 
a/Misc/NEWS.d/next/Build/2025-04-29-18-25-34.gh-issue-108819.qMUTRB.rst 
b/Misc/NEWS.d/next/Build/2025-04-29-18-25-34.gh-issue-108819.qMUTRB.rst
new file mode 100644
index 00000000000000..e374a86f0bc9a2
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2025-04-29-18-25-34.gh-issue-108819.qMUTRB.rst
@@ -0,0 +1,3 @@
+Honor :option:`--with-platlibdir` in the pure-Python standard library
+installation path, if ``PLATLIBDIR`` doesn't match the value used in
+``LIBDIR``.
diff --git a/configure b/configure
index 2fe8186d9fb548..a1bc7991aa8dc2 100755
--- a/configure
+++ b/configure
@@ -842,8 +842,9 @@ LIBREADLINE_CFLAGS
 WHEEL_PKG_DIR
 LIBPL
 PY_ENABLE_SHARED
-PLATLIBDIR
 BINLIBDEST
+LIBDEST
+PLATLIBDIR
 LIBPYTHON
 MODULE_DEPS_SHARED
 EXT_SUFFIX
@@ -26942,15 +26943,10 @@ if test "$ac_sys_system" = "iOS"; then
   MODULE_DEPS_SHARED="$MODULE_DEPS_SHARED 
\$(PYTHONFRAMEWORKDIR)/\$(PYTHONFRAMEWORK)"
 fi
 
-
-
-BINLIBDEST='$(LIBDIR)/python$(VERSION)$(ABI_THREAD)'
-
-
 # Check for --with-platlibdir
 # /usr/$PLATLIBDIR/python$(VERSION)$(ABI_THREAD)
 
-PLATLIBDIR="lib"
+PLATLIBDIR="lib"  # XXX: We should probably calculate the defauly from libdir, 
if defined.
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for --with-platlibdir" 
>&5
 printf %s "checking for --with-platlibdir... " >&6; }
 
@@ -26967,7 +26963,6 @@ then
   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 printf "%s\n" "yes" >&6; }
   PLATLIBDIR="$withval"
-  BINLIBDEST='${exec_prefix}/${PLATLIBDIR}/python$(VERSION)$(ABI_THREAD)'
 else
   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
 printf "%s\n" "no" >&6; }
@@ -26981,10 +26976,14 @@ fi
 
 
 
+LIBDEST='${prefix}/${PLATLIBDIR}/python$(VERSION)$(ABI_THREAD)'
+BINLIBDEST='${exec_prefix}/${PLATLIBDIR}/python$(VERSION)$(ABI_THREAD)'
+
+
 if test x$PLATFORM_TRIPLET = x; then
-  
LIBPL='$(prefix)'"/${PLATLIBDIR}/python${VERSION}${ABI_THREAD}/config-${LDVERSION}"
+  LIBPL='$(LIBDEST)'"/config-${LDVERSION}"
 else
-  
LIBPL='$(prefix)'"/${PLATLIBDIR}/python${VERSION}${ABI_THREAD}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
+  LIBPL='$(LIBDEST)'"/config-${LDVERSION}-${PLATFORM_TRIPLET}"
 fi
 
 
diff --git a/configure.ac b/configure.ac
index 25a00ce52e57c9..a284a118f0296f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6420,15 +6420,10 @@ if test "$ac_sys_system" = "iOS"; then
   MODULE_DEPS_SHARED="$MODULE_DEPS_SHARED 
\$(PYTHONFRAMEWORKDIR)/\$(PYTHONFRAMEWORK)"
 fi
 
-
-AC_SUBST([BINLIBDEST])
-BINLIBDEST='$(LIBDIR)/python$(VERSION)$(ABI_THREAD)'
-
-
 # Check for --with-platlibdir
 # /usr/$PLATLIBDIR/python$(VERSION)$(ABI_THREAD)
 AC_SUBST([PLATLIBDIR])
-PLATLIBDIR="lib"
+PLATLIBDIR="lib"  # XXX: We should probably calculate the defauly from libdir, 
if defined.
 AC_MSG_CHECKING([for --with-platlibdir])
 AC_ARG_WITH(
   [platlibdir],
@@ -6445,19 +6440,22 @@ if test -n "$withval" -a "$withval" != yes -a 
"$withval" != no
 then
   AC_MSG_RESULT([yes])
   PLATLIBDIR="$withval"
-  BINLIBDEST='${exec_prefix}/${PLATLIBDIR}/python$(VERSION)$(ABI_THREAD)'
 else
   AC_MSG_RESULT([no])
 fi],
 [AC_MSG_RESULT([no])])
 
+AC_SUBST([LIBDEST])
+AC_SUBST([BINLIBDEST])
+LIBDEST='${prefix}/${PLATLIBDIR}/python$(VERSION)$(ABI_THREAD)'
+BINLIBDEST='${exec_prefix}/${PLATLIBDIR}/python$(VERSION)$(ABI_THREAD)'
 
 dnl define LIBPL after ABIFLAGS and LDVERSION is defined.
 AC_SUBST([PY_ENABLE_SHARED])
 if test x$PLATFORM_TRIPLET = x; then
-  
LIBPL='$(prefix)'"/${PLATLIBDIR}/python${VERSION}${ABI_THREAD}/config-${LDVERSION}"
+  LIBPL='$(LIBDEST)'"/config-${LDVERSION}"
 else
-  
LIBPL='$(prefix)'"/${PLATLIBDIR}/python${VERSION}${ABI_THREAD}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
+  LIBPL='$(LIBDEST)'"/config-${LDVERSION}-${PLATFORM_TRIPLET}"
 fi
 AC_SUBST([LIBPL])
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to