diff options
Diffstat (limited to 'meta-python')
| -rw-r--r-- | meta-python/recipes-devtools/python/python-m2crypto/0001-M2Crypto-Error-fix.patch | 162 | ||||
| -rw-r--r-- | meta-python/recipes-devtools/python/python-m2crypto_0.21.1.bb | 3 |
2 files changed, 164 insertions, 1 deletions
diff --git a/meta-python/recipes-devtools/python/python-m2crypto/0001-M2Crypto-Error-fix.patch b/meta-python/recipes-devtools/python/python-m2crypto/0001-M2Crypto-Error-fix.patch new file mode 100644 index 0000000000..2a74b68505 --- /dev/null +++ b/meta-python/recipes-devtools/python/python-m2crypto/0001-M2Crypto-Error-fix.patch | |||
| @@ -0,0 +1,162 @@ | |||
| 1 | From 02a24ac541df68033d4efd7e2f8a1b92dc49328d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Li xin <lixin.fnst@cn.fujitsu.com> | ||
| 3 | Date: Mon, 27 Jul 2015 05:06:20 +0900 | ||
| 4 | Subject: [PATCH] M2Crypto: Error fix. | ||
| 5 | |||
| 6 | After swig upgrade from 3.0.2 to 3.0.6,build the recipes which | ||
| 7 | depends on python-m2crypto will occur errors like this: | ||
| 8 | SALT_LEN = m2.PKCS5_SALT_LEN | ||
| 9 | AttributeError: 'module' object has no attribute 'PKCS5_SALT_LEN' | ||
| 10 | since python-m2crypto depends on swig-native | ||
| 11 | |||
| 12 | Ref: | ||
| 13 | https://github.com/martinpaljak/M2Crypto/issues/60#issuecomment-75735489 | ||
| 14 | |||
| 15 | This patch is from: | ||
| 16 | http://pkgs.fedoraproject.org/cgit/m2crypto.git/tree/m2crypto-0.21.1-swig-3.0.5.patch | ||
| 17 | |||
| 18 | Upstream-Status: pending | ||
| 19 | |||
| 20 | Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com> | ||
| 21 | --- | ||
| 22 | M2Crypto/__init__.py | 4 ++-- | ||
| 23 | M2Crypto/m2.py | 2 +- | ||
| 24 | SWIG/_lib.i | 4 ++++ | ||
| 25 | SWIG/_pkcs7.i | 1 + | ||
| 26 | setup.py | 26 +++++++++++++++++++++++++- | ||
| 27 | 5 files changed, 33 insertions(+), 4 deletions(-) | ||
| 28 | |||
| 29 | diff --git a/M2Crypto/__init__.py b/M2Crypto/__init__.py | ||
| 30 | index e7acfe7..02f4d28 100644 | ||
| 31 | --- a/M2Crypto/__init__.py | ||
| 32 | +++ b/M2Crypto/__init__.py | ||
| 33 | @@ -19,7 +19,7 @@ Copyright 2008-2011 Heikki Toivonen. All rights reserved. | ||
| 34 | version_info = (0, 21, 1) | ||
| 35 | version = '.'.join([str(_v) for _v in version_info]) | ||
| 36 | |||
| 37 | -import __m2crypto | ||
| 38 | +import _m2crypto | ||
| 39 | import m2 | ||
| 40 | import ASN1 | ||
| 41 | import AuthCookie | ||
| 42 | @@ -57,4 +57,4 @@ import util | ||
| 43 | encrypt=1 | ||
| 44 | decrypt=0 | ||
| 45 | |||
| 46 | -__m2crypto.lib_init() | ||
| 47 | +_m2crypto.lib_init() | ||
| 48 | diff --git a/M2Crypto/m2.py b/M2Crypto/m2.py | ||
| 49 | index e4bb695..822143f 100644 | ||
| 50 | --- a/M2Crypto/m2.py | ||
| 51 | +++ b/M2Crypto/m2.py | ||
| 52 | @@ -25,7 +25,7 @@ Portions created by Open Source Applications Foundation (OSAF) are | ||
| 53 | Copyright (C) 2004 OSAF. All Rights Reserved. | ||
| 54 | """ | ||
| 55 | |||
| 56 | -from __m2crypto import * | ||
| 57 | +from _m2crypto import * | ||
| 58 | lib_init() | ||
| 59 | |||
| 60 | |||
| 61 | diff --git a/SWIG/_lib.i b/SWIG/_lib.i | ||
| 62 | index 42dc180..47a53b8 100644 | ||
| 63 | --- a/SWIG/_lib.i | ||
| 64 | +++ b/SWIG/_lib.i | ||
| 65 | @@ -100,6 +100,7 @@ int ssl_verify_callback(int ok, X509_STORE_CTX *ctx) { | ||
| 66 | int cret; | ||
| 67 | int new_style_callback = 0, warning_raised_exception=0; | ||
| 68 | PyGILState_STATE gilstate; | ||
| 69 | + PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */ | ||
| 70 | |||
| 71 | ssl = (SSL *)X509_STORE_CTX_get_app_data(ctx); | ||
| 72 | |||
| 73 | @@ -185,6 +186,7 @@ int ssl_verify_callback(int ok, X509_STORE_CTX *ctx) { | ||
| 74 | void ssl_info_callback(const SSL *s, int where, int ret) { | ||
| 75 | PyObject *argv, *retval, *_SSL; | ||
| 76 | PyGILState_STATE gilstate; | ||
| 77 | + PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */ | ||
| 78 | |||
| 79 | gilstate = PyGILState_Ensure(); | ||
| 80 | |||
| 81 | @@ -204,6 +206,7 @@ DH *ssl_set_tmp_dh_callback(SSL *ssl, int is_export, int keylength) { | ||
| 82 | PyObject *argv, *ret, *_ssl; | ||
| 83 | DH *dh; | ||
| 84 | PyGILState_STATE gilstate; | ||
| 85 | + PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */ | ||
| 86 | |||
| 87 | gilstate = PyGILState_Ensure(); | ||
| 88 | |||
| 89 | @@ -227,6 +230,7 @@ RSA *ssl_set_tmp_rsa_callback(SSL *ssl, int is_export, int keylength) { | ||
| 90 | PyObject *argv, *ret, *_ssl; | ||
| 91 | RSA *rsa; | ||
| 92 | PyGILState_STATE gilstate; | ||
| 93 | + PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */ | ||
| 94 | |||
| 95 | gilstate = PyGILState_Ensure(); | ||
| 96 | |||
| 97 | diff --git a/SWIG/_pkcs7.i b/SWIG/_pkcs7.i | ||
| 98 | index 174f40a..7bffbfc 100644 | ||
| 99 | --- a/SWIG/_pkcs7.i | ||
| 100 | +++ b/SWIG/_pkcs7.i | ||
| 101 | @@ -157,6 +157,7 @@ PyObject *smime_read_pkcs7(BIO *bio) { | ||
| 102 | BIO *bcont = NULL; | ||
| 103 | PKCS7 *p7; | ||
| 104 | PyObject *tuple, *_p7, *_BIO; | ||
| 105 | + PyObject *self = NULL; /* bug in SWIG_NewPointerObj as of 3.0.5 */ | ||
| 106 | |||
| 107 | if (BIO_method_type(bio) == BIO_TYPE_MEM) { | ||
| 108 | /* OpenSSL FAQ explains that this is needed for mem BIO to return EOF, | ||
| 109 | diff --git a/setup.py b/setup.py | ||
| 110 | index e7c49eb..b98abe0 100644 | ||
| 111 | --- a/setup.py | ||
| 112 | +++ b/setup.py | ||
| 113 | @@ -20,6 +20,7 @@ except ImportError: | ||
| 114 | from distutils.command import build_ext | ||
| 115 | |||
| 116 | from distutils.core import Extension | ||
| 117 | +from distutils.file_util import copy_file | ||
| 118 | |||
| 119 | |||
| 120 | class _M2CryptoBuildExt(build_ext.build_ext): | ||
| 121 | @@ -57,7 +58,17 @@ class _M2CryptoBuildExt(build_ext.build_ext): | ||
| 122 | self.swig_opts.append('-includeall') | ||
| 123 | #self.swig_opts.append('-D__i386__') # Uncomment for early OpenSSL 0.9.7 versions, or on Fedora Core if build fails | ||
| 124 | #self.swig_opts.append('-DOPENSSL_NO_EC') # Try uncommenting if you can't build with EC disabled | ||
| 125 | - | ||
| 126 | + self.swig_opts.append('-modern') | ||
| 127 | + self.swig_opts.append('-builtin') | ||
| 128 | + | ||
| 129 | + # These two lines are a workaround for | ||
| 130 | + # http://bugs.python.org/issue2624 , hard-coding that we are only | ||
| 131 | + # building a single extension with a known path; a proper patch to | ||
| 132 | + # distutils would be in the run phase, when extension name and path are | ||
| 133 | + # known. | ||
| 134 | + self.swig_opts.append('-outdir') | ||
| 135 | + self.swig_opts.append(os.path.join(self.build_lib, 'M2Crypto')) | ||
| 136 | + | ||
| 137 | self.include_dirs += [os.path.join(self.openssl, opensslIncludeDir), | ||
| 138 | os.path.join(os.getcwd(), 'SWIG')] | ||
| 139 | |||
| 140 | @@ -71,6 +82,19 @@ class _M2CryptoBuildExt(build_ext.build_ext): | ||
| 141 | |||
| 142 | self.library_dirs += [os.path.join(self.openssl, opensslLibraryDir)] | ||
| 143 | |||
| 144 | + def run(self): | ||
| 145 | + '''Overloaded build_ext implementation to allow inplace=1 to work, | ||
| 146 | + which is needed for (python setup.py test).''' | ||
| 147 | + # This is another workaround for http://bugs.python.org/issue2624 + the | ||
| 148 | + # corresponding lack of support in setuptools' test command. Note that | ||
| 149 | + # just using self.inplace in finalize_options() above does not work | ||
| 150 | + # because swig is not rerun if the __m2crypto.so extension exists. | ||
| 151 | + # Again, hard-coding our extension name and location. | ||
| 152 | + build_ext.build_ext.run(self) | ||
| 153 | + if self.inplace: | ||
| 154 | + copy_file(os.path.join(self.build_lib, 'M2Crypto', '_m2crypto.py'), | ||
| 155 | + os.path.join('M2Crypto', '_m2crypto.py'), | ||
| 156 | + verbose=self.verbose, dry_run=self.dry_run) | ||
| 157 | |||
| 158 | if sys.version_info < (2,4): | ||
| 159 | |||
| 160 | -- | ||
| 161 | 1.8.4.2 | ||
| 162 | |||
diff --git a/meta-python/recipes-devtools/python/python-m2crypto_0.21.1.bb b/meta-python/recipes-devtools/python/python-m2crypto_0.21.1.bb index 67ec9214ad..ff6203f205 100644 --- a/meta-python/recipes-devtools/python/python-m2crypto_0.21.1.bb +++ b/meta-python/recipes-devtools/python/python-m2crypto_0.21.1.bb | |||
| @@ -7,7 +7,8 @@ LICENSE = "BSD" | |||
| 7 | LIC_FILES_CHKSUM = "file://LICENCE;md5=b0e1f0b7d0ce8a62c18b1287b991800e" | 7 | LIC_FILES_CHKSUM = "file://LICENCE;md5=b0e1f0b7d0ce8a62c18b1287b991800e" |
| 8 | 8 | ||
| 9 | SRC_URI = "http://pypi.python.org/packages/source/M/M2Crypto/M2Crypto-${PV}.tar.gz \ | 9 | SRC_URI = "http://pypi.python.org/packages/source/M/M2Crypto/M2Crypto-${PV}.tar.gz \ |
| 10 | file://0001-setup.py-link-in-sysroot-not-in-host-directories.patch" | 10 | file://0001-setup.py-link-in-sysroot-not-in-host-directories.patch \ |
| 11 | file://0001-M2Crypto-Error-fix.patch" | ||
| 11 | 12 | ||
| 12 | SRC_URI[md5sum] = "f93d8462ff7646397a9f77a2fe602d17" | 13 | SRC_URI[md5sum] = "f93d8462ff7646397a9f77a2fe602d17" |
| 13 | SRC_URI[sha256sum] = "25b94498505c2d800ee465db0cc1aff097b1615adc3ac042a1c85ceca264fc0a" | 14 | SRC_URI[sha256sum] = "25b94498505c2d800ee465db0cc1aff097b1615adc3ac042a1c85ceca264fc0a" |
