use %bcond for python3

It's much easier to switch than changing variables and will be easier
in future to switch.

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
This commit is contained in:
Igor Gnatenko 2017-01-01 21:29:17 +01:00
parent 74d1f684f1
commit 2c938e4b57

View File

@ -1,9 +1,9 @@
%global pypi_name distro
%if 0%{?rhel} && 0%{?rhel} <= 7
%global with_python3 0
%bcond_with python3
%else
%global with_python3 1
%bcond_without python3
%endif
Name: python-%{pypi_name}
@ -47,7 +47,7 @@ Requires: /usr/bin/lsb_release
Python 2 version.
%if 0%{with_python3}
%if %{with python3}
%package -n python3-%{pypi_name}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{pypi_name}}
@ -67,13 +67,13 @@ rm -rf %{pypi_name}.egg-info
%build
%py2_build
%if 0%{with_python3}
%if %{with python3}
%py3_build
%endif
%install
%py2_install
%if 0%{with_python3}
%if %{with python3}
%py3_install
%endif
@ -85,7 +85,7 @@ rm -rf %{pypi_name}.egg-info
%{python2_sitelib}/%{pypi_name}-*.egg-info/
%{python2_sitelib}/%{pypi_name}.py*
%if 0%{with_python3}
%if %{with python3}
%files -n python3-%{pypi_name}
%doc README.rst
#%%license LICENSE