Accepting request 845027 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/845027
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pip?expand=0&rev=50
This commit is contained in:
Dominique Leuenberger 2020-11-02 08:39:26 +00:00 committed by Git OBS Bridge
commit c5362853a5
2 changed files with 33 additions and 11 deletions

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Fri Oct 30 00:18:04 UTC 2020 - Benjamin Greiner <code@bnavigator.de>
- Make executables setup compatible with multiple python3 flavors
* gh#openSUSE/python-rpm-macros#66
* update-alternatives for pip3
* use %python_clone and %python_install_alternative for sip and
sip3
* use original bin/sip%{python_bin_suffix} as is
* effect: consistent shebangs and specifiers inside the
entry_point scripts
-------------------------------------------------------------------
Sun Oct 11 13:08:15 UTC 2020 - Benjamin Greiner <code@bnavigator.de>

View File

@ -96,7 +96,10 @@ done
%if ! %{with test}
%install
%python_install
%prepare_alternative pip
%python_clone -a %{buildroot}%{_bindir}/pip
%python_clone -a %{buildroot}%{_bindir}/pip3
# if we just cloned to pip3-2.7 delete it
rm -f %{buildroot}%{_bindir}/pip3-2*
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%endif
@ -121,25 +124,32 @@ donttest+=" or test_from_link_vcs_without_source_dir"
# Since /usr/bin/pip became ghosted to be used with update-alternatives, we have to get rid
# of the old binary resulting from the non-update-alternatives-ified package:
[ -h %{_bindir}/pip ] || rm -f %{_bindir}/pip
[ -h %{_bindir}/pip3 ] || rm -f %{_bindir}/pip3
%post
# can't use `python_install_alternative` because it's pipX.Y, not pip-X.Y
PRIO=$(echo %{python_version} | tr -d .)
%install_alternative pip %{_bindir}/pip%{python_version} $PRIO
# keep the alternative groups separate. Users could decide to let pip and pip3 point to
# different flavors
%python_install_alternative pip
%if "%python_flavor" != "python2"
%python_install_alternative pip3
%endif
%postun
%uninstall_alternative pip %{_bindir}/pip%{python_version}
%python_uninstall_alternative pip
%python_uninstall_alternative pip3
%if ! %{with test}
%files %{python_files}
%license LICENSE.txt
%doc AUTHORS.txt NEWS.rst README.rst
%python3_only %{_bindir}/pip
%{_bindir}/pip%{python_version}
%python2_only %{_bindir}/pip2
%python3_only %{_bindir}/pip3
%ghost %{_sysconfdir}/alternatives/pip
%{python_sitelib}/pip-%{version}-py%{python_version}.egg-info
%python_alternative %{_bindir}/pip
%if "%{python_flavor}" == "python2"
%{_bindir}/pip2
%else
%python_alternative %{_bindir}/pip3
%endif
%{_bindir}/pip%{python_bin_suffix}
%{python_sitelib}/pip-%{version}*-info
%{python_sitelib}/pip
%endif