From 5ad2b90285566f5dcf663f812e52a5c2537b827d31095d06b1dc11b2d09c7667 Mon Sep 17 00:00:00 2001 From: Jan Matejek Date: Thu, 9 Mar 2017 14:13:38 +0000 Subject: [PATCH 1/2] Accepting request 477966 from devel:languages:python:singlespec - update for multipython build OBS-URL: https://build.opensuse.org/request/show/477966 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Cython?expand=0&rev=81 --- python-Cython.changes | 5 ++++ python-Cython.spec | 70 ++++++++++++++++++++----------------------- 2 files changed, 37 insertions(+), 38 deletions(-) diff --git a/python-Cython.changes b/python-Cython.changes index 78c58e5..a4d4f00 100644 --- a/python-Cython.changes +++ b/python-Cython.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Dec 19 17:49:22 UTC 2016 - jmatejek@suse.com + +- update for multipython build + ------------------------------------------------------------------- Fri Oct 28 12:40:24 UTC 2016 - toddrme2178@gmail.com diff --git a/python-Cython.spec b/python-Cython.spec index 7f8aee1..333aa20 100644 --- a/python-Cython.spec +++ b/python-Cython.spec @@ -1,7 +1,7 @@ # # spec file for package python-Cython # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,6 +16,8 @@ # +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +%define oldpython python Name: python-Cython Version: 0.25.1 Release: 0 @@ -26,20 +28,22 @@ Group: Development/Languages/Python Source: https://files.pythonhosted.org/packages/source/C/Cython/Cython-%{version}.tar.gz Source1: python-Cython-rpmlintrc BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: %{python_module devel} +BuildRequires: %{python_module xml} BuildRequires: fdupes BuildRequires: gcc-c++ -BuildRequires: python-devel -BuildRequires: python-xml +BuildRequires: python-rpm-macros Requires: python-devel Requires: python-xml Requires(post): update-alternatives Requires(postun): update-alternatives -Provides: python-cython = %{version} -Obsoletes: python-cython < %{version} -%if 0%{?suse_version} && 0%{?suse_version} <= 1110 -%{!?python_sitearch: %global python_sitearch %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} +%ifpython2 +Provides: %{oldpython}-cython = %{version} +Obsoletes: %{oldpython}-cython < %{version} %endif +%python_subpackages + %description The Cython language makes writing C extensions for the Python language as easy as Python itself. Cython is a source code translator based on the @@ -63,58 +67,48 @@ sed -i "s|^#!.*||" Cython/Debugger/{libpython,Cygdb}.py cython.py 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 +export CFLAGS="%{optflags}" +%python_build %install -python setup.py install --prefix=%{_prefix} --root=%{buildroot} - +%{python_expand %$python_install # Prepare for update-alternatives usage mkdir -p %{buildroot}%{_sysconfdir}/alternatives for p in cython cythonize cygdb ; do - mv %{buildroot}%{_bindir}/$p %{buildroot}%{_bindir}/$p-%{py_ver} - ln -s -f %{_sysconfdir}/alternatives/$p %{buildroot}%{_bindir}/$p + mv %{buildroot}%{_bindir}/$p %{buildroot}%{_bindir}/$p-%{$python_bin_suffix} +done +} +for p in cython cythonize cygdb ; do + %prepare_alternative $p done -%fdupes -s %{buildroot}%{python_sitearch} %{buildroot}%{_docdir} -rm -rf %{buildroot}%{python_sitearch}/__pycache__/ +%{python_expand %fdupes -s %{buildroot}%{$python_sitearch}} +%fdupes %{buildroot}%{_docdir} %post -%_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} +%{python_install_alternative cython} \ + --slave %{_bindir}/cythonize cythonize %{_bindir}/cythonize-%{python_bin_suffix} \ + --slave %{_bindir}/cygdb cygdb %{_bindir}/cygdb-%{python_bin_suffix} %postun -if [ $1 -eq 0 ] ; then - %_sbindir/update-alternatives --remove cython %{_bindir}/cython-%{py_ver} -fi +%python_uninstall_alternative cython %check -%if 0%{?suse_version} && 0%{?suse_version} <= 1140 -sed -i.SLES11.SP4.bak -e 's/const char/char/' ./tests/run/cpdef_extern_func.pyx -#mv ./tests/run/cpdef_extern_func.pxd ./tests/run/cpdef_extern_func.pxd.TNT.txt -#mv ./tests/run/cpdef_extern_func.pyx ./tests/run/cpdef_extern_func.pyx.TNT.txt -#sleep 60 -%endif %ifarch x86_64 -python runtests.py -vv +export LANG=en_US.UTF-8 +%python_exec runtests.py -vv %endif -%files +%files %{python_files} %defattr(-,root,root,-) %doc COPYING.txt LICENSE.txt README.txt ToDo.txt USAGE.txt Doc Demos -%{_bindir}/cygdb -%{_bindir}/cython -%{_bindir}/cythonize -%{_bindir}/cygdb-%{py_ver} -%{_bindir}/cython-%{py_ver} -%{_bindir}/cythonize-%{py_ver} -%ghost %{_sysconfdir}/alternatives/cygdb -%ghost %{_sysconfdir}/alternatives/cython -%ghost %{_sysconfdir}/alternatives/cythonize +%python_alternative %{_bindir}/cygdb +%python_alternative %{_bindir}/cython +%python_alternative %{_bindir}/cythonize %{python_sitearch}/Cython/ %{python_sitearch}/Cython-%{version}-py*.egg-info %{python_sitearch}/cython.py* +%pycache_only %{python_sitearch}/__pycache__ %{python_sitearch}/pyximport/ %changelog From 49ee5a5bf0ed6e3f1e400fc62c73cd76ad143500c72ba2623fe01078740a83aa Mon Sep 17 00:00:00 2001 From: Jan Matejek Date: Wed, 15 Mar 2017 15:25:23 +0000 Subject: [PATCH 2/2] OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Cython?expand=0&rev=82 --- python-Cython.spec | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/python-Cython.spec b/python-Cython.spec index 333aa20..d1c7858 100644 --- a/python-Cython.spec +++ b/python-Cython.spec @@ -86,14 +86,18 @@ done %fdupes %{buildroot}%{_docdir} %post -%{python_install_alternative cython} \ - --slave %{_bindir}/cythonize cythonize %{_bindir}/cythonize-%{python_bin_suffix} \ - --slave %{_bindir}/cygdb cygdb %{_bindir}/cygdb-%{python_bin_suffix} +%python_install_alternative cython cythonize cygdb %postun %python_uninstall_alternative cython %check +%if 0%{?suse_version} && 0%{?suse_version} <= 1140 +sed -i.SLES11.SP4.bak -e 's/const char/char/' ./tests/run/cpdef_extern_func.pyx +#mv ./tests/run/cpdef_extern_func.pxd ./tests/run/cpdef_extern_func.pxd.TNT.txt +#mv ./tests/run/cpdef_extern_func.pyx ./tests/run/cpdef_extern_func.pyx.TNT.txt +#sleep 60 +%endif %ifarch x86_64 export LANG=en_US.UTF-8 %python_exec runtests.py -vv