update python-requests to 2.28.1

This commit is contained in:
fu-shanqing 2022-07-28 10:50:33 +08:00
parent 5b99a2a50e
commit 70f0111236
7 changed files with 55 additions and 110 deletions

View File

@ -1,41 +0,0 @@
From cc1b9954ca7dcd90a694f7e2e9990c883bf7b647 Mon Sep 17 00:00:00 2001
From: Lumir Balhar <lbalhar@redhat.com>
Date: Wed, 21 Jul 2021 12:05:53 +0200
Subject: [PATCH] patch-requests-certs.py-to-use-the-system-CA-bundle
Reference:
https://src.fedoraproject.org/rpms/python-requests/blob/rawhide/f/patch-requests-certs.py-to-use-the-system-CA-bundle.patch
---
diff --git a/requests/certs.py b/requests/certs.py
index a14a7ee..a1841ca 100644
--- a/requests/certs.py
+++ b/requests/certs.py
@@ -10,8 +10,12 @@ only one — the one from the certifi package.
If you are packaging Requests, e.g., for a Linux distribution or a managed
environment, you can change the definition of where() to return a separately
packaged CA bundle.
-"""
-from certifi import where
+This OpenEuler-patched package returns "/etc/pki/tls/certs/ca-bundle.crt" provided
+by the ca-certificates RPM package.
+"""
+def where():
+ """Return the absolute path to the system CA bundle."""
+ return '/etc/pki/tls/certs/ca-bundle.crt'
if __name__ == '__main__':
print(where())
diff --git a/setup.py b/setup.py
index ce5e5c8..de86a91 100755
--- a/setup.py
+++ b/setup.py
@@ -46,7 +46,6 @@ requires = [
'idna>=2.5,<3; python_version < "3"',
'idna>=2.5,<4; python_version >= "3"',
'urllib3>=1.21.1,<1.27',
- 'certifi>=2017.4.17'
]
test_requirements = [
--
2.27.0

View File

@ -1,51 +0,0 @@
From bb1c91432c5e9a1f402692db5c80c65136656afb Mon Sep 17 00:00:00 2001
From: Jeremy Cline <jeremy@jcline.org>
Date: Tue, 13 Jun 2017 09:08:09 -0400
Subject: [PATCH] Remove tests that use the tarpit
The latest version of Mock has started using systemd containers. The
systemd-nspawn command is being run with --private-network, which
immediately kills connections to something other than localhost. These
tests depend on the connection not being killed immediately and that
they are never responded to.
Signed-off-by: Jeremy Cline <jeremy@jcline.org>
Reference:
https://src.fedoraproject.org/rpms/python-requests/blob/rawhide/f/Remove-tests-that-use-the-tarpit.patch
---
diff -Naur requests-2.24.0/tests/test_requests.py requests-2/tests/test_requests.py
--- requests-2.24.0/tests/test_requests.py 2020-08-04 18:05:14.250000000 +0800
+++ requests-2/tests/test_requests.py 2020-08-04 18:13:19.891000000 +0800
@@ -2188,30 +2188,6 @@
except ReadTimeout:
pass
- @pytest.mark.parametrize(
- 'timeout', (
- (0.1, None),
- Urllib3Timeout(connect=0.1, read=None)
- ))
- def test_connect_timeout(self, timeout):
- try:
- requests.get(TARPIT, timeout=timeout)
- pytest.fail('The connect() request should time out.')
- except ConnectTimeout as e:
- assert isinstance(e, ConnectionError)
- assert isinstance(e, Timeout)
-
- @pytest.mark.parametrize(
- 'timeout', (
- (0.1, 0.1),
- Urllib3Timeout(connect=0.1, read=0.1)
- ))
- def test_total_timeout_connect(self, timeout):
- try:
- requests.get(TARPIT, timeout=timeout)
- pytest.fail('The connect() request should time out.')
- except ConnectTimeout:
- pass
def test_encoded_methods(self, httpbin):
"""See: https://github.com/psf/requests/issues/2316"""

View File

@ -1,13 +0,0 @@
Reference:
https://src.fedoraproject.org/rpms/python-requests/blob/rawhide/f/requests-2.12.4-tests_nonet.patch
--- requests-2.12.4/tests/testserver/server.py 2016-12-21 11:31:56.000000000 -0800
+++ requests-2.12.4/tests/testserver/server.py.new 2016-12-30 10:40:06.085995065 -0800
@@ -27,7 +27,7 @@
"""Dummy server using for unit testing"""
WAIT_EVENT_TIMEOUT = 5
- def __init__(self, handler=None, host='localhost', port=0, requests_to_handle=1, wait_to_close_event=None):
+ def __init__(self, handler=None, host='127.0.0.1', port=0, requests_to_handle=1, wait_to_close_event=None):
super(Server, self).__init__()
self.handler = handler or consume_socket_content

View File

@ -0,0 +1,37 @@
--- requests-2.28.1/requests/certs.py 2022-07-12 13:55:25.378079641 -0700
+++ requests-2.28.1/requests/certs.py.new 2022-07-12 13:57:03.834621295 -0700
@@ -9,8 +9,13 @@
If you are packaging Requests, e.g., for a Linux distribution or a managed
environment, you can change the definition of where() to return a separately
packaged CA bundle.
+
+This OpenEuler-patched package returns "/etc/pki/tls/certs/ca-bundle.crt" provided
+by the ca-certificates RPM package.
"""
-from certifi import where
+def where():
+ """Return the absolute path to the system CA bundle."""
+ return '/etc/pki/tls/certs/ca-bundle.crt'
if __name__ == "__main__":
print(where())
--- requests-2.28.1/setup.py 2022-06-29 08:09:11.000000000 -0700
+++ requests-2.28.1/setup.py.new 2022-07-12 13:58:33.830116402 -0700
@@ -62,7 +62,6 @@
"charset_normalizer>=2,<3",
"idna>=2.5,<4",
"urllib3>=1.21.1,<1.27",
- "certifi>=2017.4.17",
]
test_requirements = [
"pytest-httpbin==0.0.7",
--- requests-2.28.1/setup.cfg 2022-06-29 08:09:11.000000000 -0700
+++ requests-2.28.1/setup.cfg.new 2022-07-12 13:58:19.619038220 -0700
@@ -4,7 +4,6 @@
socks
use_chardet_on_py3
requires-dist =
- certifi>=2017.4.17
charset_normalizer>=2,<3
idna>=2.5,<4
urllib3>=1.21.1,<1.27

View File

@ -0,0 +1,11 @@
--- requests-2.28.1/tests/testserver/server.py 2022-06-29 08:09:11.000000000 -0700
+++ requests-2.28.1/tests/testserver/server.py.new 2022-07-12 14:04:30.218077055 -0700
@@ -29,7 +29,7 @@
def __init__(
self,
handler=None,
- host="localhost",
+ host="127.0.0.1",
port=0,
requests_to_handle=1,
wait_to_close_event=None,

View File

@ -1,16 +1,15 @@
%bcond_with tests
Name: python-requests
Version: 2.27.1
Version: 2.28.1
Release: 1
Summary: Python HTTP Library
License: ASL 2.0
URL: http://python-requests.org/
Source0: https://github.com/psf/requests/archive/refs/tags/v%{version}.tar.gz
Source0: https://github.com/requests/requests/archive/v%{version}/requests-v%{version}.tar.gz
Patch6001: backport-requests-2.12.4-tests_nonet.patch
Patch6002: backport-patch-requests-certs.py-to-use-the-system-CA-bundle.patch
Patch6003: backport-remove-tests-that-use-the-tarpit.patch
Patch6001: backport-requests-2.28.1-system-certs.patch
Patch6002: backport-requests-2.28.1-tests_nonet.patch
BuildArch: noarch
@ -95,6 +94,9 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -m pytest -v
%doc HISTORY.md README.md
%changelog
* Thu Jul 28 2022 fushanqing <fushanqing@kylinos.cn> - 2.28.1-1
- update python-requests to 2.28.1
* Thu Jun 16 2022 zhangying <zhangy1317@foxmail.com> - 2.27.1-1
- Upgrade version for openstack yoga