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 <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>
This commit is contained in:
Filipe Laíns 2025-12-09 19:14:51 +00:00 committed by GitHub
parent b5576d8146
commit 7f497c3c71
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 20 additions and 20 deletions

View 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)

View file

@ -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``.

19
configure generated vendored
View file

@ -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

View 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])