Unbundling finished!

This commit is contained in:
Toshio Kuratomi 2013-03-01 10:26:23 -08:00
parent 23a06f9568
commit 750fa891d4
2 changed files with 39 additions and 15 deletions

View File

@ -18,15 +18,21 @@ Index: urllib3-1.5/urllib3/connectionpool.py
=================================================================== ===================================================================
--- urllib3-1.5.orig/urllib3/connectionpool.py --- urllib3-1.5.orig/urllib3/connectionpool.py
+++ urllib3-1.5/urllib3/connectionpool.py +++ urllib3-1.5/urllib3/connectionpool.py
@@ -51,8 +51,14 @@ from .exceptions import ( @@ -51,8 +51,20 @@ from .exceptions import (
TimeoutError, TimeoutError,
) )
-from .packages.ssl_match_hostname import match_hostname, CertificateError -from .packages.ssl_match_hostname import match_hostname, CertificateError
-from .packages import six -from .packages import six
+try: +try:
+ from backports.ssl_match_hostname import match_hostname, CertificateError + # python3.2+
+ from ssl import match_hostname, CertificateError
+except ImportError: +except ImportError:
+ try:
+ # Older python where the backport from pypi is installed
+ from backports.ssl_match_hostname import match_hostname, CertificateError
+ except ImportError:
+ # Other older python we use our bundled copy
+ from .packages.ssl_match_hostname import match_hostname, CertificateError + from .packages.ssl_match_hostname import match_hostname, CertificateError
+try: +try:
+ import six + import six
@ -106,14 +112,20 @@ Index: urllib3-1.5/test/test_connectionpool.py
=================================================================== ===================================================================
--- urllib3-1.5.orig/test/test_connectionpool.py --- urllib3-1.5.orig/test/test_connectionpool.py
+++ urllib3-1.5/test/test_connectionpool.py +++ urllib3-1.5/test/test_connectionpool.py
@@ -1,7 +1,10 @@ @@ -1,7 +1,16 @@
import unittest import unittest
from urllib3.connectionpool import connection_from_url, HTTPConnectionPool from urllib3.connectionpool import connection_from_url, HTTPConnectionPool
-from urllib3.packages.ssl_match_hostname import CertificateError -from urllib3.packages.ssl_match_hostname import CertificateError
+try: +try:
+ from backports.ssl_match_hostname import CertificateError + # python3.2+
+ from ssl import CertificateError
+except ImportError: +except ImportError:
+ try:
+ # Older python where the backport from pypi is installed
+ from backports.ssl_match_hostname import CertificateError
+ except ImportError:
+ # Other older python we use our bundled copy
+ from urllib3.packages.ssl_match_hostname import CertificateError + from urllib3.packages.ssl_match_hostname import CertificateError
from urllib3.exceptions import ( from urllib3.exceptions import (
ClosedPoolError, ClosedPoolError,
@ -134,3 +146,17 @@ Index: urllib3-1.5/test/test_filepost.py
BOUNDARY = '!! test boundary !!' BOUNDARY = '!! test boundary !!'
Index: urllib3-1.5/setup.py
===================================================================
--- urllib3-1.5.orig/setup.py
+++ urllib3-1.5/setup.py
@@ -44,8 +44,7 @@ setup(name='urllib3',
author_email='andrey.petrov@shazow.net',
url='http://urllib3.readthedocs.org/',
license='MIT',
- packages=['urllib3', 'dummyserver', 'urllib3.packages',
- 'urllib3.packages.ssl_match_hostname',
+ packages=['urllib3', 'dummyserver', 'urllib3',
],
requires=requirements,
tests_require=tests_requirements,

View File

@ -8,7 +8,7 @@
Name: python-%{srcname} Name: python-%{srcname}
Version: 1.5 Version: 1.5
Release: 4%{?dist} Release: 5%{?dist}
Summary: Python HTTP library with thread-safe connection pooling and file post Summary: Python HTTP library with thread-safe connection pooling and file post
License: MIT License: MIT
@ -39,8 +39,7 @@ BuildArch: noarch
Requires: ca-certificates Requires: ca-certificates
Requires: python-six Requires: python-six
### TODO: In review https://bugzilla.redhat.com/show_bug.cgi?id=885013 Requires: python-backports-ssl_match_hostname
# Requires: python-backports-ssl_match_hostname
%if 0%{?rhel} <= 6 %if 0%{?rhel} <= 6
BuildRequires: python-ordereddict BuildRequires: python-ordereddict
Requires: python-ordereddict Requires: python-ordereddict
@ -51,6 +50,7 @@ BuildRequires: python2-devel
BuildRequires: python-nose BuildRequires: python-nose
BuildRequires: python-six BuildRequires: python-six
BuildRequires: python-tornado BuildRequires: python-tornado
BuildRequires: python-backports-ssl_match_hostname
%if 0%{?with_python3} %if 0%{?with_python3}
BuildRequires: python3-devel BuildRequires: python3-devel
@ -77,12 +77,7 @@ Python3 HTTP module with connection pooling and file POST abilities.
%prep %prep
%setup -q -n %{srcname}-%{version} %setup -q -n %{srcname}-%{version}
### TODO: unbundle everything in packages/: rm -rf urllib3/packages/
# Need:
# ssl_match_hostname https://bugzilla.redhat.com/show_bug.cgi?id=885013
# rm -rf urllib3/packages/
rm -rf urllib3/packages/six*
rm -rf urllib3/packages/ordered_dict*
%patch0 -p1 %patch0 -p1
%patch1 -p1 %patch1 -p1
@ -144,6 +139,9 @@ popd
%endif # with_python3 %endif # with_python3
%changelog %changelog
* Fri Mar 1 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 1.5-5
- Unbundling finished!
* Fri Mar 01 2013 Ralph Bean <rbean@redhat.com> - 1.5-4 * Fri Mar 01 2013 Ralph Bean <rbean@redhat.com> - 1.5-4
- Upstream patch to fix Accept header when behind a proxy. - Upstream patch to fix Accept header when behind a proxy.
- Reorganize patch numbers to more clearly distinguish them. - Reorganize patch numbers to more clearly distinguish them.