[pyOpenSSL/f14/master] - Fix incompatibility with python-2.7's socket module.

Toshio くらとみ toshio at fedoraproject.org
Wed Dec 8 00:01:29 UTC 2010


commit 04f28109d74a0c5e21432d346f966513cd27ac7e
Author: Toshio Kuratomi <toshio at fedoraproject.org>
Date:   Tue Dec 7 16:01:14 2010 -0800

    - Fix incompatibility with python-2.7's socket module.
    
    Conflicts:
    
    	pyOpenSSL.spec

 pyOpenSSL-py2.7-memoryview.patch |   35 +++++++++++++++++++++++++++++++++++
 pyOpenSSL.spec                   |   14 +++++++++++---
 2 files changed, 46 insertions(+), 3 deletions(-)
---
diff --git a/pyOpenSSL-py2.7-memoryview.patch b/pyOpenSSL-py2.7-memoryview.patch
new file mode 100644
index 0000000..271b725
--- /dev/null
+++ b/pyOpenSSL-py2.7-memoryview.patch
@@ -0,0 +1,35 @@
+Index: pyOpenSSL-0.10/src/ssl/connection.c
+===================================================================
+--- pyOpenSSL-0.10.orig/src/ssl/connection.c
++++ pyOpenSSL-0.10/src/ssl/connection.c
+@@ -369,17 +369,20 @@ has been sent.\n\
+ @param buf: The string to send\n\
+ @param flags: (optional) Included for compatability with the socket\n\
+               API, the value is ignored\n\
+- at return: The number of bytes written\n\
++ at return: None\n\
+ ";
+ static PyObject *
+ ssl_Connection_sendall(ssl_ConnectionObj *self, PyObject *args)
+ {
++    Py_buffer pbuf;
+     char *buf;
+     int len, ret, err, flags;
+     PyObject *pyret = Py_None;
+ 
+-    if (!PyArg_ParseTuple(args, "s#|i:sendall", &buf, &len, &flags))
++    if (!PyArg_ParseTuple(args, "s*|i:sendall", &pbuf, &flags))
+         return NULL;
++    buf = pbuf.buf;
++    len = pbuf.len;
+ 
+     do {
+         MY_BEGIN_ALLOW_THREADS(self->tstate)
+@@ -405,6 +408,7 @@ ssl_Connection_sendall(ssl_ConnectionObj
+             break;
+         }    
+     } while (len > 0);
++    PyBuffer_Release(&pbuf);
+ 
+     Py_XINCREF(pyret);
+     return pyret;
diff --git a/pyOpenSSL.spec b/pyOpenSSL.spec
index aaeed98..55a1cac 100644
--- a/pyOpenSSL.spec
+++ b/pyOpenSSL.spec
@@ -3,11 +3,13 @@
 Summary: Python wrapper module around the OpenSSL library
 Name: pyOpenSSL
 Version: 0.9
-Release: 2%{?dist}
+Release: 3%{?dist}
 Source0: http://pyopenssl.sf.net/%{name}-%{version}.tar.gz
 Patch0: pyOpenSSL-0.7-openssl.patch
 Patch2: pyOpenSSL-elinks.patch
 Patch3: pyOpenSSL-nopdfout.patch
+# Submitted upstream: https://bugs.launchpad.net/pyopenssl/+bug/686804
+Patch4: pyOpenSSL-py2.7-memoryview.patch
 # Hopefully the following patch is unnecessary now
 #Patch4: pyOpenSSL-threadsafe.patch
 License: LGPLv2+
@@ -30,6 +32,10 @@ High-level wrapper around a subset of the OpenSSL library, includes
 %patch0 -p1 -b .posixIncludes
 %patch2 -p1 -b .elinks
 %patch3 -p1 -b .nopdfout
+# This is necessary on python-2.7+ but works on python-2.6+
+%if 0%{?fedora} >= 13 || 0%{?rhel} >= 5
+%patch4 -p1 -b .py2.7
+%endif
 # Fix permissions for debuginfo package
 %{__chmod} -x src/ssl/connection.c
 
@@ -40,8 +46,7 @@ CFLAGS="%{optflags}" %{__python} setup.py build
 find doc/ -name pyOpenSSL.\*
 
 %install
-%{__rm} -rf %{buildroot}
-%{__python} setup.py install -O1 --skip-build --root %{buildroot}
+%{__python} setup.py install --skip-build --root %{buildroot}
 
 %clean
 %{__rm} -rf %{buildroot}
@@ -53,6 +58,9 @@ find doc/ -name pyOpenSSL.\*
 %{python_sitearch}/%{name}*.egg-info
 
 %changelog
+* Tue Dec 7 2010 Toshio Kuratomi <toshio at fedoraproject.org> - 0.9-3
+- Fix incompatibility with python-2.7's socket module.
+
 * Wed Jul 21 2010 David Malcolm <dmalcolm at redhat.com> - 0.9-2
 - Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
 


More information about the scm-commits mailing list