Date: Saturday, March 19, 2016 @ 04:41:09
  Author: fyan
Revision: 262067

upgpkg: pyopenssl 0.15.1-3

add a patch to work with new cryptography

Added:
  pyopenssl/trunk/new-cryptography.patch
Modified:
  pyopenssl/trunk/PKGBUILD

------------------------+
 PKGBUILD               |   52 +++++++++++++++++++++++------------------------
 new-cryptography.patch |   27 ++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 26 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2016-03-19 03:22:53 UTC (rev 262066)
+++ PKGBUILD    2016-03-19 03:41:09 UTC (rev 262067)
@@ -6,53 +6,53 @@
 pkgbase=pyopenssl
 pkgname=('python-pyopenssl' 'python2-pyopenssl')
 pkgver=0.15.1
-pkgrel=2
+pkgrel=3
 arch=('any')
 url="http://pypi.python.org/pypi/pyOpenSSL";
 license=('LGPL2.1')
 makedepends=('python-setuptools' 'python2-setuptools' 'openssl' 'python-six' 
'python2-six' 'python-cryptography' 'python2-cryptography')
 checkdepends=('python-pytest' 'python2-pytest')
-source=(http://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-${pkgver}.tar.gz)
-md5sums=('f447644afcbd5f0a1f47350fec63a4c6')
+source=(http://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-$pkgver.tar.gz
+        new-cryptography.patch)
+md5sums=('f447644afcbd5f0a1f47350fec63a4c6'
+         '100c9ebada71e6d88d7da3941f498bd2')
 
 prepare() {
-    cd "${srcdir}"
-    cp -a "pyOpenSSL-${pkgver}"{,-python2}
+  (cd pyOpenSSL-$pkgver; patch -p2 -i ../new-cryptography.patch)
+  cp -a pyOpenSSL-$pkgver{,-py2}
 }
 
 build () {
-    #build python 3 module
-    cd "pyOpenSSL-${pkgver}"
-    python setup.py build
+  cd "$srcdir"/pyOpenSSL-$pkgver
+  python setup.py build
 
-    #build python 2 module
-    cd ../"pyOpenSSL-${pkgver}-python2"
-    python2 setup.py build
+  cd "$srcdir"/pyOpenSSL-$pkgver-py2
+  python2 setup.py build
 }
 
 check () {
-    cd "pyOpenSSL-${pkgver}"
-    LC_CTYPE=en_US.utf8 python setup.py test || warning "Python 3 tests failed"
+  cd "$srcdir"/pyOpenSSL-$pkgver
+  LC_CTYPE=en_US.utf8 python setup.py test || warning "Python 3 tests failed"
 
-    cd ../"pyOpenSSL-${pkgver}-python2"
-    LC_CTYPE=en_US.utf8 python2 setup.py test || warning "Python 2 tests 
failed"
+  cd "$srcdir"/pyOpenSSL-$pkgver-py2
+  LC_CTYPE=en_US.utf8 python2 setup.py test || warning "Python 2 tests failed"
 }
 
 package_python-pyopenssl(){
-    pkgdesc="Python3 wrapper module around the OpenSSL library"
-    depends=('python>=3.4' 'openssl' 'python-six' 'python-cryptography')
-    replaces=('pyopenssl')
-    provides=('pyopenssl')
-    conflicts=('pyopenssl')
+  pkgdesc="Python3 wrapper module around the OpenSSL library"
+  depends=('python>=3.4' 'openssl' 'python-six' 'python-cryptography')
+  replaces=('pyopenssl')
+  provides=('pyopenssl')
+  conflicts=('pyopenssl')
 
-    cd "${srcdir}/pyOpenSSL-${pkgver}"
-    python setup.py install --root "${pkgdir}" --optimize=1
+  cd "$srcdir"/pyOpenSSL-$pkgver
+  python setup.py install --root "$pkgdir" --optimize=1
 }
 
 package_python2-pyopenssl(){
-    pkgdesc="Python2 wrapper module around the OpenSSL library"
-    depends=('python2>=2.7' 'openssl' 'python2-six' 'python2-cryptography')
+  pkgdesc="Python2 wrapper module around the OpenSSL library"
+  depends=('python2>=2.7' 'openssl' 'python2-six' 'python2-cryptography')
 
-    cd "${srcdir}/pyOpenSSL-${pkgver}-python2"
-    python2 setup.py install --root "${pkgdir}" --optimize=1
+  cd "$srcdir"/pyOpenSSL-$pkgver-py2
+  python2 setup.py install --root "$pkgdir" --optimize=1
 }

Added: new-cryptography.patch
===================================================================
--- new-cryptography.patch                              (rev 0)
+++ new-cryptography.patch      2016-03-19 03:41:09 UTC (rev 262067)
@@ -0,0 +1,27 @@
+diff --git a/src/OpenSSL/crypto.py b/src/OpenSSL/crypto.py
+index a00b5c0..6d78bd7 100644
+--- a/src/OpenSSL/crypto.py
++++ b/src/OpenSSL/crypto.py
+@@ -247,7 +247,7 @@ def check(self):
+         if self._only_public:
+             raise TypeError("public key only")
+ 
+-        if _lib.EVP_PKEY_type(self._pkey.type) != _lib.EVP_PKEY_RSA:
++        if _lib.EVP_PKEY_type(self.type()) != _lib.EVP_PKEY_RSA:
+             raise TypeError("key type unsupported")
+ 
+         rsa = _lib.EVP_PKEY_get1_RSA(self._pkey)
+@@ -263,7 +263,12 @@ def type(self):
+ 
+         :return: The type of the key.
+         """
+-        return self._pkey.type
++        try:
++            # cryptography 1.2+
++            return _lib.Cryptography_EVP_PKEY_id(self._pkey)
++        except AttributeError:
++            # Older releases of cryptography.
++            return self._pkey.type
+ 
+     def bits(self):
+         """

Reply via email to