From ef178eb8c29fc25e21be7b76c3a23d5578410b30 Mon Sep 17 00:00:00 2001 From: Jeremy Cline Date: Fri, 1 Dec 2017 11:59:56 -0500 Subject: [PATCH 1/5] Symlink the Python 3 bytecode for six (rbhz 1519147) --- python-urllib3.spec | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/python-urllib3.spec b/python-urllib3.spec index 051bcb4..7afe4cf 100644 --- a/python-urllib3.spec +++ b/python-urllib3.spec @@ -2,7 +2,7 @@ Name: python-%{srcname} Version: 1.22 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Python HTTP library with thread-safe connection pooling and file post License: MIT @@ -106,30 +106,23 @@ ln -s ../../backports/ssl_match_hostname %{buildroot}/%{python2_sitelib}/urllib3 # Unbundle the Python 3 build rm -rf %{buildroot}/%{python3_sitelib}/urllib3/packages/six.py* +rm -rf %{buildroot}/%{python3_sitelib}/urllib3/packages/__pycache__/six* rm -rf %{buildroot}/%{python3_sitelib}/urllib3/packages/ssl_match_hostname/ mkdir -p %{buildroot}/%{python3_sitelib}/urllib3/packages/ ln -s ../../six.py %{buildroot}/%{python3_sitelib}/urllib3/packages/six.py +ln -s ../../../__pycache__/six.cpython-%{python3_version_nodots}.opt-1.pyc %{buildroot}/%{python3_sitelib}/urllib3/packages/__pycache__/ +ln -s ../../../__pycache__/six.cpython-%{python3_version_nodots}.pyc %{buildroot}/%{python3_sitelib}/urllib3/packages/__pycache__/ # urllib3 requires Python 3.5 to use the standard library's match_hostname, # which we ship in Fedora 26, so we can safely replace the bundled version with # this stub which imports the necessary objects. cp %{SOURCE1} %{buildroot}/%{python3_sitelib}/urllib3/packages/ssl_match_hostname.py -# Copy in six.py just for the test suite. -cp %{python2_sitelib}/six.* %{buildroot}/%{python2_sitelib}/. -cp %{python3_sitelib}/six.* %{buildroot}/%{python3_sitelib}/. - %check py.test py.test-3 -# And after its done, remove our copied in bits -rm -rf %{buildroot}/%{python2_sitelib}/six* -rm -rf %{buildroot}/%{python2_sitelib}/backports* -rm -rf %{buildroot}/%{python3_sitelib}/six* -rm -rf %{buildroot}/%{python3_sitelib}/__pycache__* - %files -n python2-%{srcname} %license LICENSE.txt @@ -146,6 +139,9 @@ rm -rf %{buildroot}/%{python3_sitelib}/__pycache__* %changelog +* Fri Dec 01 2017 Jeremy Cline - 1.22-3 +- Symlink the Python 3 bytecode for six (rbhz 1519147) + * Thu Jul 27 2017 Fedora Release Engineering - 1.22-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild From 0ada5665e874758a27e07fe6a719e57c597125ee Mon Sep 17 00:00:00 2001 From: Tomas Hoger Date: Thu, 25 Jan 2018 09:27:01 +0100 Subject: [PATCH 2/5] Fix FTBFS - Move RECENT_DATE to 2017-06-30 As of 2018-01-01, python-urllib3 no longer builds because of the test suite failure caused by RECENT_DATE not being recent enough. RECENT_DATE was updated to 2017-06-30 upstream. https://github.com/shazow/urllib3/issues/1303 https://github.com/shazow/urllib3/commit/4bff1e93d2dd4663d422d7e290473d9189cec5db --- python-urllib3-recent-date.patch | 32 ++++++++++++++++++++++++++++++++ python-urllib3.spec | 8 +++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 python-urllib3-recent-date.patch diff --git a/python-urllib3-recent-date.patch b/python-urllib3-recent-date.patch new file mode 100644 index 0000000..720d76f --- /dev/null +++ b/python-urllib3-recent-date.patch @@ -0,0 +1,32 @@ +From 4bff1e93d2dd4663d422d7e290473d9189cec5db Mon Sep 17 00:00:00 2001 +From: Dominique Leuenberger +Date: Sun, 31 Dec 2017 15:11:16 +0100 +Subject: [PATCH] Move RECENT_DATE to 2017-06-30 + +The test suite expects the current date to be no more than two years in the future +of RECENT_DATE, which just serves as a reference point. + +Also clarify the comment about how to update RECENT_DATE + +Fixes #1303 + +diff --git a/urllib3/connection.py b/urllib3/connection.py +index 06bcbde1a..a03b573f0 100644 +--- a/urllib3/connection.py ++++ b/urllib3/connection.py +@@ -56,10 +56,11 @@ class ConnectionError(Exception): + 'https': 443, + } + +-# When updating RECENT_DATE, move it to +-# within two years of the current date, and no +-# earlier than 6 months ago. +-RECENT_DATE = datetime.date(2016, 1, 1) ++# When updating RECENT_DATE, move it to within two years of the current date, ++# and not less than 6 months ago. ++# Example: if Today is 2018-01-01, then RECENT_DATE should be any date on or ++# after 2016-01-01 (today - 2 years) AND before 2017-07-01 (today - 6 months) ++RECENT_DATE = datetime.date(2017, 6, 30) + + + class DummyConnection(object): diff --git a/python-urllib3.spec b/python-urllib3.spec index 7afe4cf..fa3a7e5 100644 --- a/python-urllib3.spec +++ b/python-urllib3.spec @@ -2,7 +2,7 @@ Name: python-%{srcname} Version: 1.22 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Python HTTP library with thread-safe connection pooling and file post License: MIT @@ -10,6 +10,8 @@ URL: https://github.com/shazow/urllib3 Source0: %{url}/archive/%{version}/%{srcname}-%{version}.tar.gz # Used with Python 3.5+ Source1: ssl_match_hostname_py3.py +# https://github.com/shazow/urllib3/commit/4bff1e93d2dd4663d422d7e290473d9189cec5db +Patch0: python-urllib3-recent-date.patch BuildArch: noarch %description @@ -75,6 +77,7 @@ Python3 HTTP module with connection pooling and file POST abilities. %prep %setup -q -n %{srcname}-%{version} +%patch0 -p1 -b .recent-date # Drop the dummyserver tests in koji. They fail there in real builds, but not # in scratch builds (weird). rm -rf test/with_dummyserver/ @@ -139,6 +142,9 @@ py.test-3 %changelog +* Thu Jan 25 2018 Tomas Hoger - 1.22-4 +- Fix FTBFS - Move RECENT_DATE to 2017-06-30 + * Fri Dec 01 2017 Jeremy Cline - 1.22-3 - Symlink the Python 3 bytecode for six (rbhz 1519147) From 595de62d4e68bd9bc98462a097c053bd2572f943 Mon Sep 17 00:00:00 2001 From: Jeremy Cline Date: Mon, 16 Apr 2018 10:31:30 -0400 Subject: [PATCH 3/5] Drop PyOpenSSL requirement (rhbz 1567862) Signed-off-by: Jeremy Cline --- python-urllib3.spec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python-urllib3.spec b/python-urllib3.spec index fa3a7e5..c678bc8 100644 --- a/python-urllib3.spec +++ b/python-urllib3.spec @@ -2,7 +2,7 @@ Name: python-%{srcname} Version: 1.22 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Python HTTP library with thread-safe connection pooling and file post License: MIT @@ -28,7 +28,6 @@ Requires: python-six Requires: python-backports-ssl_match_hostname # Secure extra requirements -Requires: python2-pyOpenSSL Requires: python-cryptography Requires: python-idna Requires: python-ipaddress @@ -66,7 +65,6 @@ BuildRequires: python3-tornado Requires: ca-certificates Requires: python3-six Requires: python3-pysocks -Requires: python3-pyOpenSSL Requires: python3-cryptography Requires: python3-idna Requires: python3-pysocks @@ -142,6 +140,9 @@ py.test-3 %changelog +* Mon Apr 16 2018 Jeremy Cline - 1.22-5 +- Drop the dependency on PyOpenSSL, it's not needed (rhbz 1567862) + * Thu Jan 25 2018 Tomas Hoger - 1.22-4 - Fix FTBFS - Move RECENT_DATE to 2017-06-30 From 4125e169e766a4851c024c58223a2af5af7cb8c8 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Thu, 3 May 2018 18:04:23 +0200 Subject: [PATCH 4/5] Do not lowercase hostnames with custom-protocol (rhbz 1574684) upstream: https://github.com/urllib3/urllib3/issues/1267 --- ...rcase-hostnames-with-custom-protocol.patch | 114 ++++++++++++++++++ python-urllib3.spec | 9 +- 2 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 0001-Do-not-lowercase-hostnames-with-custom-protocol.patch diff --git a/0001-Do-not-lowercase-hostnames-with-custom-protocol.patch b/0001-Do-not-lowercase-hostnames-with-custom-protocol.patch new file mode 100644 index 0000000..7e98a4b --- /dev/null +++ b/0001-Do-not-lowercase-hostnames-with-custom-protocol.patch @@ -0,0 +1,114 @@ +From 92da9e010f506cdd2408f6915ff87926f907c927 Mon Sep 17 00:00:00 2001 +From: Lukas Slebodnik +Date: Thu, 12 Apr 2018 00:34:07 +0200 +Subject: [PATCH 1] Do not lowercase hostnames with custom-protocol(#1267) + +Unix sockets are are case sensitive the same as other files +on standard unix file systems. +--- + urllib3/connectionpool.py | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/test/test_connectionpool.py b/test/test_connectionpool.py +index d8b8a83..4b74ab4 100644 +--- a/test/test_connectionpool.py ++++ b/test/test_connectionpool.py +@@ -32,6 +32,19 @@ from ssl import SSLError as BaseSSLError + from dummyserver.server import DEFAULT_CA + + ++class HTTPUnixConnection(HTTPConnection): ++ def __init__(self, host, timeout=60, **kwargs): ++ super(HTTPUnixConnection, self).__init__('localhost') ++ self.unix_socket = host ++ self.timeout = timeout ++ self.sock = None ++ ++ ++class HTTPUnixConnectionPool(HTTPConnectionPool): ++ scheme = 'http+unix' ++ ConnectionCls = HTTPUnixConnection ++ ++ + class TestConnectionPool(object): + """ + Tests in this suite should exercise the ConnectionPool functionality +@@ -138,6 +151,31 @@ class TestConnectionPool(object): + with HTTPSConnectionPool(b) as c: + assert not c.is_same_host(a) + ++ @pytest.mark.parametrize('a, b', [ ++ ('%2Fvar%2Frun%2Fdocker.sock', ++ 'http+unix://%2Fvar%2Frun%2Fdocker.sock'), ++ ('%2Fvar%2Frun%2Fdocker.sock', ++ 'http+unix://%2Fvar%2Frun%2Fdocker.sock/'), ++ ('%2Fvar%2Frun%2Fdocker.sock', ++ 'http+unix://%2Fvar%2Frun%2Fdocker.sock/abracadabra'), ++ ('%2Ftmp%2FTEST.sock', 'http+unix://%2Ftmp%2FTEST.sock'), ++ ('%2Ftmp%2FTEST.sock', 'http+unix://%2Ftmp%2FTEST.sock/'), ++ ('%2Ftmp%2FTEST.sock', 'http+unix://%2Ftmp%2FTEST.sock/abracadabra'), ++ ]) ++ def test_same_host_custom_protocol(self, a, b): ++ with HTTPUnixConnectionPool(a) as c: ++ assert c.is_same_host(b) ++ ++ @pytest.mark.parametrize('a, b', [ ++ ('%2Ftmp%2Ftest.sock', 'http+unix://%2Ftmp%2FTEST.sock'), ++ ('%2Ftmp%2Ftest.sock', 'http+unix://%2Ftmp%2FTEST.sock/'), ++ ('%2Ftmp%2Ftest.sock', 'http+unix://%2Ftmp%2FTEST.sock/abracadabra'), ++ ('%2Fvar%2Frun%2Fdocker.sock', 'http+unix://%2Ftmp%2FTEST.sock'), ++ ]) ++ def test_not_same_host_custom_protocol(self, a, b): ++ with HTTPUnixConnectionPool(a) as c: ++ assert not c.is_same_host(b) ++ + def test_max_connections(self): + with HTTPConnectionPool(host='localhost', maxsize=1, block=True) as pool: + pool._get_conn(timeout=0.01) +diff --git a/urllib3/connectionpool.py b/urllib3/connectionpool.py +index ec9600f..2d7a26b 100644 +--- a/urllib3/connectionpool.py ++++ b/urllib3/connectionpool.py +@@ -40,7 +40,7 @@ from .util.request import set_file_position + from .util.response import assert_header_parsing + from .util.retry import Retry + from .util.timeout import Timeout +-from .util.url import get_host, Url ++from .util.url import get_host, Url, NORMALIZABLE_SCHEMES + + + if six.PY2: +@@ -68,7 +68,7 @@ class ConnectionPool(object): + if not host: + raise LocationValueError("No host specified.") + +- self.host = _ipv6_host(host).lower() ++ self.host = _ipv6_host(host, self.scheme) + self._proxy_host = host.lower() + self.port = port + +@@ -434,7 +434,7 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods): + # TODO: Add optional support for socket.gethostbyname checking. + scheme, host, port = get_host(url) + +- host = _ipv6_host(host).lower() ++ host = _ipv6_host(host, self.scheme) + + # Use explicit default port for comparison when none is given + if self.port and not port: +@@ -886,7 +886,7 @@ def connection_from_url(url, **kw): + return HTTPConnectionPool(host, port=port, **kw) + + +-def _ipv6_host(host): ++def _ipv6_host(host, scheme): + """ + Process IPv6 address literals + """ +@@ -902,4 +902,6 @@ def _ipv6_host(host): + # percent sign might be URIencoded, convert it back into ASCII + if host.startswith('[') and host.endswith(']'): + host = host.replace('%25', '%').strip('[]') ++ if scheme in NORMALIZABLE_SCHEMES: ++ host = host.lower() + return host diff --git a/python-urllib3.spec b/python-urllib3.spec index c678bc8..b176765 100644 --- a/python-urllib3.spec +++ b/python-urllib3.spec @@ -2,7 +2,7 @@ Name: python-%{srcname} Version: 1.22 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Python HTTP library with thread-safe connection pooling and file post License: MIT @@ -12,6 +12,8 @@ Source0: %{url}/archive/%{version}/%{srcname}-%{version}.tar.gz 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 BuildArch: noarch %description @@ -76,6 +78,7 @@ Python3 HTTP module with connection pooling and file POST abilities. %prep %setup -q -n %{srcname}-%{version} %patch0 -p1 -b .recent-date +%patch1 -p1 # Drop the dummyserver tests in koji. They fail there in real builds, but not # in scratch builds (weird). rm -rf test/with_dummyserver/ @@ -140,6 +143,10 @@ py.test-3 %changelog +* Thu May 03 2018 Lukas Slebodnik - 1.22-6 +- Do not lowercase hostnames with custom-protocol (rhbz 1567862) +- upstream: https://github.com/urllib3/urllib3/issues/1267 + * Mon Apr 16 2018 Jeremy Cline - 1.22-5 - Drop the dependency on PyOpenSSL, it's not needed (rhbz 1567862) From 16f86578b184f31c930f033f37f68226f2044ec7 Mon Sep 17 00:00:00 2001 From: Jeremy Cline Date: Tue, 5 Jun 2018 14:30:24 -0400 Subject: [PATCH 5/5] Update to v1.24.1 This addresses rhbz #1649155 --- .gitignore | 3 + ...rcase-hostnames-with-custom-protocol.patch | 114 ------------------ python-urllib3-recent-date.patch | 32 ----- python-urllib3.spec | 56 +++++---- sources | 2 +- 5 files changed, 35 insertions(+), 172 deletions(-) delete mode 100644 0001-Do-not-lowercase-hostnames-with-custom-protocol.patch delete mode 100644 python-urllib3-recent-date.patch diff --git a/.gitignore b/.gitignore index 61a4314..630c966 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,6 @@ /urllib3-1.20.tar.gz /urllib3-1.21.1.tar.gz /urllib3-1.22.tar.gz +/urllib3-1.23.tar.gz +/urllib3-1.24.tar.gz +/urllib3-1.24.1.tar.gz diff --git a/0001-Do-not-lowercase-hostnames-with-custom-protocol.patch b/0001-Do-not-lowercase-hostnames-with-custom-protocol.patch deleted file mode 100644 index 7e98a4b..0000000 --- a/0001-Do-not-lowercase-hostnames-with-custom-protocol.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 92da9e010f506cdd2408f6915ff87926f907c927 Mon Sep 17 00:00:00 2001 -From: Lukas Slebodnik -Date: Thu, 12 Apr 2018 00:34:07 +0200 -Subject: [PATCH 1] Do not lowercase hostnames with custom-protocol(#1267) - -Unix sockets are are case sensitive the same as other files -on standard unix file systems. ---- - urllib3/connectionpool.py | 11 +++++++---- - 1 file changed, 7 insertions(+), 4 deletions(-) - -diff --git a/test/test_connectionpool.py b/test/test_connectionpool.py -index d8b8a83..4b74ab4 100644 ---- a/test/test_connectionpool.py -+++ b/test/test_connectionpool.py -@@ -32,6 +32,19 @@ from ssl import SSLError as BaseSSLError - from dummyserver.server import DEFAULT_CA - - -+class HTTPUnixConnection(HTTPConnection): -+ def __init__(self, host, timeout=60, **kwargs): -+ super(HTTPUnixConnection, self).__init__('localhost') -+ self.unix_socket = host -+ self.timeout = timeout -+ self.sock = None -+ -+ -+class HTTPUnixConnectionPool(HTTPConnectionPool): -+ scheme = 'http+unix' -+ ConnectionCls = HTTPUnixConnection -+ -+ - class TestConnectionPool(object): - """ - Tests in this suite should exercise the ConnectionPool functionality -@@ -138,6 +151,31 @@ class TestConnectionPool(object): - with HTTPSConnectionPool(b) as c: - assert not c.is_same_host(a) - -+ @pytest.mark.parametrize('a, b', [ -+ ('%2Fvar%2Frun%2Fdocker.sock', -+ 'http+unix://%2Fvar%2Frun%2Fdocker.sock'), -+ ('%2Fvar%2Frun%2Fdocker.sock', -+ 'http+unix://%2Fvar%2Frun%2Fdocker.sock/'), -+ ('%2Fvar%2Frun%2Fdocker.sock', -+ 'http+unix://%2Fvar%2Frun%2Fdocker.sock/abracadabra'), -+ ('%2Ftmp%2FTEST.sock', 'http+unix://%2Ftmp%2FTEST.sock'), -+ ('%2Ftmp%2FTEST.sock', 'http+unix://%2Ftmp%2FTEST.sock/'), -+ ('%2Ftmp%2FTEST.sock', 'http+unix://%2Ftmp%2FTEST.sock/abracadabra'), -+ ]) -+ def test_same_host_custom_protocol(self, a, b): -+ with HTTPUnixConnectionPool(a) as c: -+ assert c.is_same_host(b) -+ -+ @pytest.mark.parametrize('a, b', [ -+ ('%2Ftmp%2Ftest.sock', 'http+unix://%2Ftmp%2FTEST.sock'), -+ ('%2Ftmp%2Ftest.sock', 'http+unix://%2Ftmp%2FTEST.sock/'), -+ ('%2Ftmp%2Ftest.sock', 'http+unix://%2Ftmp%2FTEST.sock/abracadabra'), -+ ('%2Fvar%2Frun%2Fdocker.sock', 'http+unix://%2Ftmp%2FTEST.sock'), -+ ]) -+ def test_not_same_host_custom_protocol(self, a, b): -+ with HTTPUnixConnectionPool(a) as c: -+ assert not c.is_same_host(b) -+ - def test_max_connections(self): - with HTTPConnectionPool(host='localhost', maxsize=1, block=True) as pool: - pool._get_conn(timeout=0.01) -diff --git a/urllib3/connectionpool.py b/urllib3/connectionpool.py -index ec9600f..2d7a26b 100644 ---- a/urllib3/connectionpool.py -+++ b/urllib3/connectionpool.py -@@ -40,7 +40,7 @@ from .util.request import set_file_position - from .util.response import assert_header_parsing - from .util.retry import Retry - from .util.timeout import Timeout --from .util.url import get_host, Url -+from .util.url import get_host, Url, NORMALIZABLE_SCHEMES - - - if six.PY2: -@@ -68,7 +68,7 @@ class ConnectionPool(object): - if not host: - raise LocationValueError("No host specified.") - -- self.host = _ipv6_host(host).lower() -+ self.host = _ipv6_host(host, self.scheme) - self._proxy_host = host.lower() - self.port = port - -@@ -434,7 +434,7 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods): - # TODO: Add optional support for socket.gethostbyname checking. - scheme, host, port = get_host(url) - -- host = _ipv6_host(host).lower() -+ host = _ipv6_host(host, self.scheme) - - # Use explicit default port for comparison when none is given - if self.port and not port: -@@ -886,7 +886,7 @@ def connection_from_url(url, **kw): - return HTTPConnectionPool(host, port=port, **kw) - - --def _ipv6_host(host): -+def _ipv6_host(host, scheme): - """ - Process IPv6 address literals - """ -@@ -902,4 +902,6 @@ def _ipv6_host(host): - # percent sign might be URIencoded, convert it back into ASCII - if host.startswith('[') and host.endswith(']'): - host = host.replace('%25', '%').strip('[]') -+ if scheme in NORMALIZABLE_SCHEMES: -+ host = host.lower() - return host diff --git a/python-urllib3-recent-date.patch b/python-urllib3-recent-date.patch deleted file mode 100644 index 720d76f..0000000 --- a/python-urllib3-recent-date.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 4bff1e93d2dd4663d422d7e290473d9189cec5db Mon Sep 17 00:00:00 2001 -From: Dominique Leuenberger -Date: Sun, 31 Dec 2017 15:11:16 +0100 -Subject: [PATCH] Move RECENT_DATE to 2017-06-30 - -The test suite expects the current date to be no more than two years in the future -of RECENT_DATE, which just serves as a reference point. - -Also clarify the comment about how to update RECENT_DATE - -Fixes #1303 - -diff --git a/urllib3/connection.py b/urllib3/connection.py -index 06bcbde1a..a03b573f0 100644 ---- a/urllib3/connection.py -+++ b/urllib3/connection.py -@@ -56,10 +56,11 @@ class ConnectionError(Exception): - 'https': 443, - } - --# When updating RECENT_DATE, move it to --# within two years of the current date, and no --# earlier than 6 months ago. --RECENT_DATE = datetime.date(2016, 1, 1) -+# When updating RECENT_DATE, move it to within two years of the current date, -+# and not less than 6 months ago. -+# Example: if Today is 2018-01-01, then RECENT_DATE should be any date on or -+# after 2016-01-01 (today - 2 years) AND before 2017-07-01 (today - 6 months) -+RECENT_DATE = datetime.date(2017, 6, 30) - - - class DummyConnection(object): diff --git a/python-urllib3.spec b/python-urllib3.spec index b176765..1cb5df1 100644 --- a/python-urllib3.spec +++ b/python-urllib3.spec @@ -1,19 +1,15 @@ %global srcname urllib3 Name: python-%{srcname} -Version: 1.22 -Release: 6%{?dist} +Version: 1.24.1 +Release: 2%{?dist} Summary: Python HTTP library with thread-safe connection pooling and file post License: MIT -URL: https://github.com/shazow/urllib3 +URL: https://github.com/urllib3/urllib3 Source0: %{url}/archive/%{version}/%{srcname}-%{version}.tar.gz -# Used with Python 3.5+ +# Unbundle ssl_match_hostname since we depend on it 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 BuildArch: noarch %description @@ -37,6 +33,7 @@ Requires: python-pysocks BuildRequires: python2-devel # For unittests +BuildRequires: python-backports-ssl_match_hostname BuildRequires: python-nose BuildRequires: python-nose-exclude BuildRequires: python-coverage @@ -76,9 +73,7 @@ Python3 HTTP module with connection pooling and file POST abilities. %prep -%setup -q -n %{srcname}-%{version} -%patch0 -p1 -b .recent-date -%patch1 -p1 +%autosetup -p1 -n %{srcname}-%{version} # Drop the dummyserver tests in koji. They fail there in real builds, but not # in scratch builds (weird). rm -rf test/with_dummyserver/ @@ -88,6 +83,10 @@ rm -rf test/appengine/ # to do with Fedora in particular. They don't fail in upstream build infrastructure rm -rf test/contrib/ +# Tests for Python built without SSL, but Fedora builds with SSL. These tests +# fail when combined with the unbundling of backports-ssl_match_hostname +rm -f test/test_no_ssl.py + %build %py2_build %py3_build @@ -102,11 +101,11 @@ rm -rf %{buildroot}/%{python2_sitelib}/urllib3/packages/six.py* rm -rf %{buildroot}/%{python2_sitelib}/urllib3/packages/ssl_match_hostname/ mkdir -p %{buildroot}/%{python2_sitelib}/urllib3/packages/ -ln -s ../../six.py %{buildroot}/%{python2_sitelib}/urllib3/packages/six.py -ln -s ../../six.pyc %{buildroot}/%{python2_sitelib}/urllib3/packages/six.pyc -ln -s ../../six.pyo %{buildroot}/%{python2_sitelib}/urllib3/packages/six.pyo - -ln -s ../../backports/ssl_match_hostname %{buildroot}/%{python2_sitelib}/urllib3/packages/ssl_match_hostname +ln -s %{python2_sitelib}/six.py %{buildroot}/%{python2_sitelib}/urllib3/packages/six.py +ln -s %{python2_sitelib}/six.pyc %{buildroot}/%{python2_sitelib}/urllib3/packages/six.pyc +ln -s %{python2_sitelib}/six.pyo %{buildroot}/%{python2_sitelib}/urllib3/packages/six.pyo +ln -s %{python2_sitelib}/backports/ssl_match_hostname \ + %{buildroot}/%{python2_sitelib}/urllib3/packages/ssl_match_hostname # Unbundle the Python 3 build rm -rf %{buildroot}/%{python3_sitelib}/urllib3/packages/six.py* @@ -114,18 +113,19 @@ rm -rf %{buildroot}/%{python3_sitelib}/urllib3/packages/__pycache__/six* rm -rf %{buildroot}/%{python3_sitelib}/urllib3/packages/ssl_match_hostname/ mkdir -p %{buildroot}/%{python3_sitelib}/urllib3/packages/ -ln -s ../../six.py %{buildroot}/%{python3_sitelib}/urllib3/packages/six.py -ln -s ../../../__pycache__/six.cpython-%{python3_version_nodots}.opt-1.pyc %{buildroot}/%{python3_sitelib}/urllib3/packages/__pycache__/ -ln -s ../../../__pycache__/six.cpython-%{python3_version_nodots}.pyc %{buildroot}/%{python3_sitelib}/urllib3/packages/__pycache__/ -# urllib3 requires Python 3.5 to use the standard library's match_hostname, -# which we ship in Fedora 26, so we can safely replace the bundled version with -# this stub which imports the necessary objects. -cp %{SOURCE1} %{buildroot}/%{python3_sitelib}/urllib3/packages/ssl_match_hostname.py +cp -a %{SOURCE1} %{buildroot}/%{python3_sitelib}/urllib3/packages/ssl_match_hostname.py +ln -s %{python3_sitelib}/six.py %{buildroot}/%{python3_sitelib}/urllib3/packages/six.py +ln -s %{python3_sitelib}/__pycache__/six.cpython-%{python3_version_nodots}.opt-1.pyc \ + %{buildroot}/%{python3_sitelib}/urllib3/packages/__pycache__/ +ln -s %{python3_sitelib}/__pycache__/six.cpython-%{python3_version_nodots}.pyc \ + %{buildroot}/%{python3_sitelib}/urllib3/packages/__pycache__/ %check -py.test -py.test-3 +pushd test +PYTHONPATH=%{buildroot}%{python2_sitelib}:%{python2_sitelib} %{__python2} -m pytest -v +PYTHONPATH=%{buildroot}%{python3_sitelib}:%{python3_sitelib} %{__python3} -m pytest -v +popd %files -n python2-%{srcname} @@ -143,6 +143,12 @@ py.test-3 %changelog +* Tue Nov 13 2018 Jeremy Cline - 1.24.1-2 +- Adjust unbundling of ssl_match_hostname + +* Mon Oct 29 2018 Jeremy Cline - 1.24.1-1 +- Update to v1.24.1 + * Thu May 03 2018 Lukas Slebodnik - 1.22-6 - Do not lowercase hostnames with custom-protocol (rhbz 1567862) - upstream: https://github.com/urllib3/urllib3/issues/1267 diff --git a/sources b/sources index 8488c8b..d1287f7 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (urllib3-1.22.tar.gz) = 1b45a4a64e71847a4fc62b9263235d5b05b62076698fa324454efeb7ad065abd702cc9eadb2d396d9270b07e91e9bad94c52a4b9b115aadccb27f81955e6feab +SHA512 (urllib3-1.24.1.tar.gz) = 2f5453cf0ec1b65de9a9fca0fdb45664f7481507c875b7115c063cb177628b4b611377e588508ab8433e0797fc78b60fd3ea5cc5ac0a3f105d36bfff9a56f1f4