]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-108819: fix LIBDEST not honoring --with-platlibdir (#133163)
authorFilipe Laíns <lains@riseup.net>
Tue, 9 Dec 2025 19:14:51 +0000 (19:14 +0000)
committerGitHub <noreply@github.com>
Tue, 9 Dec 2025 19:14:51 +0000 (19:14 +0000)
* 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 <lains@riseup.net>
* Add news

Signed-off-by: Filipe Laíns <lains@riseup.net>
* Always set LIBDEST and BINLIBDEST based on PLATLIBDIR

Signed-off-by: Filipe Laíns <lains@riseup.net>
* Add XXX comment on PLATLIBDIR default value

Signed-off-by: Filipe Laíns <lains@riseup.net>
* Regen configure

Signed-off-by: Filipe Laíns <lains@riseup.net>
---------

Signed-off-by: Filipe Laíns <lains@riseup.net>
Makefile.pre.in
Misc/NEWS.d/next/Build/2025-04-29-18-25-34.gh-issue-108819.qMUTRB.rst [new file with mode: 0644]
configure
configure.ac

index 3aaf47ae6068b35597498bee501b851be12200e7..a6beb96d12a3f27e9381199c060456a51a682697 100644 (file)
@@ -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 (file)
index 0000000..e374a86
--- /dev/null
@@ -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``.
index 2fe8186d9fb548db9ab474f55997719809aa2694..a1bc7991aa8dc21fffdf4499d8acf138021da819 100755 (executable)
--- 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; }
 
 
 
+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
 
 
index 25a00ce52e57c9a903f32054a2fcf2bd6db9a545..a284a118f0296fda27e51004c9967c2eb50cae27 100644 (file)
@@ -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])