diff --git a/python-testrepository.changes b/python-testrepository.changes index 338bc66..46441ef 100644 --- a/python-testrepository.changes +++ b/python-testrepository.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Feb 13 13:56:39 UTC 2014 - speilicke@suse.com + +- Implement update-alternatives + ------------------------------------------------------------------- Thu Jan 30 08:59:07 UTC 2014 - dmueller@suse.com diff --git a/python-testrepository.spec b/python-testrepository.spec index c8b49ee..71af665 100644 --- a/python-testrepository.spec +++ b/python-testrepository.spec @@ -28,15 +28,17 @@ BuildRequires: python-devel BuildRequires: python-extras BuildRequires: python-fixtures BuildRequires: python-python-mimeparse -BuildRequires: python-python-subunit +BuildRequires: python-python-subunit >= 0.0.10 BuildRequires: python-setuptools BuildRequires: python-testscenarios -BuildRequires: python-testtools +BuildRequires: python-testtools >= 0.9.30 Requires: python-extras Requires: python-fixtures Requires: python-python-subunit >= 0.0.10 Requires: python-testscenarios Requires: python-testtools >= 0.9.30 +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()")} @@ -59,20 +61,37 @@ subunit or be converted into a subunit stream can be accepted). %prep %setup -q -n testrepository-%{version} +sed -i -e "s|testr = |testr-%{py_ver} = |" \ + -e "s|'testr'|'testr-%{py_ver}'|" setup.py +mv testr testr-%{py_ver} %build python setup.py build %install python setup.py install --prefix=%{_prefix} --root=%{buildroot} +mkdir -p %{buildroot}%{_sysconfdir}/alternatives +touch %{buildroot}%{_sysconfdir}/alternatives/testr +ln -sf %{_sysconfdir}/alternatives/testr %{buildroot}/%{_bindir}/testr %check python setup.py test +%post +update-alternatives \ + --install %{_bindir}/testr testr %{_bindir}/testr-%{py_ver} 20 + +%postun +if [ $1 -eq 0 ] ; then + update-alternatives --remove testr %{_bindir}/testr-%{py_ver} +fi + %files %defattr(-,root,root,-) %doc COPYING NEWS README.txt BSD %{_bindir}/testr +%{_bindir}/testr-%{py_ver} +%ghost %{_sysconfdir}/alternatives/testr %{python_sitelib}/* %changelog