diff --git a/SPECS/python3x-pip.spec b/SPECS/python3x-pip.spec index 7cba56f..cb86a8c 100644 --- a/SPECS/python3x-pip.spec +++ b/SPECS/python3x-pip.spec @@ -16,7 +16,7 @@ Name: python3x-%{srcname} # When updating, update the bundled libraries versions bellow! # You can use vendor_meta.sh in the dist git repo Version: 19.2.3 -Release: 4%{?dist} +Release: 5%{?dist} Summary: A tool for installing and managing Python packages # We bundle a lot of libraries with pip, which itself is under MIT license. @@ -193,6 +193,11 @@ BuildRequires: ca-certificates Requires: ca-certificates Requires: python%{python3_pkgversion}-setuptools +# python38 installs the alternatives master symlink to which we attach a slave +Requires: python38 +Requires(post): python38 +Requires(postun): python38 + # Virtual provides for the packages bundled by pip: %{bundled 3.8} @@ -327,6 +332,10 @@ rm %{buildroot}%{_bindir}/pip rm %{buildroot}%{_bindir}/pip3 rm %{buildroot}%{_bindir}/pip-3 +# All ghost files controlled by alternatives need to exist for the files +# section check to succeed +touch %{buildroot}%{_bindir}/pip3 +touch %{buildroot}%{_bindir}/pip-3 %if %{with tests} @@ -351,6 +360,34 @@ ln -sf %{buildroot}%{_bindir}/pip3 _bin/pip %endif +%post -n python%{python3_pkgversion}-%{srcname} +alternatives --add-slave python3 %{_bindir}/python3.8 \ + %{_bindir}/pip3 \ + pip3 \ + %{_bindir}/pip3.8 +alternatives --add-slave python3 %{_bindir}/python3.8 \ + %{_bindir}/pip-3 \ + pip-3 \ + %{_bindir}/pip-3.8 + +%postun -n python%{python3_pkgversion}-%{srcname} +# Do this only during uninstall process (not during update) +if [ $1 -eq 0 ]; then + # Only remove the slave links if the master link for python3 still exists. + # Due to a possible bug in yum, python38 gets removed before python38-pip + # even though we have declared Requires(postun): python38 + EXISTS=`alternatives --display python3 | \ + grep -c "^/usr/bin/python3.8 - priority [0-9]*"` + + if [ $EXISTS -ne 0 ]; then + alternatives --remove-slave python3 %{_bindir}/python3.8 \ + pip3 + alternatives --remove-slave python3 %{_bindir}/python3.8 \ + pip-3 + fi +fi + + %files -n python%{python3_pkgversion}-%{srcname} %license LICENSE.txt %doc README.rst @@ -363,6 +400,8 @@ ln -sf %{buildroot}%{_bindir}/pip3 _bin/pip %{python3_sitelib}/pip* %dir %{bashcompdir} %{bashcompdir}/pip3.8 +%ghost %{_bindir}/pip3 +%ghost %{_bindir}/pip-3 %if %{with doc} %files doc @@ -378,6 +417,10 @@ ln -sf %{buildroot}%{_bindir}/pip3 _bin/pip %{python_wheeldir}/%{python_wheelname} %changelog +* Mon Mar 09 2020 Tomas Orsava - 19.2.3-5 +- Implement the alternatives system for the executables +- Resolves: rhbz#1807041 + * Fri Dec 13 2019 Tomas Orsava - 19.2.3-4 - Exclude unsupported i686 arch