1a2e8d
# python2X and python3X are built form the same module, so we need a conditional
1a2e8d
# for python[23] bits the state of the conditional is not important in the spec,
1a2e8d
# it is set in modulemd
1a2e8d
%bcond_without python2
1a2e8d
%bcond_without python3
1a2e8d
1a2e8d
%global srcname Cython
1a2e8d
%global upname cython
1a2e8d
1a2e8d
Name:           Cython
1a2e8d
Version:        0.28.1
1a2e8d
Release:        7%{?dist}
1a2e8d
Summary:        Language for writing Python extension modules
1a2e8d
1a2e8d
License:        ASL 2.0
1a2e8d
URL:            http://www.cython.org
1a2e8d
Source:         https://github.com/cython/cython/archive/%{version}/%{srcname}-%{version}.tar.gz
1a2e8d
1a2e8d
# Replace GCC's attribute optimize("Os") by the better supported and similar (cold).
1a2e8d
# We essentially disable again strict aliasing which makes some compiler warnings
1a2e8d
# go away on python2.
1a2e8d
# Fixed upstream: https://github.com/cython/cython/commit/9ddac7152091eac62830fea4f38b4d7f9edb6a86
1a2e8d
Patch0:         replace-gcc-attribute-os-with-cold.patch
1a2e8d
1a2e8d
BuildRequires:  gcc
1a2e8d
1a2e8d
%global _description \
1a2e8d
This is a development version of Pyrex, a language\
1a2e8d
for writing Python extension modules.
1a2e8d
1a2e8d
%description %{_description}
1a2e8d
1a2e8d
%if %{with python2}
1a2e8d
%package -n python2-%{srcname}
1a2e8d
Summary:        %{summary}
1a2e8d
%{?python_provide:%python_provide python2-%{srcname}}
1a2e8d
Obsoletes:      Cython < 0.28.1-5
1a2e8d
BuildRequires:  python2-devel
1a2e8d
BuildRequires:  python2-setuptools
1a2e8d
1a2e8d
1a2e8d
%description -n python2-%{srcname} %{_description}
1a2e8d
1a2e8d
Python 2 version.
1a2e8d
1a2e8d
%endif
1a2e8d
1a2e8d
%if %{with python3}
1a2e8d
%package -n python3-%{srcname}
1a2e8d
Summary:        %{summary}
1a2e8d
%{?python_provide:%python_provide python3-%{srcname}}
1a2e8d
BuildRequires:  python3-devel
1a2e8d
BuildRequires:  python3-setuptools
1a2e8d
1a2e8d
%description -n python3-%{srcname} %{_description}
1a2e8d
1a2e8d
Python 3 version.
1a2e8d
1a2e8d
%endif
1a2e8d
1a2e8d
%prep
1a2e8d
%autosetup -n %{upname}-%{version} -p1
1a2e8d
1a2e8d
%build
1a2e8d
%{?with_python2:%py2_build}
1a2e8d
%{?with_python3:%py3_build}
1a2e8d
1a2e8d
%install
1a2e8d
# Must do the python3 install first because the scripts in /usr/bin are
1a2e8d
# overwritten with every setup.py install (and we want the python2 version
1a2e8d
# to be the default for now).
1a2e8d
%if %{with python3}
1a2e8d
%py3_install
1a2e8d
for bin in cython cythonize cygdb; do
1a2e8d
  mv %{buildroot}%{_bindir}/${bin} %{buildroot}%{_bindir}/${bin}3
1a2e8d
done
1a2e8d
rm -rf %{buildroot}%{python3_sitelib}/setuptools/tests
1a2e8d
%endif
1a2e8d
1a2e8d
%if %{with python2}
1a2e8d
%py2_install
1a2e8d
for bin in cython cythonize cygdb; do
1a2e8d
  mv %{buildroot}%{_bindir}/${bin} %{buildroot}%{_bindir}/${bin}-%{python2_version}
1a2e8d
  ln -s ${bin}-%{python2_version} $RPM_BUILD_ROOT%{_bindir}/${bin}-2
1a2e8d
done
1a2e8d
rm -rf %{buildroot}%{python2_sitelib}/setuptools/tests
1a2e8d
%endif
1a2e8d
1a2e8d
%if %{with python2}
1a2e8d
%files -n python2-%{srcname}
1a2e8d
%license LICENSE.txt
1a2e8d
%doc *.txt Demos Doc Tools
1a2e8d
%{_bindir}/cython-2
1a2e8d
%{_bindir}/cygdb-2
1a2e8d
%{_bindir}/cythonize-2
1a2e8d
%{_bindir}/cython-%{python2_version}
1a2e8d
%{_bindir}/cygdb-%{python2_version}
1a2e8d
%{_bindir}/cythonize-%{python2_version}
1a2e8d
%{python2_sitearch}/%{srcname}-*.egg-info/
1a2e8d
%{python2_sitearch}/%{srcname}/
1a2e8d
%{python2_sitearch}/pyximport/
1a2e8d
%{python2_sitearch}/%{upname}.py*
1a2e8d
%endif
1a2e8d
1a2e8d
%if %{with python3}
1a2e8d
%files -n python3-%{srcname}
1a2e8d
%license LICENSE.txt
1a2e8d
%doc *.txt Demos Doc Tools
1a2e8d
%{_bindir}/cython3
1a2e8d
%{_bindir}/cythonize3
1a2e8d
%{_bindir}/cygdb3
1a2e8d
%{python3_sitearch}/%{srcname}-*.egg-info/
1a2e8d
%{python3_sitearch}/%{srcname}/
1a2e8d
%{python3_sitearch}/pyximport/
1a2e8d
%{python3_sitearch}/%{upname}.py
1a2e8d
%{python3_sitearch}/__pycache__/%{upname}.*
1a2e8d
%endif
1a2e8d
1a2e8d
%changelog
1a2e8d
* Wed Apr 03 2019 Tomas Orsava <torsava@redhat.com> - 0.28.1-7
1a2e8d
- Bumping due to problems with modular RPM upgrade path
1a2e8d
- Resolves: rhbz#1695587
1a2e8d
1a2e8d
* Wed Dec 12 2018 Charalampos Stratakis <cstratak@redhat.com> - 0.28.1-6
1a2e8d
- Replace GCC's attribute optimize("Os") by the better supported and similar (cold).
1a2e8d
- Resolves: rhbz#1658621
1a2e8d
1a2e8d
* Tue Oct 09 2018 Lumír Balhar <lbalhar@redhat.com> - 0.28.1-5
1a2e8d
- Remove unversioned provides
1a2e8d
- Resolves: rhbz#1628242
1a2e8d
1a2e8d
* Wed Aug 08 2018 Lumír Balhar <lbalhar@redhat.com> - 0.28.1-4
1a2e8d
- Remove unversioned binaries from python2 subpackage
1a2e8d
- Resolves: rhbz#1613343
1a2e8d
1a2e8d
* Wed Aug 01 2018 Lumír Balhar <lbalhar@redhat.com> - 0.28.1-3
1a2e8d
- First version for python27 module