From 0905637ec9bc2ac3241b1f912f63c7f66e6364aa Mon Sep 17 00:00:00 2001 From: Jeremy Cline Date: Wed, 30 May 2018 08:58:59 -0400 Subject: [PATCH] Backport patch for Python 3.7 support (rhbz 1584112) Since it's not clear when urllib3 will get a new release, fix the Python 3.7 test failures now. --- ...rtificateError-str-repr-is-tuple-not.patch | 26 +++++++++++++++++++ python-urllib3.spec | 10 +++++-- 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 Address-1365.-CertificateError-str-repr-is-tuple-not.patch diff --git a/Address-1365.-CertificateError-str-repr-is-tuple-not.patch b/Address-1365.-CertificateError-str-repr-is-tuple-not.patch new file mode 100644 index 0000000..d491d05 --- /dev/null +++ b/Address-1365.-CertificateError-str-repr-is-tuple-not.patch @@ -0,0 +1,26 @@ +From edd7a0063d25f1a7f34306f9a9488247593888a9 Mon Sep 17 00:00:00 2001 +From: Chris Wilcox +Date: Fri, 20 Apr 2018 15:50:40 -0700 +Subject: [PATCH] Address #1365. CertificateError str repr is tuple, not str. + +Signed-off-by: Jeremy Cline +--- + test/test_connection.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/test_connection.py b/test/test_connection.py +index be50f6c..dfc757d 100644 +--- a/test/test_connection.py ++++ b/test/test_connection.py +@@ -38,7 +38,7 @@ class TestConnection(object): + with mock.patch('urllib3.connection.log.error') as mock_log: + _match_hostname(cert, asserted_hostname) + except CertificateError as e: +- assert str(e) == "hostname 'bar' doesn't match 'foo'" ++ assert "hostname 'bar' doesn't match 'foo'" in str(e) + mock_log.assert_called_once_with( + 'Certificate did not match expected hostname: %s. ' + 'Certificate: %s', +-- +2.17.0 + diff --git a/python-urllib3.spec b/python-urllib3.spec index dd6801d..c1bcd0d 100644 --- a/python-urllib3.spec +++ b/python-urllib3.spec @@ -5,7 +5,7 @@ Name: python-%{srcname} Version: 1.22 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Python HTTP library with thread-safe connection pooling and file post License: MIT @@ -16,7 +16,9 @@ Source1: ssl_match_hostname_py3.py # https://github.com/shazow/urllib3/commit/4bff1e93d2dd4663d422d7e290473d9189cec5db Patch0: python-urllib3-recent-date.patch # https://github.com/urllib3/urllib3/commit/9f09cb4b9d69bd8944c881f61b8fe933ad425b5b -Patch0001: 0001-Do-not-lowercase-hostnames-with-custom-protocol.patch +Patch1: 0001-Do-not-lowercase-hostnames-with-custom-protocol.patch +# https://github.com/urllib3/urllib3/pull/1375 - Python 3.7 support +Patch2: Address-1365.-CertificateError-str-repr-is-tuple-not.patch BuildArch: noarch %description @@ -79,6 +81,7 @@ Python3 HTTP module with connection pooling and file POST abilities. %setup -q -n %{srcname}-%{version} %patch0 -p1 -b .recent-date %patch1 -p1 +%patch2 -p1 # Drop the dummyserver tests in koji. They fail there in real builds, but not # in scratch builds (weird). rm -rf test/with_dummyserver/ @@ -145,6 +148,9 @@ py.test-3 %changelog +* Wed May 30 2018 Jeremy Cline - 1.22-10 +- Backport patch to support Python 3.7 (rhbz 1584112) + * Thu May 03 2018 Lukas Slebodnik - 1.22-9 - Do not lowercase hostnames with custom-protocol (rhbz 1567862) - upstream: https://github.com/urllib3/urllib3/issues/1267