Accepting request 240116 from home:MargueriteSu:branches:devel:languages:python

use update-alternatives, I think link /etc/alternatives/* to /usr/bin/* is the correct way(benoit_monin's SR linked /usr/bin/*-py2.7 to /usr/bin/*), but I'm not sure.

OBS-URL: https://build.opensuse.org/request/show/240116
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Markdown?expand=0&rev=11
This commit is contained in:
Denisart Benjamin 2014-07-10 23:20:55 +00:00 committed by Git OBS Bridge
parent 36df5af298
commit 8f691725b1
2 changed files with 27 additions and 1 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Jul 9 18:12:04 UTC 2014 - i@marguerite.su
- fix conflicts with python3-Markdown
* both use update-alternatives
-------------------------------------------------------------------
Mon May 26 21:40:35 UTC 2014 - hpj@urpla.net

View File

@ -28,6 +28,8 @@ BuildRequires: python-devel
BuildRequires: python-nose
BuildRequires: python-xml
Requires: python-xml
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Provides: python-markdown = %{version}
Obsoletes: python-markdown < %{version}
@ -55,15 +57,33 @@ python setup.py build
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
# update-alternatives
mv %{buildroot}%{_bindir}/markdown_py %{buildroot}%{_bindir}/markdown_py-%{py_ver}
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/markdown_py
ln -sf %{_sysconfdir}/alternatives/markdown_py %{buildroot}%{_bindir}/markdown_py
%if 0%{?suse_version} && 0%{?suse_version} > 1110
%check
python run-tests.py
%endif
%post
update-alternatives \
--install %{_bindir}/markdown_py markdown_py %{_bindir}/markdown_py-%{py_ver} 20
%postun
if [ $1 -eq 0 ] ; then
update-alternatives --remove markdown_py %{_bindir}/markdown_py-%{py_ver}
fi
%files
%defattr(-,root,root,-)
%doc LICENSE.md README.md docs/*
%ghost %{_sysconfdir}/alternatives/markdown_py
%{_bindir}/markdown_py
%{python_sitelib}/*
%{_bindir}/markdown_py-%{py_ver}
%{python_sitelib}/Markdown-%{version}-py%{py_ver}.egg-info
%{python_sitelib}/markdown
%changelog