From 7aeb1e4015628d3179e86e7301905af0e1ef2b4c Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Apr 08 2011 20:48:00 +0000 Subject: Cython for EPEL --- diff --git a/Cython.spec b/Cython.spec index 4b16444..bb4a164 100644 --- a/Cython.spec +++ b/Cython.spec @@ -1,11 +1,18 @@ -%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(0)")} -%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} - +%{?el5: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} + +# For EPEL5 make a python26 package. +%if 0%{?rhel} == 5 +%global __python26 %{_bindir}/python2.6 +# Disable byte compiling. Do ourselves later. +%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') +%{!?pydir26: %global pydir26 %{_builddir}/python26-%{name}-%{version}-%{release}} +%{!?python26_sitearch: %global python26_sitearch %(%{__python26} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} +%endif Name: Cython Version: 0.14.1 #Release: 1.beta2%{?dist} -Release: 2%{?dist} +Release: 3%{?dist} Summary: A language for writing Python extension modules #%define upstreamversion %{version}.beta2 @@ -18,7 +25,14 @@ Source: http://www.cython.org/Cython-%{upstreamversion}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: python-devel python-setuptools -Requires: python +%if 0%{?rhel} == 5 +BuildRequires: python26-devel +BuildRequires: python26-distribute +%endif + +%if 0%{?rhel} == 5 +Requires: python(abi) = 2.4 +%endif %description This is a development version of Pyrex, a language @@ -32,18 +46,65 @@ For more info, see: Demos for usage examples +%if 0%{?rhel} == 5 +%package -n python26-Cython +Summary: A language for writing Python extension modules +Group: Development/Libraries +Requires: python(abi) = 2.6 + +%description -n python26-Cython +This is a development version of Pyrex, a language +for writing Python extension modules. + +For more info, see: + + Doc/About.html for a description of the language + INSTALL.txt for installation instructions + USAGE.txt for usage instructions + Demos for usage examples +%endif + %prep %setup -q -n %{name}-%{upstreamversion} +%if 0%{?rhel} == 5 +rm -rf %{pydir26} +mkdir -p %{pydir26} +cp -a * %{pydir26} +%endif + %build %{__python} setup.py build +%if 0%{?rhel} == 5 +pushd %{pydir26} +%{__python26} setup.py build +popd +%endif %install rm -rf $RPM_BUILD_ROOT +%if 0%{?rhel} == 5 +pushd %{pydir26} +%{__python26} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT +popd +pushd $RPM_BUILD_ROOT%{_bindir} +mv cython cython-python26 +mv cygdb cygdb-python26 +popd +%endif + %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT +#On rhel5 we do our own byte compiling that we disabled earlier. +%if 0%{?rhel} == 5 +%{__python} -c 'import compileall; compileall.compile_dir("'"$RPM_BUILD_ROOT"'", 10, "%{python_sitearch}", 1)' > /dev/null +%{__python} -O -c 'import compileall; compileall.compile_dir("'"$RPM_BUILD_ROOT"'", 10, "%{python_sitearch}", 1)' > /dev/null +%{__python26} -c 'import compileall; compileall.compile_dir("'"$RPM_BUILD_ROOT%{python26_sitearch}"'", 10, "%{python26_sitearch}", 1)' > /dev/null +%{__python26} -O -c 'import compileall; compileall.compile_dir("'"$RPM_BUILD_ROOT%{python26_sitearch}"'", 10, "%{python26_sitearch}", 1)' > /dev/null +%endif + %clean rm -rf $RPM_BUILD_ROOT @@ -54,17 +115,34 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) %{_bindir}/cython +#cygdb is not built with python 2.4 or 2.3. +%if 0%{?fedora} || 0%{?rhel} >= 6 %{_bindir}/cygdb +%endif %{python_sitearch}/Cython %{python_sitearch}/cython.py* %{python_sitearch}/pyximport -%if 0%{?fedora} >= 9 +%if 0%{?fedora} >= 9 || 0%{?rhel} >= 6 %{python_sitearch}/Cython*egg-info %endif %doc *.txt Demos Doc Tools +%if 0%{?rhel} == 5 +%files -n python26-Cython +%defattr(-,root,root,-) +%{_bindir}/cython-python26 +%{_bindir}/cygdb-python26 +%{python26_sitearch}/Cython +%{python26_sitearch}/cython.py* +%{python26_sitearch}/pyximport +%{python26_sitearch}/Cython*egg-info +%doc *.txt Demos Doc Tools +%endif %changelog +* Sun Apr 03 2012 Steve Traylen - 0.14.1-3 +- Adapt SPEC file for python3 and python26 on EPEL5. + * Mon Feb 07 2011 Fedora Release Engineering - 0.14.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild