[python-docker-py] Bug 1063369 - fix APIError for requests 1.1

Lokesh Mandvekar lsm5 at fedoraproject.org
Mon Feb 10 18:52:27 UTC 2014


commit ba4bbba94b42ce5c87429625ae0c6ef2690b25d8
Author: Lokesh Mandvekar <lsm5 at redhat.com>
Date:   Mon Feb 10 13:53:01 2014 -0500

    Bug 1063369 - fix APIError for requests 1.1
    
    Signed-off-by: Lokesh Mandvekar <lsm5 at redhat.com>

 python-docker-py.spec |    9 ++++++++-
 requests-rhel6.patch  |   33 +++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 1 deletions(-)
---
diff --git a/python-docker-py.spec b/python-docker-py.spec
index 6f4d3c3..807025d 100644
--- a/python-docker-py.spec
+++ b/python-docker-py.spec
@@ -3,7 +3,7 @@
 
 Name:           python-docker-py
 Version:        0.2.3
-Release:        7%{?dist}
+Release:        8%{?dist}
 Summary:        An API client for docker written in Python
 License:        ASL 2.0
 URL:            http://www.docker.io
@@ -12,6 +12,7 @@ URL:            http://www.docker.io
 ExclusiveArch:  x86_64
 Source0:        https://pypi.python.org/packages/source/d/docker-py/docker-py-%{version}.tar.gz
 Patch0:         python-docker-py-relax-six.patch
+Patch1:         requests-rhel6.patch
 BuildRequires:  python2-devel
 BuildRequires:  python-setuptools
 BuildRequires:  python-tools
@@ -29,6 +30,9 @@ Requires:       docker-io
 %prep
 %setup -q -n docker-py-%{version}
 %patch0 -p1 -b python-docker-py-relax-six
+%if 6 <= 0%{?rhel} < 7
+%patch1 -p1 -b requests-rhel6
+%endif
 
 %build
 %{__python} setup.py build
@@ -45,6 +49,9 @@ Requires:       docker-io
 %{python_sitelib}/docker_py-%{version}-py2*.egg-info/*
 
 %changelog
+* Mon Feb 10 2014 Lokesh Mandvekar <lsm5 at redhat.com> 0.2.3-8
+- Bug 1063369 - Fix APIError for python-requests-1.1 on rhel6
+
 * Sat Feb 08 2014 Lokesh Mandvekar <lsm5 at redhat.com> 0.2.3-7
 - Bug 1048667 - disable debug package cause archful
 
diff --git a/requests-rhel6.patch b/requests-rhel6.patch
new file mode 100644
index 0000000..a480474
--- /dev/null
+++ b/requests-rhel6.patch
@@ -0,0 +1,33 @@
+From cfbd41ca56ad87319a134451121cc6d8f034c6c1 Mon Sep 17 00:00:00 2001
+From: "Chris St. Pierre" <chris.a.st.pierre at gmail.com>
+Date: Mon, 10 Feb 2014 09:52:51 -0500
+Subject: [PATCH] Fix APIError for requests 1.1
+
+requests 1.1, which is what's available on CentOS 6, doesn't support
+passing the response code as a keyword argument.  It can be set after
+the fact on both requests 1.1 and 1.2.
+
+Docker-DCO-1.1-Signed-off-by: Chris St. Pierre <chris.a.st.pierre at gmail.com> (github: stpierre)
+---
+ docker/client.py | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/docker/client.py b/docker/client.py
+index 7983f10..531a926 100644
+--- a/docker/client.py
++++ b/docker/client.py
+@@ -35,7 +35,10 @@ STREAM_HEADER_SIZE_BYTES = 8
+
+ class APIError(requests.exceptions.HTTPError):
+     def __init__(self, message, response, explanation=None):
+-        super(APIError, self).__init__(message, response=response)
++        # requests 1.2 supports response as a keyword argument, but
++        # requests 1.1 doesn't
++        super(APIError, self).__init__(message)
++        self.response = response
+
+         self.explanation = explanation
+
+-- 
+1.8.5.3
+


More information about the scm-commits mailing list