From 6e06866e8fca27ed8b3f37af424ef78eaf8d3effcc73f87e72a42b1576a6c68f Mon Sep 17 00:00:00 2001
From: Denisart Benjamin
Date: Mon, 9 Feb 2015 16:07:30 +0000
Subject: [PATCH] Accepting request 284215 from home:frispete:python
In case somebody cares..
- fix update-alternatives handling in a distribution backwards compatible way
OBS-URL: https://build.opensuse.org/request/show/284215
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Cython?expand=0&rev=55
---
python-Cython.changes | 5 +++++
python-Cython.spec | 34 ++++++++++++++--------------------
2 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/python-Cython.changes b/python-Cython.changes
index a79f23f..e6e5a6a 100644
--- a/python-Cython.changes
+++ b/python-Cython.changes
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Thu Feb 5 11:35:45 UTC 2015 - hpj@urpla.net
+
+- fix update-alternatives handling in a distribution backwards compatible way
+
-------------------------------------------------------------------
Fri Jan 9 15:20:31 UTC 2015 - dimstar@opensuse.org
diff --git a/python-Cython.spec b/python-Cython.spec
index 75406f3..776e51e 100644
--- a/python-Cython.spec
+++ b/python-Cython.spec
@@ -56,14 +56,10 @@ code.
%prep
%setup -q -n Cython-%{version}
-sed -i "s|^#!.*||" Cython/Debugger/{libpython,Cygdb}.py cython.py # Fix non-executable scripts
-sed -i "s|\r||" Demos/callback/{README.txt,cheesefinder.h} Demos/embed/Makefile.{unix,msc.static} Doc/primes.c # Fix EOL encoding
-mv bin/cython bin/cython-%{py_ver}
-mv bin/cythonize bin/cythonize-%{py_ver}
-mv bin/cygdb bin/cygdb-%{py_ver}
-sed -i "s|bin/cython|bin/cython-%{py_ver}|" setup.py
-sed -i "s|bin/cythonize|bin/cythonize-%{py_ver}|" setup.py
-sed -i "s|bin/cygdb|bin/cygdb-%{py_ver}|" setup.py
+# Fix non-executable scripts
+sed -i "s|^#!.*||" Cython/Debugger/{libpython,Cygdb}.py cython.py
+# Fix EOL encoding
+sed -i "s|\r||" Demos/callback/{README.txt,cheesefinder.h} Demos/embed/Makefile.{unix,msc.static} Doc/primes.c
%build
CFLAGS="%{optflags}" python setup.py build
@@ -72,9 +68,11 @@ CFLAGS="%{optflags}" python setup.py build
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
# Prepare for update-alternatives usage
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
-ln -s -f %{_sysconfdir}/alternatives/cython %{buildroot}%{_bindir}/cython
-ln -s -f %{_sysconfdir}/alternatives/cythonize %{buildroot}%{_bindir}/cythonize
-ln -s -f %{_sysconfdir}/alternatives/cygdb %{buildroot}%{_bindir}/cygdb
+for p in cython cythonize cygdb ; do
+ mv %{buildroot}%{_bindir}/$p %{buildroot}%{_bindir}/$p-%{py_ver}
+ ln -s %{_bindir}/$p-%{py_ver} %{buildroot}%{_bindir}/$p
+ ln -s %{_bindir}/$p-%{py_ver} %{buildroot}%{_sysconfdir}/alternatives/$p
+done
%fdupes -s %{buildroot}%{python_sitearch} %{buildroot}%{_docdir}
rm -rf %{buildroot}%{python_sitearch}/__pycache__/
@@ -84,26 +82,22 @@ rm -rf %{buildroot}%{python_sitearch}/__pycache__/
python runtests.py
%post
-update-alternatives \
+%_sbindir/update-alternatives \
--install %{_bindir}/cython cython %{_bindir}/cython-%{py_ver} 30 \
--slave %{_bindir}/cythonize cythonize %{_bindir}/cythonize-%{py_ver} \
--slave %{_bindir}/cygdb cygdb %{_bindir}/cygdb-%{py_ver}
%preun
if [ $1 -eq 0 ] ; then
- update-alternatives --remove cython %{_bindir}/cython-%{py_ver}
+ %_sbindir/update-alternatives --remove cython %{_bindir}/cython-%{py_ver}
fi
-# Disabled testsuite as it takes a long time:
-#%%check
-#python runtests.py
-
%files
%defattr(-,root,root,-)
%doc COPYING.txt LICENSE.txt README.txt ToDo.txt USAGE.txt Doc Demos
-%{_bindir}/cygdb
-%{_bindir}/cython
-%{_bindir}/cythonize
+%ghost %{_bindir}/cygdb
+%ghost %{_bindir}/cython
+%ghost %{_bindir}/cythonize
%{_bindir}/cygdb-%{py_ver}
%{_bindir}/cython-%{py_ver}
%{_bindir}/cythonize-%{py_ver}