Unify Fedora/RHEL py2/py3 logic

This commit is contained in:
John Dennis 2018-07-10 09:35:59 -04:00
parent 18fc733016
commit 5ccbd94440

View File

@ -1,14 +1,21 @@
%if (0%{?fedora} > 0 && 0%{?fedora} < 32) || (0%{?rhel} > 0 && 0%{?rhel} <= 7)
%bcond_without python2
%bcond_without python3
%endif
%if 0%{?fedora} || 0%{?rhel} >= 8
%bcond_with python2
%bcond_without python3
%endif
%if 0%{?el6}%{?el7} %if 0%{?el6}%{?el7}
# python3 and python version related macros # python3 and python version related macros
# required to build python3- subpackage # required to build python3- subpackage
# are not available in el6 and el7 # are not available in el6 and el7
%bcond_with python3
%{!?__python2: %global __python2 %{__python}} %{!?__python2: %global __python2 %{__python}}
%{!?python2_sitelib: %global python2_sitelib %{python_sitelib}} %{!?python2_sitelib: %global python2_sitelib %{python_sitelib}}
%{!?py2_build: %global py2_build %{__python2} setup.py build --executable="%{__python2} -s" %{?*}} %{!?py2_build: %global py2_build %{__python2} setup.py build --executable="%{__python2} -s" %{?*}}
%{!?py2_install: %global py2_install %{__python2} setup.py install --skip-build --root %{buildroot} %{?*}} %{!?py2_install: %global py2_install %{__python2} setup.py install --skip-build --root %{buildroot} %{?*}}
%else
%bcond_without python3
%endif %endif
%global distname requests-oauthlib %global distname requests-oauthlib
@ -16,7 +23,7 @@
Name: python-requests-oauthlib Name: python-requests-oauthlib
Version: 0.8.0 Version: 0.8.0
Release: 5%{?dist} Release: 6%{?dist}
Summary: OAuthlib authentication support for Requests. Summary: OAuthlib authentication support for Requests.
Group: Development/Libraries Group: Development/Libraries
@ -29,6 +36,7 @@ BuildArch: noarch
%description %description
This project provides first-class OAuth library support for python-request. This project provides first-class OAuth library support for python-request.
%if %{with python2}
%package -n python2-%{distname} %package -n python2-%{distname}
%if 0%{?python_provide:1} %if 0%{?python_provide:1}
%python_provide python2-%{distname} %python_provide python2-%{distname}
@ -52,8 +60,9 @@ Requires: python2-requests >= 2.0.0
%description -n python2-%{distname} %description -n python2-%{distname}
This project provides first-class OAuth library support for python-request. This project provides first-class OAuth library support for python-request.
%endif # with python2
%if 0%{?with_python3} %if %{with python3}
%package -n python3-%{distname} %package -n python3-%{distname}
%{?python_provide:%python_provide python3-%{distname}} %{?python_provide:%python_provide python3-%{distname}}
Summary: OAuthlib authentication support for Requests. Summary: OAuthlib authentication support for Requests.
@ -82,14 +91,18 @@ rm -rf %{distname}.egg-info
%build %build
%if %{with python2}
%py2_build %py2_build
%if 0%{?with_python3} %endif # with python2
%if %{with python3}
%py3_build %py3_build
%endif %endif
%install %install
%if %{with python2}
%py2_install %py2_install
%if 0%{?with_python3} %endif # with python2
%if %{with python3}
%py3_install %py3_install
%endif %endif
@ -98,13 +111,15 @@ rm -rf %{distname}.egg-info
#%%check #%%check
#%%{__python2} setup.py test #%%{__python2} setup.py test
%if %{with python2}
%files -n python2-%{distname} %files -n python2-%{distname}
%doc README.rst HISTORY.rst requirements.txt AUTHORS.rst %doc README.rst HISTORY.rst requirements.txt AUTHORS.rst
%license LICENSE %license LICENSE
%{python2_sitelib}/%{modname}/ %{python2_sitelib}/%{modname}/
%{python2_sitelib}/%{modname}-%{version}* %{python2_sitelib}/%{modname}-%{version}*
%endif # with python2
%if 0%{?with_python3} %if %{with python3}
%files -n python3-%{distname} %files -n python3-%{distname}
%doc README.rst HISTORY.rst requirements.txt AUTHORS.rst %doc README.rst HISTORY.rst requirements.txt AUTHORS.rst
%license LICENSE %license LICENSE
@ -113,6 +128,9 @@ rm -rf %{distname}.egg-info
%endif %endif
%changelog %changelog
* Tue Jul 10 2018 <jdennis@redhat.com> - 0.8.0-6
- Unify Fedora/RHEL py2/py3 logic
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.8.0-5 * Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.8.0-5
- Rebuilt for Python 3.7 - Rebuilt for Python 3.7