Bug 1947468

Summary: RHEL 9: %{python3_sitelib} and %{python3_sitearch} use the distutils module, deprecated in Python 3.10+
Product: Red Hat Enterprise Linux 9 Reporter: Miro Hrončok <mhroncok>
Component: python-rpm-macrosAssignee: Miro Hrončok <mhroncok>
Status: CLOSED NEXTRELEASE QA Contact: RHEL CS Apps Subsystem QE <rhel-cs-apps-subsystem-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecified   
Target Milestone: beta   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-rpm-macros-3.9-37.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-04 08:53:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1946972    
Bug Blocks: 1950291    

Description Miro Hrončok 2021-04-08 14:17:15 UTC
Currently, we define the following macros:

%python3_sitelib %(%{__python3} -Ic "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
%python3_sitearch %(%{__python3} -Ic "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")

%python_sitelib %(%{__python} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
%python_sitearch %(%{__python} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")

But distutils is deprecated in Python 3.10: https://www.python.org/dev/peps/pep-0632/

We should switch the macros to sysconfig before we introduce Python 3.10+.

A backwards compatible change landed in Fedora Rawhide in https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/96

Let's let it sink in Rawhide for a while and backport it to RHEL 9. I think it is safer to do it before Beta (in case of an unexpected breakage) but this can eventually land even after RHEL 9.0.