Another fix of update-alternatives

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python2-setuptools?expand=0&rev=12
This commit is contained in:
Matej Cepl 2020-04-21 12:36:46 +00:00 committed by Git OBS Bridge
parent 615e5f2174
commit b178237d7e

View File

@ -57,14 +57,25 @@ sed -r -i '1s@^#!/.*$@@' setuptools/command/easy_install.py \
%install
%python2_install
%python_clone -a %{buildroot}%{_bindir}/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