Do not build Python 2 subpackage on EL > 7

This commit is contained in:
Iryna Shcherbina 2018-03-16 12:48:57 +01:00
parent 491f209cfb
commit 19a85b3273

View File

@ -6,9 +6,16 @@
%bcond_without python3 %bcond_without python3
%endif %endif
%if 0%{?rhel} > 7
# Disable python2 build by default
%bcond_with python2
%else
%bcond_without python2
%endif
Name: python-%{srcname} Name: python-%{srcname}
Version: 1.4.3 Version: 1.4.3
Release: 5%{?dist} Release: 6%{?dist}
Summary: Transport adapter for using file:// URLs with python-requests Summary: Transport adapter for using file:// URLs with python-requests
License: ASL 2.0 License: ASL 2.0
@ -23,6 +30,7 @@ library to allow local file system access via file:// URLs.
This is the Python 2 version of the requests_file module This is the Python 2 version of the requests_file module
%if %{with python2}
%package -n python2-%{srcname} %package -n python2-%{srcname}
Summary: Transport adapter for using file:// URLs with python-requests Summary: Transport adapter for using file:// URLs with python-requests
%{?python_provide:%python_provide python2-%{srcname}} %{?python_provide:%python_provide python2-%{srcname}}
@ -40,6 +48,7 @@ Requests-File is a transport adapter for use with the Requests Python
library to allow local file system access via file:// URLs. library to allow local file system access via file:// URLs.
This is the Python 2 version of the requests_file module This is the Python 2 version of the requests_file module
%endif
%if %{with python3} %if %{with python3}
%package -n python3-requests-file %package -n python3-requests-file
@ -66,28 +75,36 @@ This is the Python 3 version of the requests_file module
rm -rf requests_file.egg-info rm -rf requests_file.egg-info
%build %build
%if %{with python2}
%py2_build %py2_build
%endif
%if %{with python3} %if %{with python3}
%py3_build %py3_build
%endif %endif
%install %install
%if %{with python2}
%py2_install %py2_install
%endif
%if %{with python3} %if %{with python3}
%py3_install %py3_install
%endif %endif
%check %check
%if %{with python2}
%{__python2} setup.py test %{__python2} setup.py test
%endif
%if %{with python3} %if %{with python3}
%{__python3} setup.py test %{__python3} setup.py test
%endif %endif
%if %{with python2}
%files -n python2-%{srcname} %files -n python2-%{srcname}
%license LICENSE %license LICENSE
%doc README.rst %doc README.rst
%{python2_sitelib}/requests_file.py* %{python2_sitelib}/requests_file.py*
%{python2_sitelib}/requests_file*.egg-info* %{python2_sitelib}/requests_file*.egg-info*
%endif
%if %{with python3} %if %{with python3}
%files -n python3-requests-file %files -n python3-requests-file
@ -99,6 +116,9 @@ rm -rf requests_file.egg-info
%endif %endif
%changelog %changelog
* Fri Mar 16 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1.4.3-6
- Don't build Python 2 subpackage on EL > 7
* Mon Feb 26 2018 Nick Bebout <nb@usi.edu> - 1.4.3-5 * Mon Feb 26 2018 Nick Bebout <nb@usi.edu> - 1.4.3-5
- Add python2- prefix where possible - Add python2- prefix where possible