Prepare bcond for Python 2 removal

This commit is contained in:
Lumir Balhar 2019-11-06 07:16:11 +01:00
parent 225e9ffad1
commit 8e645873fd

View File

@ -1,3 +1,9 @@
# Prepared for Python 2 removal
%bcond_without python2
# Allow build without test
%bcond_without tests
Name: pytz
Version: 2019.3
Release: 1%{?dist}
@ -25,24 +31,30 @@ Almost all (over 540) of the Olson timezones are supported.
%description %_description
%if %{with python2}
%package -n python2-%{name}
Summary: %summary
%{?python_provide:%python_provide python2-%{name}}
BuildRequires: python2-devel
%if %{with tests}
BuildRequires: python2-pytest
%endif
Requires: tzdata
# Remove before F30
Provides: pytz = %{version}-%{release}
Obsoletes: pytz < %{version}-%{release}
%description -n python2-%{name} %_description
%endif
%package -n python3-%{name}
Summary: %summary
%{?python_provide:%python_provide python3-%{name}}
BuildRequires: python3-devel
%if %{with tests}
BuildRequires: python3-pytest
%endif
Requires: tzdata
%description -n python3-%{name} %_description
@ -53,14 +65,18 @@ Requires: tzdata
%build
%if %{with python2}
%py2_build
%endif
%py3_build
%install
%if %{with python2}
%py2_install
rm -r %{buildroot}%{python2_sitelib}/pytz/zoneinfo
pathfix.py -pn -i %{__python2} %{buildroot}%{python2_sitelib}
%endif
%py3_install
rm -r %{buildroot}%{python3_sitelib}/pytz/zoneinfo
@ -68,15 +84,21 @@ pathfix.py -pn -i %{__python3} %{buildroot}%{python3_sitelib}
%check
%if %{with tests}
%if %{with python2}
PYTHONPATH=%{buildroot}%{python2_sitelib} %{__python2} -m pytest -v
%endif
PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -m pytest -v
%endif
%if %{with python2}
%files -n python2-%{name}
%license LICENSE.txt
%doc README.txt
%{python2_sitelib}/pytz/
%{python2_sitelib}/*.egg-info
%endif
%files -n python3-pytz
%license LICENSE.txt