Accepting request 796056 from devel:languages:python

- Fix using update_alternatives.

OBS-URL: https://build.opensuse.org/request/show/796056
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python2-setuptools?expand=0&rev=2
This commit is contained in:
Dominique Leuenberger 2020-04-22 18:54:39 +00:00 committed by Git OBS Bridge
commit aa6c70d3ac
2 changed files with 22 additions and 5 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Apr 21 11:55:39 UTC 2020 - Matej Cepl <mcepl@suse.com>
- Fix using update_alternatives.
-------------------------------------------------------------------
Tue Apr 7 08:39:25 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>

View File

@ -57,23 +57,35 @@ sed -r -i '1s@^#!/.*$@@' setuptools/command/easy_install.py \
%install
%python2_install
%prepare_alternative easy_install
# update-alternatives
mkdir -p %{buildroot}%{_bindir}
mv %{buildroot}%{_bindir}/easy_install{,-%{python_version}}
mkdir -p %{buildroot}%{_sysconfdir}/alternatives/
touch %{buildroot}%{_sysconfdir}/alternatives/easy_install
ln -sf %{_sysconfdir}/alternatives/easy_install \
%{buildroot}%{_bindir}/easy_install
%fdupes %{buildroot}%{python2_sitelib}
%post
%python_install_alternative easy_install
%{_sbindir}/update-alternatives --install %{_bindir}/easy_install \
easy_install %{_bindir}/easy_install-%{python_version} 27
%postun
%python_uninstall_alternative easy_install
if [ ! -f %{_bindir}/easy_install ] ; then
%{_sbindir}/update-alternatives --remove easy_install %{_bindir}/easy_install-%{python_version}
fi
%files
%license LICENSE
%doc CHANGES.rst README.rst
%python_alternative %{_bindir}/easy_install
%{_bindir}/easy_install*
%{python2_sitelib}/easy_install*
%{python2_sitelib}/setuptools
%{python2_sitelib}/setuptools-%{version}-py*.egg-info
%{python2_sitelib}/easy_install.py*
%dir %{python2_sitelib}/pkg_resources
%{python2_sitelib}/pkg_resources/*
%ghost %_sysconfdir/alternatives/easy_install
%changelog