python-requests: update to 2.5.3

Re-do unbundling with symlinks.
Patch is needed to use system ca-certificates instead of bundled ones.
This commit is contained in:
Alessio Sergi 2015-02-28 19:55:55 +01:00
parent 6c9727bf61
commit 9088d4ba93
4 changed files with 27 additions and 190 deletions

View File

@ -1,168 +0,0 @@
diff --git MANIFEST.in MANIFEST.in
index 439de49..7888aee 100644
--- MANIFEST.in
+++ MANIFEST.in
@@ -1 +1 @@
-include README.rst LICENSE NOTICE HISTORY.rst test_requests.py requirements.txt requests/cacert.pem
+include README.rst LICENSE NOTICE HISTORY.rst test_requests.py requirements.txt
diff --git requests/__init__.py requests/__init__.py
index ac2b06c..6d17c3d 100644
--- requests/__init__.py
+++ requests/__init__.py
@@ -50,7 +50,7 @@ __copyright__ = 'Copyright 2014 Kenneth Reitz'
# Attempt to enable urllib3's SNI support, if possible
try:
- from .packages.urllib3.contrib import pyopenssl
+ from urllib3.contrib import pyopenssl
pyopenssl.inject_into_urllib3()
except ImportError:
pass
diff --git requests/adapters.py requests/adapters.py
index c892853..8f5d340 100644
--- requests/adapters.py
+++ requests/adapters.py
@@ -11,22 +11,22 @@ and maintain connections.
import socket
from .models import Response
-from .packages.urllib3 import Retry
-from .packages.urllib3.poolmanager import PoolManager, proxy_from_url
-from .packages.urllib3.response import HTTPResponse
-from .packages.urllib3.util import Timeout as TimeoutSauce
+from urllib3 import Retry
+from urllib3.poolmanager import PoolManager, proxy_from_url
+from urllib3.response import HTTPResponse
+from urllib3.util import Timeout as TimeoutSauce
from .compat import urlparse, basestring
from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers,
prepend_scheme_if_needed, get_auth_from_url, urldefragauth)
from .structures import CaseInsensitiveDict
-from .packages.urllib3.exceptions import ConnectTimeoutError
-from .packages.urllib3.exceptions import HTTPError as _HTTPError
-from .packages.urllib3.exceptions import MaxRetryError
-from .packages.urllib3.exceptions import ProxyError as _ProxyError
-from .packages.urllib3.exceptions import ProtocolError
-from .packages.urllib3.exceptions import ReadTimeoutError
-from .packages.urllib3.exceptions import SSLError as _SSLError
-from .packages.urllib3.exceptions import ResponseError
+from urllib3.exceptions import ConnectTimeoutError
+from urllib3.exceptions import HTTPError as _HTTPError
+from urllib3.exceptions import MaxRetryError
+from urllib3.exceptions import ProxyError as _ProxyError
+from urllib3.exceptions import ProtocolError
+from urllib3.exceptions import ReadTimeoutError
+from urllib3.exceptions import SSLError as _SSLError
+from urllib3.exceptions import ResponseError
from .cookies import extract_cookies_to_jar
from .exceptions import (ConnectionError, ConnectTimeout, ReadTimeout, SSLError,
ProxyError, RetryError)
diff --git requests/certs.py requests/certs.py
index 07e6475..2f2d79b 100644
--- requests/certs.py
+++ requests/certs.py
@@ -18,8 +18,7 @@ try:
except ImportError:
def where():
"""Return the preferred certificate bundle."""
- # vendored bundle inside Requests
- return os.path.join(os.path.dirname(__file__), 'cacert.pem')
+ return '/etc/ssl/certs/ca-certificates.crt'
if __name__ == '__main__':
print(where())
diff --git requests/compat.py requests/compat.py
index c07726e..d3ea9aa 100644
--- requests/compat.py
+++ requests/compat.py
@@ -4,7 +4,7 @@
pythoncompat
"""
-from .packages import chardet
+import chardet
import sys
@@ -91,7 +91,7 @@ if is_py2:
import cookielib
from Cookie import Morsel
from StringIO import StringIO
- from .packages.urllib3.packages.ordered_dict import OrderedDict
+ from collections import OrderedDict
builtin_str = str
bytes = str
diff --git requests/exceptions.py requests/exceptions.py
index 89135a8..b70c525 100644
--- requests/exceptions.py
+++ requests/exceptions.py
@@ -7,7 +7,7 @@ requests.exceptions
This module contains the set of Requests' exceptions.
"""
-from .packages.urllib3.exceptions import HTTPError as BaseHTTPError
+from urllib3.exceptions import HTTPError as BaseHTTPError
class RequestException(IOError):
diff --git requests/models.py requests/models.py
index b728c84..ca867df 100644
--- requests/models.py
+++ requests/models.py
@@ -16,10 +16,10 @@ from .structures import CaseInsensitiveDict
from .auth import HTTPBasicAuth
from .cookies import cookiejar_from_dict, get_cookie_header
-from .packages.urllib3.fields import RequestField
-from .packages.urllib3.filepost import encode_multipart_formdata
-from .packages.urllib3.util import parse_url
-from .packages.urllib3.exceptions import (
+from urllib3.fields import RequestField
+from urllib3.filepost import encode_multipart_formdata
+from urllib3.util import parse_url
+from urllib3.exceptions import (
DecodeError, ReadTimeoutError, ProtocolError, LocationParseError)
from .exceptions import (
HTTPError, MissingSchema, InvalidURL, ChunkedEncodingError,
diff --git requests/sessions.py requests/sessions.py
index 4f30696..03a3c36 100644
--- requests/sessions.py
+++ requests/sessions.py
@@ -21,7 +21,7 @@ from .hooks import default_hooks, dispatch_hook
from .utils import to_key_val_list, default_headers, to_native_string
from .exceptions import (
TooManyRedirects, InvalidSchema, ChunkedEncodingError, ContentDecodingError)
-from .packages.urllib3._collections import RecentlyUsedContainer
+from urllib3._collections import RecentlyUsedContainer
from .structures import CaseInsensitiveDict
from .adapters import HTTPAdapter
diff --git setup.py setup.py
index 813fc87..6eac79f 100755
--- setup.py
+++ setup.py
@@ -18,13 +18,6 @@ if sys.argv[-1] == 'publish':
packages = [
'requests',
- 'requests.packages',
- 'requests.packages.chardet',
- 'requests.packages.urllib3',
- 'requests.packages.urllib3.packages',
- 'requests.packages.urllib3.contrib',
- 'requests.packages.urllib3.util',
- 'requests.packages.urllib3.packages.ssl_match_hostname',
]
requires = []
@@ -43,7 +36,7 @@ setup(
author_email='me@kennethreitz.com',
url='http://python-requests.org',
packages=packages,
- package_data={'': ['LICENSE', 'NOTICE'], 'requests': ['*.pem']},
+ package_data={'': ['LICENSE', 'NOTICE'],},
package_dir={'requests': 'requests'},
include_package_data=True,
install_requires=requires,

View File

@ -1,19 +0,0 @@
diff -Nur requests/compat.py requests/compat.py
--- requests/compat.py 2014-10-29 12:03:06.340767658 +0100
+++ requests/compat.py 2014-10-29 12:30:56.150892159 +0100
@@ -92,6 +92,7 @@
from Cookie import Morsel
from StringIO import StringIO
from collections import OrderedDict
+ from httplib import IncompleteRead
builtin_str = str
bytes = str
@@ -107,6 +108,7 @@
from http.cookies import Morsel
from io import StringIO
from collections import OrderedDict
+ from http.client import IncompleteRead
builtin_str = str
str = str

View File

@ -0,0 +1,14 @@
diff --git requests/certs.py requests/certs.py
index 07e6475..2f2d79b 100644
--- requests/certs.py
+++ requests/certs.py
@@ -18,8 +18,7 @@ try:
except ImportError:
def where():
"""Return the preferred certificate bundle."""
- # vendored bundle inside Requests
- return os.path.join(os.path.dirname(__file__), 'cacert.pem')
+ return '/etc/ssl/certs/ca-certificates.crt'
if __name__ == '__main__':
print(where())

View File

@ -1,6 +1,6 @@
# Template file for 'python-requests'
pkgname=python-requests
version=2.5.1
version=2.5.3
revision=1
noarch=yes
wrksrc="requests-${version}"
@ -17,10 +17,20 @@ maintainer="Alessio Sergi <al3hex@gmail.com>"
homepage="http://docs.python-requests.org/en/latest/"
license="Apache-2.0"
distfiles="${PYPI_SITE}/r/requests/requests-${version}.tar.gz"
checksum=7b7735efd3b1e2323dc9fcef060b380d05f5f18bd0f247f5e9e74a628279de66
checksum=55d7f5619daae94ec49ee81ed8c865e5a2a47f0bbf8e06cf94636bee103eaf65
pre_build() {
rm -rf requests.egg-info
# remove bundled cacerts
rm -f requests/cacert.pem
}
post_install() {
# replace bundled copy of chardet and urllib3
for pyver in $python_versions; do
rm -rf ${DESTDIR}/usr/lib/python${pyver}/site-packages/requests/packages/{chardet,urllib3}
ln -sf ../../chardet ${DESTDIR}/usr/lib/python${pyver}/site-packages/requests/packages/chardet
ln -sf ../../urllib3 ${DESTDIR}/usr/lib/python${pyver}/site-packages/requests/packages/urllib3
done
}
python3.4-requests_package() {