Unify spec file between Fedora and RHEL

This commit is contained in:
John Dennis 2018-07-10 08:15:14 -04:00
parent 021325d236
commit ef8395cff1

View File

@ -1,8 +1,14 @@
%if 0%{?fedora} || 0%{?rhel} > 7 %bcond_with jwcrypto
%global with_python3 1 %global with_python2 0
%global with_python3 0
%if (0%{?fedora} > 0 && 0%{?fedora} < 32) || (0%{?rhel} > 0 && 0%{?rhel} <= 7)
%global with_python2 1
%endif %endif
%bcond_with jwcrypto %if 0%{?fedora} || 0%{?rhel} >= 8
%global with_python3 1
%endif
%if 0%{?rhel} && 0%{?rhel} <= 7 %if 0%{?rhel} && 0%{?rhel} <= 7
%{!?__python2: %global __python2 /usr/bin/python2} %{!?__python2: %global __python2 /usr/bin/python2}
@ -24,14 +30,14 @@
Name: python-oauthlib Name: python-oauthlib
Version: 2.0.1 Version: 2.0.1
Release: 8%{?dist} Release: 9%{?dist}
Summary: An implementation of the OAuth request-signing logic Summary: An implementation of the OAuth request-signing logic
Group: Development/Libraries Group: Development/Libraries
License: BSD License: BSD
URL: http://pypi.python.org/pypi/oauthlib URL: https://pypi.python.org/pypi/oauthlib
Source0: http://pypi.python.org/packages/source/o/%{modname}/%{modname}-%{version}.tar.gz Source0: https://files.pythonhosted.org/packages/source/o/%{modname}/%{modname}-%{version}.tar.gz
#Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{commit}/%{gh_project}-%{commit}.tar.gz #Source0: https://github.com/%%{gh_owner}/%%{gh_project}/archive/%%{commit}/%%{gh_project}-%%{commit}.tar.gz
BuildArch: noarch BuildArch: noarch
@ -46,6 +52,7 @@ onto your favourite web framework. If you're a maintainer of such a
library, write a thin veneer on top of OAuthLib and get OAuth support for library, write a thin veneer on top of OAuthLib and get OAuth support for
very little effort. very little effort.
%if 0%{with_python2}
%package -n python2-oauthlib %package -n python2-oauthlib
Summary: An implementation of the OAuth request-signing logic Summary: An implementation of the OAuth request-signing logic
Group: Development/Libraries Group: Development/Libraries
@ -79,8 +86,9 @@ OAuth client support onto your favorite HTTP library, or provider support
onto your favourite web framework. If you're a maintainer of such a onto your favourite web framework. If you're a maintainer of such a
library, write a thin veneer on top of OAuthLib and get OAuth support for library, write a thin veneer on top of OAuthLib and get OAuth support for
very little effort. very little effort.
%endif # with python2
%if 0%{?with_python3} %if 0%{with_python3}
%package -n python3-oauthlib %package -n python3-oauthlib
Summary: An implementation of the OAuth request-signing logic Summary: An implementation of the OAuth request-signing logic
Group: Development/Libraries Group: Development/Libraries
@ -114,11 +122,11 @@ OAuth client support onto your favorite HTTP library, or provider support
onto your favourite web framework. If you're a maintainer of such a onto your favourite web framework. If you're a maintainer of such a
library, write a thin veneer on top of OAuthLib and get OAuth support for library, write a thin veneer on top of OAuthLib and get OAuth support for
very little effort. very little effort.
%endif %endif # with python3
%prep %prep
%setup -q -n %{modname}-%{version} %setup -q -n %{modname}-%{version}
#%%setup -q -n %{gh_project}-%{commit} #%%setup -q -n %%{gh_project}-%%{commit}
%if %{with jwcrypto} %if %{with jwcrypto}
%patch0 -p1 %patch0 -p1
@ -132,38 +140,49 @@ sed -i "s/'unittest2', //" setup.py
rm -rf %{modname}.egg-info rm -rf %{modname}.egg-info
%build %build
%if 0%{with_python2}
%py2_build %py2_build
%if 0%{?with_python3} %endif # with python2
%if 0%{with_python3}
%py3_build %py3_build
%endif %endif # with python3
%install %install
%if 0%{with_python2}
%py2_install %py2_install
%if 0%{?with_python3} %endif # with python2
%if 0%{with_python3}
%py3_install %py3_install
%endif %endif # with python3
%check %check
%if 0%{with_python2}
%{__python2} setup.py test %{__python2} setup.py test
%if 0%{?with_python3} %endif # with python2
%if 0%{with_python3}
%{__python3} setup.py test %{__python3} setup.py test
%endif %endif # with python3
%if 0%{with_python2}
%files -n python2-oauthlib %files -n python2-oauthlib
%doc README.rst %doc README.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 0%{with_python3}
%files -n python3-oauthlib %files -n python3-oauthlib
%doc README.rst %doc README.rst
%license LICENSE %license LICENSE
%{python3_sitelib}/%{modname}/ %{python3_sitelib}/%{modname}/
%{python3_sitelib}/%{modname}-%{version}-* %{python3_sitelib}/%{modname}-%{version}-*
%endif %endif # with python3
%changelog %changelog
* Tue Jul 10 2018 <jdennis@redhat.com> - 2.0.1-9
- Unify spec file between Fedora and RHEL
* Fri Jun 15 2018 Miro Hrončok <mhroncok@redhat.com> - 2.0.1-8 * Fri Jun 15 2018 Miro Hrončok <mhroncok@redhat.com> - 2.0.1-8
- Rebuilt for Python 3.7 - Rebuilt for Python 3.7