15
0

Accepting request 419477 from home:TheBlackCat:branches:devel:languages:python

Fix update-alternatives implementation.

OBS-URL: https://build.opensuse.org/request/show/419477
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-lesscpy?expand=0&rev=9
This commit is contained in:
Todd R
2016-08-15 17:14:14 +00:00
committed by Git OBS Bridge
parent e5546baf19
commit 4362497f76
2 changed files with 10 additions and 11 deletions

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Aug 15 14:51:56 UTC 2016 - toddrme2178@gmail.com
- Fix update-alternatives implementation.
-------------------------------------------------------------------
Thu May 7 11:06:21 UTC 2015 - benoit.monin@gmx.fr

View File

@@ -36,7 +36,7 @@ BuildRequires: python-nose
Requires: python-ply
Requires: python-six
Requires(post): update-alternatives
Requires(postun): update-alternatives
Requires(preun): update-alternatives
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
@@ -62,34 +62,28 @@ python setup.py build
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
mv %{buildroot}%{_bindir}/lesscpy{,-%{py_ver}}
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/lesscpy
mv %{buildroot}%{_bindir}/lesscpy %{buildroot}%{_bindir}/lesscpy-%{py_ver}
ln -sf %{_sysconfdir}/alternatives/lesscpy %{buildroot}%{_bindir}/lesscpy
%check
python setup.py -q test
%pre
# Since /usr/bin/lesscpy became ghosted to be used with update-alternatives, we
# have to get rid of the old binary:
[ -h %{_bindir}/lesscpy ] || rm -f %{_bindir}/lesscpy
%post
update-alternatives \
%_sbindir/update-alternatives \
--install %{_bindir}/lesscpy lesscpy %{_bindir}/lesscpy-%{py_ver} 20
%preun
if [ $1 -eq 0 ] ; then
update-alternatives --remove lesscpy %{_bindir}/lesscpy-%{py_ver}
%_sbindir/update-alternatives --remove lesscpy %{_bindir}/lesscpy-%{py_ver}
fi
%files
%defattr(-,root,root,-)
%doc LICENSE README.rst
%ghost %{_sysconfdir}/alternatives/lesscpy
%{_bindir}/lesscpy
%{_bindir}/lesscpy-%{py_ver}
%ghost %{_sysconfdir}/alternatives/lesscpy
%{python_sitelib}/lesscpy
%{python_sitelib}/lesscpy-%{version}-py%{py_ver}.egg-info