[python-urllib3/el6] Revert "Moving into rhel-6.7"
Ralph Bean
ralph at fedoraproject.org
Mon Mar 16 14:59:03 UTC 2015
commit a29737d1ddcf59644f04e5d0e27af2508b1cfb90
Author: Ralph Bean <rbean at redhat.com>
Date: Mon Mar 16 10:32:51 2015 -0400
Revert "Moving into rhel-6.7"
This reverts commit e6e52f508ef4a9620034b1a886abed23b3ec5c39.
Turns out that the move into rhel-6.7 wasn't coordinated correctly.
This package will likely still end up in rhel-6.7 but this retirement
was premature.
.gitignore | 1 +
dead.package | 1 -
python-urllib3-accept-header-for-proxy.patch | 28 +++++
python-urllib3-default-ssl-cert-validate.patch | 20 +++
python-urllib3-old-nose-compat.patch | 10 ++
python-urllib3-py2.6-compat.patch | 89 +++++++++++++
python-urllib3-unbundle.patch | 162 ++++++++++++++++++++++++
python-urllib3.spec | 166 +++++++++++++++++++++++++
sources | 1 +
9 files changed, 477 insertions(+), 1 deletion(-)
---
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..052920f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/urllib3-1.5.tar.gz
diff --git a/python-urllib3-accept-header-for-proxy.patch b/python-urllib3-accept-header-for-proxy.patch
new file mode 100644
index 0000000..8d89f27
--- /dev/null
+++ b/python-urllib3-accept-header-for-proxy.patch
@@ -0,0 +1,28 @@
+From ea36acfc8a997a19ba1ead58de0d1f01e9eb540f Mon Sep 17 00:00:00 2001
+From: kevin <kevinbjiang at gmail.com>
+Date: Thu, 30 Aug 2012 00:14:12 -0400
+Subject: [PATCH 1/4] Fix overwritten Accept header when proxy is used
+
+When a request specifies both an Accept header and a proxy server, the
+Accept header value is overwritten.
+---
+ urllib3/poolmanager.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/urllib3/poolmanager.py b/urllib3/poolmanager.py
+index 8f5b54c..7d7d6e4 100644
+--- a/urllib3/poolmanager.py
++++ b/urllib3/poolmanager.py
+@@ -141,7 +141,8 @@ def _set_proxy_headers(self, headers=None):
+ headers = headers or {}
+
+ # Same headers are curl passes for --proxy1.0
+- headers['Accept'] = '*/*'
++ if 'Accept' not in headers:
++ headers['Accept'] = '*/*'
+ headers['Proxy-Connection'] = 'Keep-Alive'
+
+ return headers
+--
+1.7.10
+
diff --git a/python-urllib3-default-ssl-cert-validate.patch b/python-urllib3-default-ssl-cert-validate.patch
new file mode 100644
index 0000000..38eea0f
--- /dev/null
+++ b/python-urllib3-default-ssl-cert-validate.patch
@@ -0,0 +1,20 @@
+Author: Jamie Strandboge <jamie at canonical.com>
+Description: require SSL certificate validation by default by using
+ CERT_REQUIRED and using the system /etc/ssl/certs/ca-certificates.crt
+Bug-Ubuntu: https://launchpad.net/bugs/1047054
+Modified for Fedora by Ralph Bean <rbean at redhat.com>
+Bug-Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=855320
+
+Index: urllib3-1.5/urllib3/connectionpool.py
+===================================================================
+--- urllib3-1.5.orig/urllib3/connectionpool.py
++++ urllib3-1.5/urllib3/connectionpool.py
+@@ -504,7 +504,7 @@ class HTTPSConnectionPool(HTTPConnection
+ strict=False, timeout=None, maxsize=1,
+ block=False, headers=None,
+ key_file=None, cert_file=None,
+- cert_reqs='CERT_NONE', ca_certs=None):
++ cert_reqs='CERT_REQUIRED', ca_certs='/etc/ssl/certs/ca-bundle.crt'):
+
+ super(HTTPSConnectionPool, self).__init__(host, port,
+ strict, timeout, maxsize,
diff --git a/python-urllib3-old-nose-compat.patch b/python-urllib3-old-nose-compat.patch
new file mode 100644
index 0000000..e76dda5
--- /dev/null
+++ b/python-urllib3-old-nose-compat.patch
@@ -0,0 +1,10 @@
+Index: urllib3-1.5/setup.cfg
+===================================================================
+--- urllib3-1.5.orig/setup.cfg
++++ urllib3-1.5/setup.cfg
+@@ -1,5 +1,4 @@
+ [nosetests]
+-logging-clear-handlers = true
+ with-coverage = true
+ cover-package = urllib3
+
diff --git a/python-urllib3-py2.6-compat.patch b/python-urllib3-py2.6-compat.patch
new file mode 100644
index 0000000..afcb355
--- /dev/null
+++ b/python-urllib3-py2.6-compat.patch
@@ -0,0 +1,89 @@
+Index: urllib3-1.5/test/test_collections.py
+===================================================================
+--- urllib3-1.5.orig/test/test_collections.py
++++ urllib3-1.5/test/test_collections.py
+@@ -122,9 +122,11 @@ class TestLRUContainer(unittest.TestCase
+ def test_iter(self):
+ d = Container()
+
+- with self.assertRaises(NotImplementedError):
++ def to_test():
+ for i in d:
+ self.fail("Iteration shouldn't be implemented.")
+
++ self.assertRaises(NotImplementedError, to_test)
++
+ if __name__ == '__main__':
+ unittest.main()
+Index: urllib3-1.5/test/test_connectionpool.py
+===================================================================
+--- urllib3-1.5.orig/test/test_connectionpool.py
++++ urllib3-1.5/test/test_connectionpool.py
+@@ -98,8 +98,7 @@ class TestConnectionPool(unittest.TestCa
+
+ def _test(exception, expect):
+ pool._make_request = lambda *args, **kwargs: _raise(exception)
+- with self.assertRaises(expect):
+- pool.request('GET', '/')
++ self.assertRaises(expect, pool.request, 'GET', '/')
+
+ self.assertEqual(pool.pool.qsize(), POOL_SIZE)
+
+@@ -114,15 +113,13 @@ class TestConnectionPool(unittest.TestCa
+ # MaxRetryError, not EmptyPoolError
+ # See: https://github.com/shazow/urllib3/issues/76
+ pool._make_request = lambda *args, **kwargs: _raise(HTTPException)
+- with self.assertRaises(MaxRetryError):
+- pool.request('GET', '/', retries=1, pool_timeout=0.01)
++ self.assertRaises(MaxRetryError, pool.request, 'GET', '/', retries=1, pool_timeout=0.01)
+ self.assertEqual(pool.pool.qsize(), POOL_SIZE)
+
+ def test_assert_same_host(self):
+ c = connection_from_url('http://google.com:80')
+
+- with self.assertRaises(HostChangedError):
+- c.request('GET', 'http://yahoo.com:80', assert_same_host=True)
++ self.assertRaises(HostChangedError, c.request, 'GET', 'http://yahoo.com:80', assert_same_host=True)
+
+ def test_pool_close(self):
+ pool = connection_from_url('http://google.com:80')
+@@ -139,16 +136,13 @@ class TestConnectionPool(unittest.TestCa
+ pool.close()
+ self.assertEqual(pool.pool, None)
+
+- with self.assertRaises(ClosedPoolError):
+- pool._get_conn()
++ self.assertRaises(ClosedPoolError, pool._get_conn)
+
+ pool._put_conn(conn3)
+
+- with self.assertRaises(ClosedPoolError):
+- pool._get_conn()
++ self.assertRaises(ClosedPoolError, pool._get_conn)
+
+- with self.assertRaises(Empty):
+- old_pool_queue.get(block=False)
++ self.assertRaises(Empty, old_pool_queue.get, block=False)
+
+
+ if __name__ == '__main__':
+Index: urllib3-1.5/test/test_poolmanager.py
+===================================================================
+--- urllib3-1.5.orig/test/test_poolmanager.py
++++ urllib3-1.5/test/test_poolmanager.py
+@@ -54,13 +54,11 @@ class TestPoolManager(unittest.TestCase)
+ p.clear()
+ self.assertEqual(len(p.pools), 0)
+
+- with self.assertRaises(ClosedPoolError):
+- conn_pool._get_conn()
++ self.assertRaises(ClosedPoolError, conn_pool._get_conn)
+
+ conn_pool._put_conn(conn)
+
+- with self.assertRaises(ClosedPoolError):
+- conn_pool._get_conn()
++ self.assertRaises(ClosedPoolError, conn_pool._get_conn)
+
+ self.assertEqual(len(p.pools), 0)
+
diff --git a/python-urllib3-unbundle.patch b/python-urllib3-unbundle.patch
new file mode 100644
index 0000000..1b5dd64
--- /dev/null
+++ b/python-urllib3-unbundle.patch
@@ -0,0 +1,162 @@
+Index: urllib3-1.5/urllib3/_collections.py
+===================================================================
+--- urllib3-1.5.orig/urllib3/_collections.py
++++ urllib3-1.5/urllib3/_collections.py
+@@ -10,7 +10,10 @@ from threading import Lock
+ try: # Python 2.7+
+ from collections import OrderedDict
+ except ImportError:
+- from .packages.ordered_dict import OrderedDict
++ try: # backport package
++ from ordereddict import OrderedDict
++ except ImportError:
++ from .packages.ordered_dict import OrderedDict
+
+
+ __all__ = ['RecentlyUsedContainer']
+Index: urllib3-1.5/urllib3/connectionpool.py
+===================================================================
+--- urllib3-1.5.orig/urllib3/connectionpool.py
++++ urllib3-1.5/urllib3/connectionpool.py
+@@ -51,8 +51,20 @@ from .exceptions import (
+ TimeoutError,
+ )
+
+-from .packages.ssl_match_hostname import match_hostname, CertificateError
+-from .packages import six
++try:
++ # python3.2+
++ from ssl import match_hostname, CertificateError
++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
++try:
++ import six
++except ImportError:
++ from .packages import six
+
+
+ xrange = six.moves.xrange
+Index: urllib3-1.5/urllib3/filepost.py
+===================================================================
+--- urllib3-1.5.orig/urllib3/filepost.py
++++ urllib3-1.5/urllib3/filepost.py
+@@ -10,8 +10,12 @@ import mimetypes
+ from uuid import uuid4
+ from io import BytesIO
+
+-from .packages import six
+-from .packages.six import b
++try:
++ import six
++ from six import b
++except ImportError:
++ from .packages import six
++ from .packages.six import b
+
+ writer = codecs.lookup('utf-8')[3]
+
+Index: urllib3-1.5/urllib3/response.py
+===================================================================
+--- urllib3-1.5.orig/urllib3/response.py
++++ urllib3-1.5/urllib3/response.py
+@@ -11,7 +11,10 @@ import zlib
+ from io import BytesIO
+
+ from .exceptions import DecodeError
+-from .packages.six import string_types as basestring
++try:
++ from six import string_types as basestring
++except ImportError:
++ from .packages.six import string_types as basestring
+
+
+ log = logging.getLogger(__name__)
+Index: urllib3-1.5/urllib3/util.py
+===================================================================
+--- urllib3-1.5.orig/urllib3/util.py
++++ urllib3-1.5/urllib3/util.py
+@@ -18,7 +18,10 @@ except ImportError: # `poll` doesn't exi
+ except ImportError: # `select` doesn't exist on AppEngine.
+ select = False
+
+-from .packages import six
++try:
++ import six
++except ImporError:
++ from .packages import six
+ from .exceptions import LocationParseError
+
+
+Index: urllib3-1.5/test/test_collections.py
+===================================================================
+--- urllib3-1.5.orig/test/test_collections.py
++++ urllib3-1.5/test/test_collections.py
+@@ -1,7 +1,10 @@
+ import unittest
+
+ from urllib3._collections import RecentlyUsedContainer as Container
+-from urllib3.packages import six
++try:
++ import six
++except ImportError:
++ from urllib3.packages import six
+ xrange = six.moves.xrange
+
+
+Index: urllib3-1.5/test/test_connectionpool.py
+===================================================================
+--- urllib3-1.5.orig/test/test_connectionpool.py
++++ urllib3-1.5/test/test_connectionpool.py
+@@ -1,7 +1,16 @@
+ import unittest
+
+ from urllib3.connectionpool import connection_from_url, HTTPConnectionPool
+-from urllib3.packages.ssl_match_hostname import CertificateError
++try:
++ # python3.2+
++ from ssl import CertificateError
++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.exceptions import (
+ ClosedPoolError,
+ EmptyPoolError,
+Index: urllib3-1.5/test/test_filepost.py
+===================================================================
+--- urllib3-1.5.orig/test/test_filepost.py
++++ urllib3-1.5/test/test_filepost.py
+@@ -1,7 +1,10 @@
+ import unittest
+
+ from urllib3.filepost import encode_multipart_formdata, iter_fields
+-from urllib3.packages.six import b, u
++try:
++ from six import b, u
++except ImportError:
++ from urllib3.packages.six import b, u
+
+
+ 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 at 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,
diff --git a/python-urllib3.spec b/python-urllib3.spec
new file mode 100644
index 0000000..eef1de7
--- /dev/null
+++ b/python-urllib3.spec
@@ -0,0 +1,166 @@
+%if 0%{?fedora}
+%global with_python3 1
+%else
+%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
+%endif
+
+%global srcname urllib3
+
+Name: python-%{srcname}
+Version: 1.5
+Release: 7%{?dist}
+Summary: Python HTTP library with thread-safe connection pooling and file post
+
+License: MIT
+URL: http://urllib3.readthedocs.org/
+Source0: http://pypi.python.org/packages/source/u/%{srcname}/%{srcname}-%{version}.tar.gz
+
+# Patch to change default behaviour to check SSL certs for validity
+# https://bugzilla.redhat.com/show_bug.cgi?id=855320
+Patch0: python-urllib3-default-ssl-cert-validate.patch
+
+### TODO: Send this to upstream urllib3
+# make all imports of things in packages try system copies first
+Patch1: python-urllib3-unbundle.patch
+
+# Fix accept header when behind a proxy
+#https://github.com/shazow/urllib3/pull/93
+#https://github.com/shazow/urllib3/pull/93.patch
+Patch2: python-urllib3-accept-header-for-proxy.patch
+
+# Remove logging-clear-handlers from setup.cfg because it's not available in RHEL6's nose
+Patch100: python-urllib3-old-nose-compat.patch
+### TODO: Send this upstream
+# Compatibility with python-2.6's unittest
+Patch101: python-urllib3-py2.6-compat.patch
+
+BuildArch: noarch
+
+Requires: ca-certificates
+Requires: python-six
+
+Requires: python-backports-ssl_match_hostname
+%if 0%{?rhel} && 0%{?rhel} <= 6
+BuildRequires: python-ordereddict
+Requires: python-ordereddict
+%endif
+
+BuildRequires: python2-devel
+# For unittests
+BuildRequires: python-nose
+BuildRequires: python-six
+BuildRequires: python-tornado
+BuildRequires: python-backports-ssl_match_hostname
+
+%if 0%{?with_python3}
+BuildRequires: python3-devel
+# For unittests
+BuildRequires: python3-nose
+BuildRequires: python3-six
+BuildRequires: python3-tornado
+%endif # with_python3
+
+%description
+Python HTTP module with connection pooling and file POST abilities.
+
+%if 0%{?with_python3}
+%package -n python3-%{srcname}
+Requires: ca-certificates
+Requires: python3-six
+# Note: Will not run with python3 < 3.2 (unless python3-backports-ssl_match_hostname is created)
+Summary: Python3 HTTP library with thread-safe connection pooling and file post
+%description -n python3-%{srcname}
+Python3 HTTP module with connection pooling and file POST abilities.
+%endif # with_python3
+
+
+%prep
+%setup -q -n %{srcname}-%{version}
+
+rm -rf urllib3/packages/
+
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%if 0%{?rhel} && 0%{?rhel} <= 6
+%patch100 -p1
+%patch101 -p1
+%endif
+
+%if 0%{?with_python3}
+rm -rf %{py3dir}
+cp -a . %{py3dir}
+%endif # with_python3
+
+%build
+%{__python} setup.py build
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py build
+popd
+%endif # with_python3
+
+%install
+rm -rf %{buildroot}
+%{__python} setup.py install --skip-build --root %{buildroot}
+
+# dummyserver is part of the unittest framework
+rm -rf %{buildroot}%{python_sitelib}/dummyserver
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py install --skip-build --root %{buildroot}
+
+# dummyserver is part of the unittest framework
+rm -rf %{buildroot}%{python3_sitelib}/dummyserver
+popd
+%endif # with_python3
+
+%check
+nosetests
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+nosetests-%{python3_version}
+popd
+%endif # with_python3
+
+%files
+%doc CHANGES.rst LICENSE.txt README.rst CONTRIBUTORS.txt
+# For noarch packages: sitelib
+%{python_sitelib}/*
+
+%if 0%{?with_python3}
+%files -n python3-%{srcname}
+%doc LICENSE.txt
+# For noarch packages: sitelib
+%{python3_sitelib}/*
+%endif # with_python3
+
+%changelog
+* Mon Oct 28 2013 Ralph Bean <rbean at redhat.com> - 1.5-7
+- Update patch to find ca_certs in the correct place.
+
+* Tue Jun 11 2013 Toshio Kuratomi <toshio at fedoraproject.org> - 1.5-6
+- Fix Requires of python-ordereddict to only apply to RHEL
+
+* Fri Mar 1 2013 Toshio Kuratomi <toshio at fedoraproject.org> - 1.5-5
+- Unbundling finished!
+
+* Fri Mar 01 2013 Ralph Bean <rbean at redhat.com> - 1.5-4
+- Upstream patch to fix Accept header when behind a proxy.
+- Reorganize patch numbers to more clearly distinguish them.
+
+* Wed Feb 27 2013 Ralph Bean <rbean at redhat.com> - 1.5-3
+- Renamed patches to python-urllib3-*
+- Fixed ssl check patch to use the correct cert path for Fedora.
+- Included dependency on ca-certificates
+- Cosmetic indentation changes to the .spec file.
+
+* Tue Feb 5 2013 Toshio Kuratomi <toshio at fedoraproject.org> - 1.5-2
+- python3-tornado BR and run all unittests on python3
+
+* Mon Feb 04 2013 Toshio Kuratomi <toshio at fedoraproject.org> 1.5-1
+- Initial fedora build.
+
diff --git a/sources b/sources
new file mode 100644
index 0000000..24f2a19
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+3ee4b375a095bb6098f1ed75f8058e48 urllib3-1.5.tar.gz
More information about the scm-commits
mailing list