Conditionalize the python2 and python3 builds

This commit is contained in:
David Shea 2018-04-24 09:53:28 -04:00
parent d0527b733b
commit bf1bf084eb

View File

@ -1,8 +1,22 @@
%global srcname requests-ftp
# Disable python3 by default on RHEL < 7
%if 0%{?rhel} && 0%{?rhel} <= 7
%bcond_with python3
%else
%bcond_without python3
%endif
# Diable python2 by default on RHEL > 7 or Fedora > 28
%if 0%{?rhel} > 7 || 0%{?fedora} > 28
%bcond_with python2
%else
%bcond_without python2
%endif
Name: python-%{srcname}
Version: 0.3.1
Release: 9%{?dist}
Release: 10%{?dist}
Summary: FTP transport adapter for python-requests
License: ASL 2.0
@ -15,6 +29,7 @@ BuildArch: noarch
Requests-FTP is an implementation of a very stupid FTP transport adapter for
use with the awesome Requests Python library.
%if %{with python2}
%package -n python2-%{srcname}
Summary: FTP transport adapter for python-requests
%{?python_provide:%python_provide python2-%{srcname}}
@ -29,7 +44,9 @@ Requests-FTP is an implementation of a very stupid FTP transport adapter for
use with the awesome Requests Python library.
This is the Python 2 version of the transport adapter module.
%endif
%if %{with python3}
%package -n python3-%{srcname}
Summary: FTP transport adapter for python3-requests
%{?python_provide:%python_provide python3-%{srcname}}
@ -44,32 +61,50 @@ Requests-FTP is an implementation of a very stupid FTP transport adapter for
use with the awesome Requests Python library.
This is the Python 3 version of the transport adapter module.
%endif
%prep
%autosetup -n %{srcname}-%{version}
rm -rf requests_ftp.egg-info
%build
%if %{with python2}
%py2_build
%endif
%if %{with python3}
%py3_build
%endif
%install
%if %{with python2}
%py2_install
%py3_install
%endif
%if %{with python3}
%py3_install
%endif
%if %{with python2}
%files -n python2-%{srcname}
%doc README.rst
%license LICENSE
%{python2_sitelib}/requests_ftp/
%{python2_sitelib}/requests_ftp*.egg-info*
%endif
%if %{with python3}
%files -n python3-%{srcname}
%doc README.rst
%license LICENSE
%{python3_sitelib}/requests_ftp/
%{python3_sitelib}/requests_ftp*.egg-info*
%endif
%changelog
* Tue Apr 24 2018 David Shea <dshea@redhat.com> - 0.3.1-10
- Conditionalize the python2 and python3 builds
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild