Fix python2 subpackage build for Fedora < 30 and non-Fedora

Previously, the python2 subpackage was only built when the Fedora version was > 30. This had the opposite effect to what was desired.

This commit changes that, and builds the python2 subpackage on non-Fedora and when Fedora version is < 30.
This commit is contained in:
Javier Peña 2018-10-19 13:53:49 +00:00
parent 88b274dea4
commit 9575159115

View File

@ -1,14 +1,16 @@
%global pypi_name colorama %global pypi_name colorama
%if 0%{?fedora} %if 0%{?fedora} > 29 || 0%{?rhel} > 7
%bcond_with python2
%bcond_without python3 %bcond_without python3
%else %else
%bcond_without python2
%bcond_with python3 %bcond_with python3
%endif %endif
Name: python-%{pypi_name} Name: python-%{pypi_name}
Version: 0.4.0 Version: 0.4.0
Release: 1%{?dist} Release: 2%{?dist}
Summary: Cross-platform colored terminal text Summary: Cross-platform colored terminal text
License: BSD License: BSD
@ -27,7 +29,7 @@ It also provides some shortcuts to help generate ANSI sequences, and works fine
in conjunction with any other ANSI sequence generation library, such as in conjunction with any other ANSI sequence generation library, such as
Termcolor. Termcolor.
%if 0%{?fedora} > 29 %if %{with python2}
%package -n python2-%{pypi_name} %package -n python2-%{pypi_name}
Summary: Cross-platform colored terminal text Summary: Cross-platform colored terminal text
BuildRequires: python2-devel BuildRequires: python2-devel
@ -76,7 +78,7 @@ Python 3 version.
rm -rf *.egg-info rm -rf *.egg-info
%build %build
%if 0%{?fedora} > 29 %if %{with python2}
%py2_build %py2_build
%endif %endif
%if %{with python3} %if %{with python3}
@ -84,14 +86,14 @@ rm -rf *.egg-info
%endif %endif
%install %install
%if 0%{?fedora} > 29 %if %{with python2}
%py2_install %py2_install
%endif %endif
%if %{with python3} %if %{with python3}
%py3_install %py3_install
%endif %endif
%if 0%{?fedora} > 29 %if %{with python2}
%files -n python2-%{pypi_name} %files -n python2-%{pypi_name}
%doc README.rst %doc README.rst
%license LICENSE.txt %license LICENSE.txt
@ -108,6 +110,9 @@ rm -rf *.egg-info
%endif %endif
%changelog %changelog
* Fri Oct 19 2018 Javier Peña <jpena@redhat.com> - 0.4.0-2
- Fix python2 package for non-Fedora
* Fri Oct 19 2018 Matthias Runge <mrunge@redhat.com> - 0.4.0-1 * Fri Oct 19 2018 Matthias Runge <mrunge@redhat.com> - 0.4.0-1
- update to 0.4.0 - update to 0.4.0