From bf1bf084eb381313f9616263ab6e91a41531ea2c Mon Sep 17 00:00:00 2001 From: David Shea Date: Tue, 24 Apr 2018 09:53:28 -0400 Subject: [PATCH] Conditionalize the python2 and python3 builds --- python-requests-ftp.spec | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/python-requests-ftp.spec b/python-requests-ftp.spec index 579523f..2eb771f 100644 --- a/python-requests-ftp.spec +++ b/python-requests-ftp.spec @@ -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 - 0.3.1-10 +- Conditionalize the python2 and python3 builds + * Fri Feb 09 2018 Fedora Release Engineering - 0.3.1-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild