Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Erik Johnson
e6241586d9 Initial el5 build 2014-09-16 17:51:03 -05:00
6 changed files with 169 additions and 216 deletions

View file

@ -0,0 +1,44 @@
From 415619361cc23dd87b1a7a5fd0cfba38e33d24fd Mon Sep 17 00:00:00 2001
From: Ralph Bean <rbean@redhat.com>
Date: Wed, 27 Feb 2013 09:16:20 -0500
Subject: [PATCH] system cert bundle
---
requests/certs.py | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/requests/certs.py b/requests/certs.py
index 8148276..6e07f5e 100644
--- a/requests/certs.py
+++ b/requests/certs.py
@@ -10,22 +10,15 @@ This module returns the preferred default CA certificate bundle.
If you are packaging Requests, e.g., for a Linux distribution or a managed
environment, you can change the definition of where() to return a separately
packaged CA bundle.
-"""
-
-import os.path
-certifi = None
-try:
- import certifi
-except ImportError:
- pass
+We return "/etc/pki/tls/certs/ca-bundle.crt" provided by the openssl
+package.
+"""
def where():
"""Return the preferred certificate bundle."""
- if certifi:
- return certifi.where()
-
- return os.path.join(os.path.dirname(__file__), 'cacert.pem')
+ # Don't use the certs bundled with requests, use openssl'.
+ return "/etc/pki/tls/certs/ca-bundle.crt"
if __name__ == '__main__':
print(where())
--
1.8.1.2

View file

@ -1,37 +0,0 @@
From ad98b45e959dc7325c294c26d94e68901700c407 Mon Sep 17 00:00:00 2001
From: Ralph Bean <rbean@redhat.com>
Date: Mon, 1 Jul 2013 14:50:34 -0400
Subject: [PATCH 1/3] system cert bundle
---
requests/certs.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/requests/certs.py b/requests/certs.py
index bc00826..9b78e3b 100644
--- a/requests/certs.py
+++ b/requests/certs.py
@@ -10,15 +10,15 @@ This module returns the preferred default CA certificate bundle.
If you are packaging Requests, e.g., for a Linux distribution or a managed
environment, you can change the definition of where() to return a separately
packaged CA bundle.
-"""
-import os.path
+We return "/etc/pki/tls/certs/ca-bundle.crt" provided by the ca-certificates
+package.
+"""
def where():
- """Return the preferred certificate bundle."""
- # vendored bundle inside Requests
- return os.path.join(os.path.dirname(__file__), 'cacert.pem')
+ """ Don't use the certs bundled with requests, use ca-certificates. """
+ return "/etc/pki/tls/certs/ca-bundle.crt"
if __name__ == '__main__':
print(where())
--
1.8.3.1

View file

@ -1,12 +1,25 @@
diff -up ./requests/compat.py.orig ./requests/compat.py From 07c1df1053a61ec5097fe79c68aba7fda7bac3b5 Mon Sep 17 00:00:00 2001
--- ./requests/compat.py.orig 2014-05-30 00:23:21.910322912 -0700 From: Ralph Bean <rbean@redhat.com>
+++ ./requests/compat.py 2014-05-30 00:24:06.697631425 -0700 Date: Wed, 27 Feb 2013 10:03:41 -0500
Subject: [PATCH] Use system chardet, not charade.
---
requests/compat.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/requests/compat.py b/requests/compat.py
index 5bd4fcb..39421ed 100644
--- a/requests/compat.py
+++ b/requests/compat.py
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
pythoncompat pythoncompat
""" """
-from .packages import chardet -from .packages import charade as chardet
+import chardet +import chardet
import sys import sys
--
1.8.1.2

View file

