New package: python-urllib3-1.8.3 with python3.4 subpkg

Add patch to use system python-six and python-backports-ssl-match-hostname
(python2-only).
This commit is contained in:
Alessio Sergi 2014-07-07 10:17:17 +02:00
parent fb61a19a67
commit 6528f96344
3 changed files with 220 additions and 0 deletions

View file

@ -0,0 +1,189 @@
diff -Nur dummyserver/handlers.py dummyserver/handlers.py
--- dummyserver/handlers.py 2014-04-18 07:35:23.000000000 +0200
+++ dummyserver/handlers.py 2014-07-04 12:18:35.064230194 +0200
@@ -190,7 +190,7 @@
"""
import tornado.httputil
import email.utils
- from urllib3.packages import six
+ import six
if not six.PY3:
line = line.encode('utf-8')
parts = tornado.httputil._parseparam(';' + line)
diff -Nur setup.py setup.py
--- setup.py 2014-06-24 20:19:21.000000000 +0200
+++ setup.py 2014-07-04 12:18:55.856229523 +0200
@@ -45,7 +45,6 @@
url='http://urllib3.readthedocs.org/',
license='MIT',
packages=['urllib3',
- 'urllib3.packages', 'urllib3.packages.ssl_match_hostname',
'urllib3.contrib', 'urllib3.util',
],
requires=requirements,
diff -Nur test/test_collections.py test/test_collections.py
--- test/test_collections.py 2014-03-15 01:05:07.000000000 +0100
+++ test/test_collections.py 2014-07-04 12:25:52.942216059 +0200
@@ -4,7 +4,7 @@
HTTPHeaderDict,
RecentlyUsedContainer as Container
)
-from urllib3.packages import six
+import six
xrange = six.moves.xrange
diff -Nur test/test_connectionpool.py test/test_connectionpool.py
--- test/test_connectionpool.py 2014-03-04 20:08:03.000000000 +0100
+++ test/test_connectionpool.py 2014-07-06 19:49:59.995827758 +0200
@@ -6,7 +6,12 @@
HTTPConnectionPool,
)
from urllib3.util import Timeout
-from urllib3.packages.ssl_match_hostname import CertificateError
+try:
+ # python3.2+
+ from ssl import CertificateError
+except ImportError:
+ # Older python where the backport from pypi is installed
+ from backports.ssl_match_hostname import CertificateError
from urllib3.exceptions import (
ClosedPoolError,
EmptyPoolError,
diff -Nur test/test_fields.py test/test_fields.py
--- test/test_fields.py 2014-03-04 20:08:03.000000000 +0100
+++ test/test_fields.py 2014-07-04 12:27:03.632213778 +0200
@@ -1,7 +1,7 @@
import unittest
from urllib3.fields import guess_content_type, RequestField
-from urllib3.packages.six import u
+from six import u
class TestRequestField(unittest.TestCase):
diff -Nur test/test_filepost.py test/test_filepost.py
--- test/test_filepost.py 2014-03-15 01:05:07.000000000 +0100
+++ test/test_filepost.py 2014-07-04 12:27:22.673213163 +0200
@@ -2,7 +2,7 @@
from urllib3.filepost import encode_multipart_formdata, iter_fields
from urllib3.fields import RequestField
-from urllib3.packages.six import b, u
+from six import b, u
BOUNDARY = '!! test boundary !!'
diff -Nur test-requirements.txt test-requirements.txt
--- test-requirements.txt 2014-06-24 20:19:21.000000000 +0200
+++ test-requirements.txt 2014-07-06 19:48:14.791831154 +0200
@@ -2,3 +2,5 @@
mock==1.0.1
tornado==3.1.1
coverage==3.6
+six
+backports.ssl_match_hostname
diff -Nur urllib3/_collections.py urllib3/_collections.py
--- urllib3/_collections.py 2014-06-24 01:44:37.000000000 +0200
+++ urllib3/_collections.py 2014-07-04 12:51:43.761166000 +0200
@@ -16,11 +16,8 @@
pass
-try: # Python 2.7+
- from collections import OrderedDict
-except ImportError:
- from .packages.ordered_dict import OrderedDict
-from .packages.six import itervalues
+from collections import OrderedDict
+from six import itervalues
__all__ = ['RecentlyUsedContainer', 'HTTPHeaderDict']
diff -Nur urllib3/connection.py urllib3/connection.py
--- urllib3/connection.py 2014-06-24 01:44:37.000000000 +0200
+++ urllib3/connection.py 2014-07-06 19:52:27.263823004 +0200
@@ -33,8 +33,13 @@
from .exceptions import (
ConnectTimeoutError,
)
-from .packages.ssl_match_hostname import match_hostname
-from .packages import six
+try:
+ # python3.2+
+ from ssl import match_hostname, CertificateError
+except ImportError:
+ # Older python where the backport from pypi is installed
+ from backports.ssl_match_hostname import match_hostname, CertificateError
+import six
from .util import (
assert_fingerprint,
resolve_cert_reqs,
diff -Nur urllib3/connectionpool.py urllib3/connectionpool.py
--- urllib3/connectionpool.py 2014-06-24 01:44:37.000000000 +0200
+++ urllib3/connectionpool.py 2014-07-06 19:51:36.446824644 +0200
@@ -30,8 +30,13 @@
ReadTimeoutError,
ProxyError,
)
-from .packages.ssl_match_hostname import CertificateError
-from .packages import six
+try:
+ # python3.2+
+ from ssl import match_hostname, CertificateError
+except ImportError:
+ # Older python where the backport from pypi is installed
+ from backports.ssl_match_hostname import match_hostname, CertificateError
+import six
from .connection import (
port_by_scheme,
DummyConnection,
diff -Nur urllib3/fields.py urllib3/fields.py
--- urllib3/fields.py 2014-06-24 01:44:37.000000000 +0200
+++ urllib3/fields.py 2014-07-04 12:31:13.137205724 +0200
@@ -7,7 +7,7 @@
import email.utils
import mimetypes
-from .packages import six
+import six
def guess_content_type(filename, default='application/octet-stream'):
diff -Nur urllib3/filepost.py urllib3/filepost.py
--- urllib3/filepost.py 2014-06-24 01:44:37.000000000 +0200
+++ urllib3/filepost.py 2014-07-04 12:31:58.762204251 +0200
@@ -9,8 +9,8 @@
from uuid import uuid4
from io import BytesIO
-from .packages import six
-from .packages.six import b
+import six
+from six import b
from .fields import RequestField
writer = codecs.lookup('utf-8')[3]
diff -Nur urllib3/response.py urllib3/response.py
--- urllib3/response.py 2014-06-24 01:44:37.000000000 +0200
+++ urllib3/response.py 2014-07-04 12:32:18.507203614 +0200
@@ -11,7 +11,7 @@
from ._collections import HTTPHeaderDict
from .exceptions import DecodeError, ReadTimeoutError
-from .packages.six import string_types as basestring, binary_type
+from six import string_types as basestring, binary_type
from .util import is_fp_closed
diff -Nur urllib3/util/request.py urllib3/util/request.py
--- urllib3/util/request.py 2014-06-24 01:44:37.000000000 +0200
+++ urllib3/util/request.py 2014-07-04 12:29:20.645209355 +0200
@@ -1,6 +1,6 @@
from base64 import b64encode
-from ..packages import six
+import six
ACCEPT_ENCODING = 'gzip,deflate'

View file

@ -0,0 +1,30 @@
# Template file for 'python-urllib3'
pkgname=python-urllib3
version=1.8.3
revision=1
noarch=yes
wrksrc="${pkgname#*-}-${version}"
build_style="python-module"
python_versions="2.7 3.4"
hostmakedepends="python-devel python3.4-devel"
makedepends="${hostmakedepends} python-backports-ssl-match-hostname
python-six python3.4-six"
depends="python python-backports-ssl-match-hostname python-six ca-certificates"
pycompile_module="urllib3"
short_desc="HTTP library with thread-safe connection pooling (Python2)"
maintainer="Alessio Sergi <al3hex@gmail.com>"
homepage="https://github.com/shazow/urllib3"
license="MIT"
distfiles="https://pypi.python.org/packages/source/u/${pkgname#*-}/${pkgname#*-}-${version}.tar.gz"
checksum=4b162cffb6c7dde47b47ecee741f8a00953512541241e61d0f8292107a865426
python3.4-urllib3_package() {
noarch=yes
depends="python3.4 python3.4-six ca-certificates"
pycompile_version="3.4"
pycompile_module="urllib3"
short_desc="${short_desc/Python2/Python3.4}"
pkg_install() {
vmove usr/lib/python3.4
}
}

1
srcpkgs/python3.4-urllib3 Symbolic link
View file

@ -0,0 +1 @@
python-urllib3