Accepting request 206908 from devel:languages:python

Update + update-alternatives (forwarded request 206907 from posophe)

OBS-URL: https://build.opensuse.org/request/show/206908
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-zope.testrunner?expand=0&rev=5
This commit is contained in:
Tomáš Chvátal 2013-11-15 07:38:21 +00:00 committed by Git OBS Bridge
commit 2c2cc19785
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 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-unittest2
#BuildRequires: python-zope.interface #BuildRequires: python-zope.interface
#BuildRequires: python-zope.testing #BuildRequires: python-zope.testing
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110 %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()")} %{!?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 %prep
%setup -q -n zope.testrunner-%{version} %setup -q -n zope.testrunner-%{version}
sed -i "s/zope-testrunner =/zope-testrunner-%{py_ver} =/" setup.py
%build %build
python setup.py build python setup.py build
%install %install
python setup.py install --prefix=%{_prefix} --root=%{buildroot} python setup.py install --prefix=%{_prefix} --root=%{buildroot}
ln -s %{_bindir}/zope-testrunner-%{py_ver} %{buildroot}%{_bindir}/zope-testrunner
# Remove duplicate files # Remove duplicate files
%fdupes -s %{buildroot}%{python_sitelib} %fdupes -s %{buildroot}%{python_sitelib}
@ -60,10 +64,25 @@ python setup.py install --prefix=%{_prefix} --root=%{buildroot}
#%check #%check
#python setup.py test #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 %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc LICENSE.rst README.rst %doc LICENSE.rst README.rst
%{_bindir}/zope-testrunner %ghost %{_bindir}/zope-testrunner
%{_bindir}/zope-testrunner-%{py_ver}
%{python_sitelib}/* %{python_sitelib}/*
%changelog %changelog