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