remove conditionals and always build for Python 3

This commit is contained in:
Itamar Reis Peixoto 2018-02-15 13:45:47 -02:00
parent 24afbb82d5
commit 2fd17d01b6

View File

@ -1,5 +1,4 @@
%global pypi_name PyMySQL %global pypi_name PyMySQL
%global with_python3 1
Name: python-%{pypi_name} Name: python-%{pypi_name}
Version: 0.8.0 Version: 0.8.0
@ -11,9 +10,14 @@ URL: https://pypi.python.org/pypi/%{pypi_name}/
Source0: https://files.pythonhosted.org/packages/a8/b4/3544c8e6ed9b1c6a00e5b302e3d5a646e43a8a0ac5216f5ae8706688706e/PyMySQL-0.8.0.tar.gz Source0: https://files.pythonhosted.org/packages/a8/b4/3544c8e6ed9b1c6a00e5b302e3d5a646e43a8a0ac5216f5ae8706688706e/PyMySQL-0.8.0.tar.gz
BuildArch: noarch BuildArch: noarch
# for python2
BuildRequires: python2-devel BuildRequires: python2-devel
BuildRequires: python2-setuptools BuildRequires: python2-setuptools
# for python3
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
%description %description
This package contains a pure-Python MySQL client library. The goal of PyMySQL is This package contains a pure-Python MySQL client library. The goal of PyMySQL is
@ -30,18 +34,14 @@ This package contains a pure-Python MySQL client library. The goal of PyMySQL is
to be a drop-in replacement for MySQLdb and work on CPython, PyPy, IronPython to be a drop-in replacement for MySQLdb and work on CPython, PyPy, IronPython
and Jython. and Jython.
%if 0%{?with_python3}
%package -n python3-%{pypi_name} %package -n python3-%{pypi_name}
Summary: Pure-Python MySQL client library Summary: Pure-Python MySQL client library
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}} %{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}}
%description -n python3-%{pypi_name} %description -n python3-%{pypi_name}
This package contains a pure-Python MySQL client library. The goal of PyMySQL is This package contains a pure-Python MySQL client library. The goal of PyMySQL is
to be a drop-in replacement for MySQLdb and work on CPython, PyPy, IronPython to be a drop-in replacement for MySQLdb and work on CPython, PyPy, IronPython
and Jython. and Jython.
%endif
%prep %prep
@ -51,9 +51,7 @@ rm -rf %{pypi_name}.egg-info
%build %build
%py2_build %py2_build
%if 0%{?with_python3}
%py3_build %py3_build
%endif
%install %install
@ -63,13 +61,11 @@ for lib in %{buildroot}%{python2_sitelib}/pymysql/tests/thirdparty/test_MySQLdb/
sed -i '1{\@^#!/usr/bin/env python@d}' $lib sed -i '1{\@^#!/usr/bin/env python@d}' $lib
done done
%if 0%{?with_python3}
%py3_install %py3_install
# Remove shebang # Remove shebang
for lib in %{buildroot}%{python3_sitelib}/pymysql/tests/thirdparty/test_MySQLdb/*.py; do for lib in %{buildroot}%{python3_sitelib}/pymysql/tests/thirdparty/test_MySQLdb/*.py; do
sed -i '1{\@^#!/usr/bin/env python@d}' $lib sed -i '1{\@^#!/usr/bin/env python@d}' $lib
done done
%endif
%check %check
@ -82,18 +78,16 @@ done
%{python2_sitelib}/%{pypi_name}-%{version}-py%{python2_version}.egg-info/ %{python2_sitelib}/%{pypi_name}-%{version}-py%{python2_version}.egg-info/
%{python2_sitelib}/pymysql/ %{python2_sitelib}/pymysql/
%if 0%{?with_python3}
%files -n python3-%{pypi_name} %files -n python3-%{pypi_name}
%license LICENSE %license LICENSE
%doc README.rst %doc README.rst
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info/ %{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info/
%{python3_sitelib}/pymysql/ %{python3_sitelib}/pymysql/
%endif
%changelog %changelog
* Thu Feb 15 2018 Itamar Reis Peixoto <itamar@ispbrasil.com.br> - 0.8.0-4 * Thu Feb 15 2018 Itamar Reis Peixoto <itamar@ispbrasil.com.br> - 0.8.0-4
- make spec file compatible with epel7 - make spec file compatible with epel7
- remove conditionals and always build for Python 3
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.0-3 * Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild