Add provides and symbolic links for compatibility with platform-python

Resolves: RHEL-27855
This commit is contained in:
Lumir Balhar 2024-03-04 15:23:09 +01:00
parent d3e4f80070
commit 5d12698d82

View File

@ -17,7 +17,7 @@ URL: https://www.python.org/
#global prerel ... #global prerel ...
%global upstream_version %{general_version}%{?prerel} %global upstream_version %{general_version}%{?prerel}
Version: %{general_version}%{?prerel:~%{prerel}} Version: %{general_version}%{?prerel:~%{prerel}}
Release: 1%{?dist} Release: 2%{?dist}
License: Python-2.0.1 License: Python-2.0.1
@ -153,6 +153,14 @@ Provides: bundled(python3dist(packaging)) = 23
%bcond_with valgrind %bcond_with valgrind
%endif %endif
# In RHEL 9+, we obsolete/provide Platform Python from regular Python
# This is only appropriate for the main Python build
%if 0%{?rhel} >= 9 && %{with main_python}
%bcond_without rhel8_compat_shims
%else
%bcond_with rhel8_compat_shims
%endif
# ===================== # =====================
# General global macros # General global macros
# ===================== # =====================
@ -434,6 +442,12 @@ Provides: python%{pybasever}%{?_isa} = %{version}-%{release}
Recommends: %{_bindir}/python Recommends: %{_bindir}/python
%endif %endif
%if %{with rhel8_compat_shims}
Provides: platform-python = %{version}-%{release}
Provides: platform-python%{?_isa} = %{version}-%{release}
Obsoletes: platform-python < %{pybasever}
%endif
# Python interpreter packages used to be named (or provide) name pythonXY (e.g. # Python interpreter packages used to be named (or provide) name pythonXY (e.g.
# python39). However, to align it with the executable names and to prepare for # python39). However, to align it with the executable names and to prepare for
# Python 3.10, they were renamed to pythonX.Y (e.g. python3.9, python3.10). We # Python 3.10, they were renamed to pythonX.Y (e.g. python3.9, python3.10). We
@ -582,6 +596,12 @@ Provides: 2to3 = %{version}-%{release}
Conflicts: %{pkgname} < %{version}-%{release} Conflicts: %{pkgname} < %{version}-%{release}
%if %{with rhel8_compat_shims}
Provides: platform-python-devel = %{version}-%{release}
Provides: platform-python-devel%{?_isa} = %{version}-%{release}
Obsoletes: platform-python-devel < %{pybasever}
%endif
%description -n %{pkgname}-devel %description -n %{pkgname}-devel
This package contains the header files and configuration needed to compile This package contains the header files and configuration needed to compile
Python extension modules (typically written in C or C++), to embed Python Python extension modules (typically written in C or C++), to embed Python
@ -677,6 +697,12 @@ Requires: %{pkgname}-idle%{?_isa} = %{version}-%{release}
%unversioned_obsoletes_of_python3_X_if_main debug %unversioned_obsoletes_of_python3_X_if_main debug
%if %{with rhel8_compat_shims}
Provides: platform-python-debug = %{version}-%{release}
Provides: platform-python-debug%{?_isa} = %{version}-%{release}
Obsoletes: platform-python-debug < %{pybasever}
%endif
%description -n %{pkgname}-debug %description -n %{pkgname}-debug
python3-debug provides a version of the Python runtime with numerous debugging python3-debug provides a version of the Python runtime with numerous debugging
features enabled, aimed at advanced Python users such as developers of Python features enabled, aimed at advanced Python users such as developers of Python
@ -1106,6 +1132,25 @@ ln -s ./python3-debug %{buildroot}%{_bindir}/python-debug
%endif %endif
%endif %endif
%if %{with rhel8_compat_shims}
# Provide RHEL8 backwards compatible symbolic links in %%_libexecdir
mkdir -p %{buildroot}%{_libexecdir}
ln -s %{_bindir}/python%{pybasever} %{buildroot}%{_libexecdir}/platform-python
ln -s %{_bindir}/python%{pybasever} %{buildroot}%{_libexecdir}/platform-python%{pybasever}
ln -s %{_bindir}/python%{pybasever}-config %{buildroot}%{_libexecdir}/platform-python-config
ln -s %{_bindir}/python%{pybasever}-config %{buildroot}%{_libexecdir}/platform-python%{pybasever}-config
ln -s %{_bindir}/python%{pybasever}-`uname -m`-config %{buildroot}%{_libexecdir}/platform-python%{pybasever}-`uname -m`-config
# There were also executables with %%{LDVERSION_optimized} in RHEL 8,
# but since Python 3.8 %%{LDVERSION_optimized} == %%{pybasever}.
# We list both in the %%files section to assert this.
%if %{with debug_build}
ln -s %{_bindir}/python%{LDVERSION_debug} %{buildroot}%{_libexecdir}/platform-python-debug
ln -s %{_bindir}/python%{LDVERSION_debug} %{buildroot}%{_libexecdir}/platform-python%{LDVERSION_debug}
ln -s %{_bindir}/python%{LDVERSION_debug}-config %{buildroot}%{_libexecdir}/platform-python%{LDVERSION_debug}-config
ln -s %{_bindir}/python%{LDVERSION_debug}-`uname -m`-config %{buildroot}%{_libexecdir}/platform-python%{LDVERSION_debug}-`uname -m`-config
%endif
%endif
# Remove large, autogenerated sources and keep only the non-optimized pycache # Remove large, autogenerated sources and keep only the non-optimized pycache
for file in %{buildroot}%{pylibdir}/pydoc_data/topics.py $(grep --include='*.py' -lr %{buildroot}%{pylibdir}/encodings -e 'Python Character Mapping Codec .* from .* with gencodec.py'); do for file in %{buildroot}%{pylibdir}/pydoc_data/topics.py $(grep --include='*.py' -lr %{buildroot}%{pylibdir}/encodings -e 'Python Character Mapping Codec .* from .* with gencodec.py'); do
directory=$(dirname ${file}) directory=$(dirname ${file})
@ -1213,6 +1258,11 @@ CheckPython optimized
%{_bindir}/python%{LDVERSION_optimized} %{_bindir}/python%{LDVERSION_optimized}
%{_mandir}/*/*3* %{_mandir}/*/*3*
%if %{with rhel8_compat_shims}
%{_libexecdir}/platform-python
%{_libexecdir}/platform-python%{pybasever}
%{_libexecdir}/platform-python%{LDVERSION_optimized}
%endif
%if %{with main_python} %if %{with main_python}
%files -n python-unversioned-command %files -n python-unversioned-command
@ -1503,6 +1553,14 @@ CheckPython optimized
%{_libdir}/pkgconfig/python-%{pybasever}.pc %{_libdir}/pkgconfig/python-%{pybasever}.pc
%{_libdir}/pkgconfig/python-%{pybasever}-embed.pc %{_libdir}/pkgconfig/python-%{pybasever}-embed.pc
%if %{with rhel8_compat_shims}
%{_libexecdir}/platform-python-config
%{_libexecdir}/platform-python%{pybasever}-config
%{_libexecdir}/platform-python%{LDVERSION_optimized}-config
%{_libexecdir}/platform-python%{pybasever}-*-config
%{_libexecdir}/platform-python%{LDVERSION_optimized}-*-config
%endif
%files -n %{pkgname}-idle %files -n %{pkgname}-idle
%if %{with main_python} %if %{with main_python}
@ -1651,6 +1709,13 @@ CheckPython optimized
%{_libdir}/pkgconfig/python-%{LDVERSION_debug}.pc %{_libdir}/pkgconfig/python-%{LDVERSION_debug}.pc
%{_libdir}/pkgconfig/python-%{LDVERSION_debug}-embed.pc %{_libdir}/pkgconfig/python-%{LDVERSION_debug}-embed.pc
%if %{with rhel8_compat_shims}
%{_libexecdir}/platform-python-debug
%{_libexecdir}/platform-python%{LDVERSION_debug}
%{_libexecdir}/platform-python%{LDVERSION_debug}-config
%{_libexecdir}/platform-python%{LDVERSION_debug}-*-config
%endif
# Analog of the -tools subpackage's files: # Analog of the -tools subpackage's files:
# None for now; we could build precanned versions that have the appropriate # None for now; we could build precanned versions that have the appropriate
# shebang if needed # shebang if needed
@ -1696,6 +1761,10 @@ CheckPython optimized
# ====================================================== # ======================================================
%changelog %changelog
* Mon Mar 04 2024 Lumír Balhar <lbalhar@redhat.com> - 3.12.2-2
- Add provides and symbolic links for compatibility with platform-python
Resolves: RHEL-27855
* Wed Feb 07 2024 Tomáš Hrnčiar <thrnciar@redhat.com> - 3.12.2-1 * Wed Feb 07 2024 Tomáš Hrnčiar <thrnciar@redhat.com> - 3.12.2-1
- Update to 3.12.2 - Update to 3.12.2