Accepting request 206907 from home:posophe:branches:devel:languages:python

Update + update-alternatives

OBS-URL: https://build.opensuse.org/request/show/206907
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-zope.testrunner?expand=0&rev=9
This commit is contained in:
Denisart Benjamin 2013-11-14 15:46:08 +00:00 committed by Git OBS Bridge
parent 99372b7949
commit 7ee286cf51
2 changed files with 25 additions and 1 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Nov 14 15:45:40 UTC 2013 - p.drouand@gmail.com
- Add update-alternative support
-------------------------------------------------------------------
Wed Nov 13 13:08:41 UTC 2013 - p.drouand@gmail.com

View File

@ -35,6 +35,8 @@ BuildRequires: unzip
#BuildRequires: python-unittest2
#BuildRequires: python-zope.interface
#BuildRequires: python-zope.testing
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%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()")}
@ -47,12 +49,14 @@ This package provides a flexible test runner with layer support.
%prep
%setup -q -n zope.testrunner-%{version}
sed -i "s/zope-testrunner =/zope-testrunner-%{py_ver} =/" setup.py
%build
python setup.py build
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
ln -s %{_bindir}/zope-testrunner-%{py_ver} %{buildroot}%{_bindir}/zope-testrunner
# Remove duplicate files
%fdupes -s %{buildroot}%{python_sitelib}
@ -60,10 +64,25 @@ python setup.py install --prefix=%{_prefix} --root=%{buildroot}
#%check
#python setup.py test
%pre
# Since /usr/bin/pybabel became ghosted to be used with update-alternatives, we have to get rid
# of the old binary resulting from the non-update-alternativies-ified package:
[[ ! -L %{_bindir}/zope-testrunner ]] && rm -f %{_bindir}/zope-testrunner
exit 0
%post
update-alternatives --install %{_bindir}/zope-testrunner zope-testrunner %{_bindir}/zope-testrunner-%{py_ver} 20
%preun
if [ $1 -eq 0 ] ; then
update-alternatives --remove zope-testrunner %{_bindir}/zope-testrunner-%{py_ver}
fi
%files
%defattr(-,root,root,-)
%doc LICENSE.rst README.rst
%{_bindir}/zope-testrunner
%ghost %{_bindir}/zope-testrunner
%{_bindir}/zope-testrunner-%{py_ver}
%{python_sitelib}/*
%changelog