Accepting request 287536 from home:dimstar:Factory

Please get this some exposure in d:l:p to see if it results in new issues; in oS:F, this package is currently build disabled so it stays as a swig 3.0.4 generated one... but that can't stay like this forever of course... with this patch, the package crda builds again when python-M2Crypto is built using swig 3.0.5...

OBS-URL: https://build.opensuse.org/request/show/287536
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-M2Crypto?expand=0&rev=21
This commit is contained in:
Alberto Planas 2015-02-24 15:11:02 +00:00 committed by Git OBS Bridge
parent 8a64ef5bf4
commit f1553254a2
3 changed files with 108 additions and 1 deletions

View File

@ -0,0 +1,94 @@
Index: M2Crypto-0.22.3/M2Crypto/__init__.py
===================================================================
--- M2Crypto-0.22.3.orig/M2Crypto/__init__.py
+++ M2Crypto-0.22.3/M2Crypto/__init__.py
@@ -19,7 +19,7 @@ Copyright 2008-2011 Heikki Toivonen. All
version_info = (0, 22)
version = '.'.join([str(_v) for _v in version_info])
-import __m2crypto
+import _m2crypto
import m2
import ASN1
import AuthCookie
Index: M2Crypto-0.22.3/M2Crypto/m2.py
===================================================================
--- M2Crypto-0.22.3.orig/M2Crypto/m2.py
+++ M2Crypto-0.22.3/M2Crypto/m2.py
@@ -25,7 +25,7 @@ Portions created by Open Source Applicat
Copyright (C) 2004 OSAF. All Rights Reserved.
"""
-from __m2crypto import *
+from _m2crypto import *
lib_init()
Index: M2Crypto-0.22.3/SWIG/_lib.i
===================================================================
--- M2Crypto-0.22.3.orig/SWIG/_lib.i
+++ M2Crypto-0.22.3/SWIG/_lib.i
@@ -66,6 +66,8 @@ int ssl_verify_callback(int ok, X509_STO
int cret;
int new_style_callback = 0, warning_raised_exception=0;
PyGILState_STATE gilstate;
+ PyObject *self = 0;
+ (void)self;
ssl = (SSL *)X509_STORE_CTX_get_app_data(ctx);
@@ -151,6 +153,8 @@ int ssl_verify_callback(int ok, X509_STO
void ssl_info_callback(const SSL *s, int where, int ret) {
PyObject *argv, *retval, *_SSL;
PyGILState_STATE gilstate;
+ PyObject *self = 0;
+ (void)self;
gilstate = PyGILState_Ensure();
@@ -170,6 +174,8 @@ DH *ssl_set_tmp_dh_callback(SSL *ssl, in
PyObject *argv, *ret, *_ssl;
DH *dh;
PyGILState_STATE gilstate;
+ PyObject *self = 0;
+ (void)self;
gilstate = PyGILState_Ensure();
@@ -193,6 +199,8 @@ RSA *ssl_set_tmp_rsa_callback(SSL *ssl,
PyObject *argv, *ret, *_ssl;
RSA *rsa;
PyGILState_STATE gilstate;
+ PyObject *self = 0;
+ (void)self;
gilstate = PyGILState_Ensure();
Index: M2Crypto-0.22.3/SWIG/_pkcs7.i
===================================================================
--- M2Crypto-0.22.3.orig/SWIG/_pkcs7.i
+++ M2Crypto-0.22.3/SWIG/_pkcs7.i
@@ -157,6 +157,8 @@ PyObject *smime_read_pkcs7(BIO *bio) {
BIO *bcont = NULL;
PKCS7 *p7;
PyObject *tuple, *_p7, *_BIO;
+ PyObject *self = 0;
+ (void)self;
if (BIO_method_type(bio) == BIO_TYPE_MEM) {
/* OpenSSL FAQ explains that this is needed for mem BIO to return EOF,
Index: M2Crypto-0.22.3/setup.py
===================================================================
--- M2Crypto-0.22.3.orig/setup.py
+++ M2Crypto-0.22.3/setup.py
@@ -76,7 +76,9 @@ class _M2CryptoBuildExt(build_ext.build_
self.swig_opts = ['-I%s' % i for i in self.include_dirs + \
[opensslIncludeDir, os.path.join(opensslIncludeDir, "openssl")]]
self.swig_opts.append('-includeall')
- self.swig_opts.append('-modern')
+ ##self.swig_opts.append('-modern')
+ self.swig_opts.append('-builtin')
+ self.swig_opts.append('-relativeimport')
# Fedora does hat tricks.
if platform.linux_distribution()[0] in ['Fedora', 'CentOS']:

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Feb 24 11:35:42 UTC 2015 - dimstar@opensuse.org
- Add python-M2Crypto-SWIG-3.0.5.patch: Fix generation of M2Crypto
module when using SWIG 3.0.5.
- Manually install _m2crypto shadow file: setup.py misses it.
(boo#917759, boo#917815).
-------------------------------------------------------------------
Thu Apr 17 19:49:12 UTC 2014 - hrvoje.senjan@gmail.com

View File

@ -1,7 +1,7 @@
#
# spec file for package python-M2Crypto
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -24,6 +24,8 @@ Summary: Crypto and SSL toolkit for Python
License: MIT and ZPL-2.0 and BSD-3-Clause
Group: Development/Languages/Python
Source: http://pypi.python.org/packages/source/M/M2Crypto/M2Crypto-%{version}.tar.gz
# PATCH-FIX-UPSTREAM python-M2Crypto-SWIG-3.0.5.patch -- https://github.com/martinpaljak/M2Crypto/issues/60
Patch0: python-M2Crypto-SWIG-3.0.5.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: openssl
BuildRequires: openssl-devel
@ -57,12 +59,15 @@ original M2Crypto homepage is at http://sandbox.rulemaker.net/ngps/m2/.
%prep
%setup -n M2Crypto-%{version}
%patch0 -p1
%build
CFLAGS="%{optflags}" python setup.py build
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
# The SWIG shadow file is not being installed by setup.py
cp SWIG/_m2crypto.py %{buildroot}%{python_sitearch}/M2Crypto/
# install demo files manually
# (otherwise we can't perform %%fdupes on them the right way)