@ -1,92 +1,81 @@
diff -up ./requests/adapters.py.orig ./requests/adapters.py From 5d23c608e72025f72e1f3223cb6c7e3979e93c7f Mon Sep 17 00:00:00 2001
--- ./requests/adapters.py.orig 2014-05-30 00:27:36.151074219 -0700 From: Ralph Bean <rbean@redhat.com>
+++ ./requests/adapters.py 2014-05-30 00:31:26.712662414 -0700 Date: Thu, 28 Feb 2013 10:57:20 -0500
@@ -11,18 +11,18 @@ and maintain connections. Subject: [PATCH] system-urllib3
---
requests/adapters.py | 12 ++++++------
requests/compat.py | 6 +++++-
requests/models.py | 4 ++--
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/requests/adapters.py b/requests/adapters.py
index 5f9d9c7..1f61bd6 100644
--- a/requests/adapters.py
+++ b/requests/adapters.py
@@ -11,17 +11,17 @@ and maintain connections.
import socket import socket
from .models import Response from .models import Response
-from .packages.urllib3.poolmanager import PoolManager, proxy_from_url -from .packages.urllib3.poolmanager import PoolManager, proxy_from_url
-from .packages.urllib3.response import HTTPResponse -from .packages.urllib3.response import HTTPResponse
-from .packages.urllib3.util import Timeout as TimeoutSauce
+from urllib3.poolmanager import PoolManager, proxy_from_url +from urllib3.poolmanager import PoolManager, proxy_from_url
+from urllib3.response import HTTPResponse +from urllib3.response import HTTPResponse
+from urllib3.util import Timeout as TimeoutSauce from .hooks import dispatch_hook
from .compat import urlparse, basestring, urldefrag, unquote from .compat import urlparse, basestring, urldefrag
from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers, from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers,
prepend_scheme_if_needed, get_auth_from_url) prepend_scheme_if_needed)
from .structures import CaseInsensitiveDict from .structures import CaseInsensitiveDict
-from .packages.urllib3.exceptions import MaxRetryError -from .packages.urllib3.exceptions import MaxRetryError
-from .packages.urllib3.exceptions import TimeoutError -from .packages.urllib3.exceptions import TimeoutError
-from .packages.urllib3.exceptions import SSLError as _SSLError -from .packages.urllib3.exceptions import SSLError as _SSLError
-from .packages.urllib3.exceptions import HTTPError as _HTTPError -from .packages.urllib3.exceptions import HTTPError as _HTTPError
-from .packages.urllib3.exceptions import ProxyError as _ProxyError
+from urllib3.exceptions import MaxRetryError +from urllib3.exceptions import MaxRetryError
+from urllib3.exceptions import TimeoutError +from urllib3.exceptions import TimeoutError
+from urllib3.exceptions import SSLError as _SSLError +from urllib3.exceptions import SSLError as _SSLError
+from urllib3.exceptions import HTTPError as _HTTPError +from urllib3.exceptions import HTTPError as _HTTPError
+from urllib3.exceptions import ProxyError as _ProxyError
from .cookies import extract_cookies_to_jar from .cookies import extract_cookies_to_jar
from .exceptions import ConnectionError, Timeout, SSLError, ProxyError from .exceptions import ConnectionError, Timeout, SSLError
from .auth import _basic_auth_str
diff -up ./requests/compat.py.orig ./requests/compat.py diff --git a/requests/compat.py b/requests/compat.py
--- ./requests/compat.py.orig 2014-05-30 00:46:53.888049149 -0700 index 39421ed..d9ab218 100644
+++ ./requests/compat.py 2014-05-30 00:54:17.647105931 -0700 --- a/requests/compat.py
@@ -89,7 +89,10 @@ if is_py2: +++ b/requests/compat.py
@@ -89,7 +89,11 @@ if is_py2:
import cookielib import cookielib
from Cookie import Morsel from Cookie import Morsel
from StringIO import StringIO from StringIO import StringIO
- from .packages.urllib3.packages.ordered_dict import OrderedDict - from .packages.urllib3.packages.ordered_dict import OrderedDict
+
+ try: + try:
+ from collections import OrderedDict + from collections import OrderedDict
+ except ImportError: + except ImportError:
+ from ordereddict import OrderedDict + from ordereddict import OrderedDict
from httplib import IncompleteRead
builtin_str = str builtin_str = str
diff -up ./requests/exceptions.py.orig ./requests/exceptions.py bytes = str
--- ./requests/exceptions.py.orig 2014-05-30 00:59:00.825056566 -0700 diff --git a/requests/models.py b/requests/models.py
+++ ./requests/exceptions.py 2014-05-30 00:59:13.416143297 -0700 index 5202e6f..218b4f2 100644
@@ -7,7 +7,7 @@ requests.exceptions --- a/requests/models.py
This module contains the set of Requests' exceptions. +++ b/requests/models.py
@@ -17,7 +17,7 @@ from .status_codes import codes
"""
-from .packages.urllib3.exceptions import HTTPError as BaseHTTPError
+from urllib3.exceptions import HTTPError as BaseHTTPError
class RequestException(IOError):
diff -up ./requests/__init__.py.orig ./requests/__init__.py
--- ./requests/__init__.py.orig 2014-05-30 00:27:56.025211120 -0700
+++ ./requests/__init__.py 2014-05-30 00:54:37.009239302 -0700
@@ -48,13 +48,6 @@ __author__ = 'Kenneth Reitz'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2014 Kenneth Reitz'
-# Attempt to enable urllib3's SNI support, if possible
-try:
- from .packages.urllib3.contrib import pyopenssl
- pyopenssl.inject_into_urllib3()
-except ImportError:
- pass
-
from . import utils
from .models import Request, Response, PreparedRequest
from .api import request, get, head, post, patch, put, delete, options
diff -up ./requests/models.py.orig ./requests/models.py
--- ./requests/models.py.orig 2014-05-30 00:27:18.926955573 -0700
+++ ./requests/models.py 2014-05-30 00:31:12.714565990 -0700
@@ -16,10 +16,10 @@ from .structures import CaseInsensitiveD
from .auth import HTTPBasicAuth from .auth import HTTPBasicAuth
from .cookies import cookiejar_from_dict, get_cookie_header 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.filepost import encode_multipart_formdata
-from .packages.urllib3.util import parse_url
-from .packages.urllib3.exceptions import DecodeError
+from urllib3.fields import RequestField
+from urllib3.filepost import encode_multipart_formdata +from urllib3.filepost import encode_multipart_formdata
+from urllib3.util import parse_url from .exceptions import HTTPError, RequestException, MissingSchema, InvalidURL
+from urllib3.exceptions import DecodeError from .utils import (
from .exceptions import ( stream_untransfer, guess_filename, requote_uri,
HTTPError, RequestException, MissingSchema, InvalidURL, @@ -121,7 +121,7 @@ class RequestEncodingMixin(object):
ChunkedEncodingError, ContentDecodingError) fp = StringIO(fp)
if isinstance(fp, bytes):
fp = BytesIO(fp)
-
+
if ft:
new_v = (fn, fp.read(), ft)
else:
--
1.8.1.2

View file

@ -1,20 +1,21 @@
%if 0%{?fedora} %global __python2 /usr/bin/python2.6
%global _with_python3 1 %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")
%else
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
%endif
Name: python-requests %global srcname requests
Version: 2.3.0
Release: 2%{?dist} Name: python-%{srcname}
Version: 1.1.0
Release: 5%{?dist}
Summary: HTTP library, written in Python, for human beings Summary: HTTP library, written in Python, for human beings
Group: Development/Languages
License: ASL 2.0 License: ASL 2.0
URL: http://pypi.python.org/pypi/requests URL: http://pypi.python.org/pypi/requests
Source0: http://pypi.python.org/packages/source/r/requests/requests-%{version}.tar.gz Source0: http://pypi.python.org/packages/source/r/requests/requests-%{version}.tar.gz
# Explicitly use the system certificates in ca-certificates. # Explicitly use the system certificates in openssl.
# https://bugzilla.redhat.com/show_bug.cgi?id=904614 # https://bugzilla.redhat.com/show_bug.cgi?id=904614
Patch0: python-requests-system-cert-bundle.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1124060
Patch0: python-requests-system-cert-bundle-el5.patch
# Unbundle python-charade (a fork of python-chardet). # Unbundle python-charade (a fork of python-chardet).
# https://bugzilla.redhat.com/show_bug.cgi?id=904623 # https://bugzilla.redhat.com/show_bug.cgi?id=904623
Patch1: python-requests-system-chardet-not-charade.patch Patch1: python-requests-system-chardet-not-charade.patch
@ -22,41 +23,40 @@ Patch1: python-requests-system-chardet-not-charade.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=904623 # https://bugzilla.redhat.com/show_bug.cgi?id=904623
Patch2: python-requests-system-urllib3.patch Patch2: python-requests-system-urllib3.patch
BuildRoot: %{_tmppath}/%{srcname}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python-chardet
BuildRequires: python-urllib3 >= 1.8.2
Requires: ca-certificates BuildRequires: python26-devel
Requires: python-chardet BuildRequires: python26-distribute
Requires: python-urllib3 >= 1.8.2 BuildRequires: python26-chardet
BuildRequires: python26-ordereddict
BuildRequires: python26-urllib3
%if 0%{?rhel} && 0%{?rhel} <= 6 Requires: openssl
BuildRequires: python-ordereddict Requires: python26
Requires: python-ordereddict Requires: python26-chardet
%endif Requires: python26-ordereddict
Requires: python26-urllib3
%description %description
Most existing Python modules for sending HTTP requests are extremely verbose and Most existing Python modules for sending HTTP requests are extremely verbose
cumbersome. Pythons built-in urllib2 module provides most of the HTTP and cumbersome. Python's built-in urllib2 module provides most of the HTTP
capabilities you should need, but the API is thoroughly broken. This library is capabilities you should need, but the API is thoroughly broken. This library is
designed to make HTTP requests easy for developers. designed to make HTTP requests easy for developers.
%if 0%{?_with_python3} %package -n python26-%{srcname}
%package -n python3-requests Group: Development/Languages
Summary: HTTP library, written in Python, for human beings Summary: HTTP library, written in Python, for human beings
BuildRequires: python3-devel Requires: python26
BuildRequires: python3-chardet Requires: python26-chardet
BuildRequires: python3-urllib3 >= 1.8.2 Requires: python26-ordereddict
Requires: python3-chardet Requires: python26-urllib3
Requires: python3-urllib3 >= 1.8.2
%description -n python3-requests %description -n python26-%{srcname}
Most existing Python modules for sending HTTP requests are extremely verbose and Most existing Python modules for sending HTTP requests are extremely verbose and
cumbersome. Pythons built-in urllib2 module provides most of the HTTP cumbersome. Python's built-in urllib2 module provides most of the HTTP
capabilities you should need, but the API is thoroughly broken. This library is capabilities you should need, but the API is thoroughly broken. This library is
designed to make HTTP requests easy for developers. designed to make HTTP requests easy for developers.
%endif
%prep %prep
%setup -q -n requests-%{version} %setup -q -n requests-%{version}
@ -68,26 +68,8 @@ designed to make HTTP requests easy for developers.
# Unbundle the certificate bundle from mozilla. # Unbundle the certificate bundle from mozilla.
rm -rf requests/cacert.pem rm -rf requests/cacert.pem
%if 0%{?_with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif # with_python3
%build %build
%if 0%{?_with_python3} %{__python2} setup.py build
pushd %{py3dir}
%{__python3} setup.py build
# Unbundle chardet. Patch1 switches usage to system chardet.
rm -rf build/lib/requests/packages/chardet
# Unbundle urllib3. Patch1 switches usage to system urllib3.
rm -rf build/lib/requests/packages
popd
%endif
%{__python} setup.py build
# Unbundle chardet. Patch1 switches usage to system chardet. # Unbundle chardet. Patch1 switches usage to system chardet.
rm -rf build/lib/requests/packages/charade rm -rf build/lib/requests/packages/charade
@ -96,69 +78,22 @@ rm -rf build/lib/requests/packages/charade
rm -rf build/lib/requests/packages rm -rf build/lib/requests/packages
%install %install
rm -rf $RPM_BUILD_ROOT rm -rf %{buildroot}
%if 0%{?_with_python3} %{__python2} setup.py install --skip-build --root $RPM_BUILD_ROOT
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT
popd
%endif
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT %clean
rm -rf %{buildroot}
## The tests succeed if run locally, but fail in koji. %files -n python26-%{srcname}
## They require an active network connection to query httpbin.org
#%%check
#%%{__python} test_requests.py
#%%if 0%%{?_with_python3}
#pushd %%{py3dir}
#%%{__python3} test_requests.py
#popd
#%%endif
%files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc NOTICE LICENSE README.rst HISTORY.rst %doc NOTICE LICENSE README.rst HISTORY.rst
%{python_sitelib}/*.egg-info %{python2_sitelib}/*.egg-info
%dir %{python_sitelib}/requests %dir %{python2_sitelib}/requests
%{python_sitelib}/requests/* %{python2_sitelib}/requests/*
%if 0%{?_with_python3}
%files -n python3-requests
%doc NOTICE LICENSE README.rst HISTORY.rst
%{python3_sitelib}/*.egg-info
%{python3_sitelib}/requests/
%endif
%changelog %changelog
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.3.0-2 * Tue Sep 16 2014 Erik Johnson <erik@saltstack.com> - 1.1.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild - Initial EL5 build
* Thu May 29 2014 Arun S A G <sagarun@gmail.com> - 2.3.0-1
- Latest upstream
* Wed May 14 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 2.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
* Wed Sep 25 2013 Ralph Bean <rbean@redhat.com> - 2.0.0-1
- Latest upstream.
- Add doc macro to the python3 files section.
- Require python-urllib3 greater than or at 1.7.1.
* Mon Aug 26 2013 Rex Dieter <rdieter@fedoraproject.org> 1.2.3-5
- fix versioned dep on python-urllib3
* Mon Aug 26 2013 Ralph Bean <rbean@redhat.com> - 1.2.3-4
- Explicitly versioned the requirements on python-urllib3.
* Thu Aug 22 2013 Ralph Bean <rbean@redhat.com> - 1.2.3-3
- Release bump for a coupled update with python-urllib3.
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Mon Jul 01 2013 Ralph Bean <rbean@redhat.com> - 1.2.3-1
- Latest upstream.
- Fixed bogus date in changelog.
* Tue Jun 11 2013 Ralph Bean <rbean@redhat.com> - 1.1.0-4 * Tue Jun 11 2013 Ralph Bean <rbean@redhat.com> - 1.1.0-4
- Correct a rhel conditional on python-ordereddict - Correct a rhel conditional on python-ordereddict
@ -189,7 +124,13 @@ popd
- Fix a problem with cookie handling - Fix a problem with cookie handling
+ https://bugzilla.redhat.com/show_bug.cgi?id=906924 + https://bugzilla.redhat.com/show_bug.cgi?id=906924
* Mon Oct 22 2012 Arun S A G <sagarun@gmail.com> 0.14.1-1 * Thu Jan 31 2013 Ralph Bean <rbean@redhat.com> 0.14.1-3
- Introduced backport patch to support better cookie handling.
* Mon Jan 28 2013 Ralph Bean <rbean@redhat.com> 0.14.1-2
- Merged latest rawhide into el6.
* Wed Oct 22 2012 Arun S A G <sagarun@gmail.com> 0.14.1-1
- Updated to latest upstream release - Updated to latest upstream release
* Sun Jun 10 2012 Arun S A G <sagarun@gmail.com> 0.13.1-1 * Sun Jun 10 2012 Arun S A G <sagarun@gmail.com> 0.13.1-1
@ -198,6 +139,9 @@ popd
- No more async requests use grrequests https://github.com/kennethreitz/grequests - No more async requests use grrequests https://github.com/kennethreitz/grequests
- Remove gevent as it is no longer required by requests - Remove gevent as it is no longer required by requests
* Sun Apr 09 2012 Arun S A G <sagarun@gmail.com> 0.11.1-2
- Fix rhbz#808912
* Sun Apr 01 2012 Arun S A G <sagarun@gmail.com> 0.11.1-1 * Sun Apr 01 2012 Arun S A G <sagarun@gmail.com> 0.11.1-1
- Updated to upstream release 0.11.1 - Updated to upstream release 0.11.1

View file

@ -1 +1 @@
7449ffdc8ec9ac37bbcd286003c80f00 requests-2.3.0.tar.gz a0158815af244c32041a3147ee09abf3 requests-1.1.0.tar.gz