diff --git a/python3.9.spec b/python3.9.spec index 90ae89b..f4a2049 100644 --- a/python3.9.spec +++ b/python3.9.spec @@ -113,6 +113,15 @@ License: Python %bcond_without legacy_archnames %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 # ===================== @@ -404,6 +413,12 @@ Obsoletes: python%{pybasever} Recommends: %{_bindir}/python %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. # 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 @@ -550,6 +565,12 @@ Conflicts: %{pkgname} < %{version}-%{release} # pygettext.py, msgfmt.py, python-config, python.pc Conflicts: python-devel < 3 +%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 This package contains the header files and configuration needed to compile Python extension modules (typically written in C or C++), to embed Python @@ -626,6 +647,12 @@ Requires: %{pkgname}-idle%{?_isa} = %{version}-%{release} # In Fedora 31, /usr/bin/python-debug was moved here from Python 2. Conflicts: python-debug < 3 +%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 python3-debug provides a version of the Python runtime with numerous debugging features enabled, aimed at advanced Python users such as developers of Python @@ -901,9 +928,7 @@ InstallPython() { # Rename the -devel script that differs on different arches to arch specific name mv %{buildroot}%{_bindir}/python${LDVersion}-{,`uname -m`-}config - echo -e '#!/bin/sh\nexec `dirname $0`/python'${LDVersion}'-`uname -m`-config "$@"' > \ - %{buildroot}%{_bindir}/python${LDVersion}-config - echo '[ $? -eq 127 ] && echo "Could not find python'${LDVersion}'-`uname -m`-config. Look around to see available arches." >&2' >> \ + echo -e '#!/bin/sh\nexec %{_bindir}/python'${LDVersion}'-`uname -m`-config "$@"' > \ %{buildroot}%{_bindir}/python${LDVersion}-config chmod +x %{buildroot}%{_bindir}/python${LDVersion}-config @@ -1083,6 +1108,25 @@ ln -s ./python3-debug %{buildroot}%{_bindir}/python-debug %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 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}) @@ -1192,6 +1236,11 @@ CheckPython optimized %{_bindir}/python%{LDVERSION_optimized} %{_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 %{without flatpackage} @@ -1468,6 +1517,14 @@ CheckPython optimized %{_libdir}/pkgconfig/python-%{pybasever}.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 + %if %{without flatpackage} %files -n %{pkgname}-idle @@ -1634,6 +1691,13 @@ CheckPython optimized %{_libdir}/pkgconfig/python-%{LDVERSION_debug}.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: # None for now; we could build precanned versions that have the appropriate # shebang if needed