[ At Miro's request, resending this to python-devel so the discussion can be public ]

Hi Miro -

When rebuilding a package to include in a Flatpak, we want to install *everything* under prefix=/app - that includes Python modules. (Paths will be adjusted properly when running the Flatpak.)

For years, the way we did that is by installing a /usr/lib64/python3.10/distutils/distutils.cfg:
===
[install]
prefix=/app
===

This is part of the flatpak-rpm-macros package that gets installed in the buildroot for Flatpak rebuilds

In Fedora 36, this no longer works for 'pip install' - it seems that pip unconditionally uses 'sysconfig' rather than 'distutils' to determine install paths for Python >= 3.10.

I see that you filed https://github.com/pypa/pip/issues/10647 which landed in pip for pip-22, but Fedora 36 / pip-21 this isn't present? And in any case, that seems like it's something for 'sudo pip install' rather than package installation. I actually don't really follow how the Python macros are getting things installed into /usr/lib rather than /usr/local/lib.

Any advice about how we can make the installation into /app work? Hopefully in a future-proof way...

Thanks!!!
Owen