RHEL 9.0.0 Alpha bootstrap

The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/python-requests-oauthlib#21ab84d9699d94334d8c13137f249d73486d6efd
This commit is contained in:
Troy Dawson 2021-02-10 11:20:59 -08:00
parent 17f1782b58
commit d2629134f5
2 changed files with 97 additions and 76 deletions

89
401.patch Normal file
View File

@ -0,0 +1,89 @@
From 62d8d04f49f731839ccd4a2c448ac08c8a1ab493 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Mon, 16 Mar 2020 12:34:23 +0100
Subject: [PATCH] Prefer unittest.mock over external mock package
Prefer using unittest.mock over external mock package to avoid
extraneous dependencies in Python 3.3+. Install 'mock' only for older
Python versions.
---
setup.py | 2 +-
tests/test_core.py | 4 ++--
tests/test_oauth1_session.py | 4 ++--
tests/test_oauth2_session.py | 4 ++--
tox.ini | 2 +-
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/setup.py b/setup.py
index 1532c17..2e8dd82 100644
--- a/setup.py
+++ b/setup.py
@@ -63,6 +63,6 @@ def readall(path):
"Programming Language :: Python :: Implementation :: PyPy",
],
zip_safe=False,
- tests_require=["mock", "requests-mock"],
+ tests_require=['mock;python_version<"3.3"', "requests-mock"],
test_suite="tests",
)
diff --git a/tests/test_core.py b/tests/test_core.py
index ea4575f..971ee6c 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -8,9 +8,9 @@
import unittest
try:
- import mock
-except ImportError:
from unittest import mock
+except ImportError:
+ import mock
@mock.patch("oauthlib.oauth1.rfc5849.generate_timestamp")
diff --git a/tests/test_oauth1_session.py b/tests/test_oauth1_session.py
index 1dd2b2f..ad0578f 100644
--- a/tests/test_oauth1_session.py
+++ b/tests/test_oauth1_session.py
@@ -9,9 +9,9 @@
from requests_oauthlib import OAuth1Session
try:
- import mock
-except ImportError:
from unittest import mock
+except ImportError:
+ import mock
try:
import cryptography
diff --git a/tests/test_oauth2_session.py b/tests/test_oauth2_session.py
index cfc6236..2f7b227 100644
--- a/tests/test_oauth2_session.py
+++ b/tests/test_oauth2_session.py
@@ -9,9 +9,9 @@
from unittest import TestCase
try:
- import mock
-except ImportError:
from unittest import mock
+except ImportError:
+ import mock
from oauthlib.common import urlencode
from oauthlib.oauth2 import TokenExpiredError, OAuth2Error
diff --git a/tox.ini b/tox.ini
index abc641a..0db1117 100644
--- a/tox.ini
+++ b/tox.ini
@@ -4,7 +4,7 @@ envlist = py27, py34, py35, py36, py37, pypy, pypy3
[testenv]
deps=
-r{toxinidir}/requirements.txt
- mock
+ mock;python_version<"3.3"
coveralls
requests-mock
commands= coverage run --source=requests_oauthlib -m unittest discover

View File

@ -1,66 +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}
# python3 and python version related macros
# required to build python3- subpackage
# are not available in el6 and el7
%{!?__python2: %global __python2 %{__python}}
%{!?python2_sitelib: %global python2_sitelib %{python_sitelib}}
%{!?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} %{?*}}
%endif
%global distname requests-oauthlib
%global modname requests_oauthlib
Name: python-requests-oauthlib
Version: 1.3.0
Release: 8%{?dist}
Release: 9%{?dist}
Summary: OAuthlib authentication support for Requests.
License: ISC
URL: http://pypi.python.org/pypi/requests-oauthlib
Source0: https://github.com/requests/requests-oauthlib/archive/v%{version}.tar.gz
Patch0001: 401.patch
BuildArch: noarch
%description
This project provides first-class OAuth library support for python-request.
%if %{with python2}
%package -n python2-%{distname}
%if 0%{?python_provide:1}
%python_provide python2-%{distname}
%else
Provides: python-%{distname} = %{?epoch:%{epoch}:}%{version}-%{release}
%endif
Summary: OAuthlib authentication support for Requests.
BuildRequires: python2-devel
BuildRequires: python2-setuptools
BuildRequires: python2-oauthlib >= 0.6.2
BuildRequires: python2-requests >= 2.0.0
BuildRequires: python2-mock
Requires: python2-oauthlib
Requires: python2-requests >= 2.0.0
%description -n python2-%{distname}
This project provides first-class OAuth library support for python-request.
%endif # with python2
%if %{with python3}
%package -n python3-%{distname}
%{?python_provide:%python_provide python3-%{distname}}
Summary: OAuthlib authentication support for Requests.
@ -71,60 +26,37 @@ BuildRequires: python3-setuptools
BuildRequires: python3-oauthlib >= 0.6.2
BuildRequires: python3-requests >= 2.0.0
BuildRequires: python3-mock
Requires: python3-oauthlib
Requires: python3-requests
%description -n python3-%{distname}
This project provides first-class OAuth library support for python-request.
%endif
%prep
%autosetup -n %{distname}-%{version}
%autosetup -n %{distname}-%{version} -p1
# Remove bundled egg-info in case it exists
rm -rf %{distname}.egg-info
%build
%if %{with python2}
%py2_build
%endif # with python2
%if %{with python3}
%py3_build
%endif
%install
%if %{with python2}
%py2_install
%endif # with python2
%if %{with python3}
%py3_install
%endif
# Upstream doesn't actually ship the tests with the tarball.
# https://github.com/requests/requests-oauthlib/pull/91
#%%check
#%%{__python2} setup.py test
%if %{with python2}
%files -n python2-%{distname}
%doc README.rst HISTORY.rst requirements.txt AUTHORS.rst
%license LICENSE
%{python2_sitelib}/%{modname}/
%{python2_sitelib}/%{modname}-%{version}*
%endif # with python2
%if %{with python3}
%files -n python3-%{distname}
%doc README.rst HISTORY.rst requirements.txt AUTHORS.rst
%license LICENSE
%{python3_sitelib}/%{modname}/
%{python3_sitelib}/%{modname}-%{version}*
%endif
%changelog
* Mon Feb 8 2021 Jakub Hrozek <jhrozek@redhat.com> - 1.3.0-9
- Drop python2 support
- actually run unit tests
- drop unused python3-mock dependency
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.0-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild