main/python3: Change user install location to /usr/local (to avoid externally-managed)
-
https://packaging.python.org/en/latest/specifications/externally-managed-environments/
-
Set values of base and platbase in sysconfig from /usr to /usr/local when RPM build is not detected to make pip and similar tools install into separate location.
Fedora Change: https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe
We've tried to rework in Fedora 36/Python 3.10 to follow https://bugs.python.org/issue43976 but we have identified serious problems with that approach, see https://bugzilla.redhat.com/2026979 or https://bugzilla.redhat.com/2097183
pypa/distutils integration: https://github.com/pypa/distutils/pull/70
We use the same approach in Ruby and Lua – gem
and luarocks
install packages to /usr/local
by default to not clash with apk-managed packages.
We probably don’t need so complicated way as Fedora because we normally don’t run pip install
inside APKBUILDs.