File m2crypto.spec of Package m2crypto

#
# spec file for package m2crypto
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           m2crypto
Version:        0.35.2
Release:        1%{?dist}
Summary:        Support for using OpenSSL in Python scripts
License:        MIT

URL:            https://gitlab.com/m2crypto/m2crypto/
Source0:        %{pypi_source M2Crypto}
Patch1:         test_rsa.patch
Patch2:         test_ssl.patch

BuildRequires:  gcc
BuildRequires:  openssl
BuildRequires:  openssl-devel
BuildRequires:  perl-interpreter
BuildRequires:  pkgconfig
BuildRequires:  swig
BuildRequires:  which

%description
This package allows you to call OpenSSL functions from Python scripts.

%package -n python2-m2crypto
Summary:        Support for using OpenSSL in Python 2 scripts
%{?python_provide:%python_provide python2-m2crypto}
BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
BuildRequires:  python2-typing
Requires:       python2-typing
%if 0%{?fedora} && 0%{?fedora} < 33
# Remove in F33
Obsoletes:      m2crypto < 0.32.0
Provides:       m2crypto = %{version}-%{release}
%endif

%description -n python2-m2crypto
This package allows you to call OpenSSL functions from Python 2 scripts.

%package -n python3-m2crypto
Summary:        Support for using OpenSSL in Python 3 scripts
%{?python_provide:%python_provide python3-m2crypto}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools

%description -n python3-m2crypto
This package allows you to call OpenSSL functions from Python 3 scripts.

%prep
%autosetup -n M2Crypto-%{version} -p1

%build
%set_build_flags
if pkg-config openssl ; then
	CFLAGS="$CFLAGS `pkg-config --cflags openssl`" ; export CFLAGS
	LDFLAGS="$LDFLAGS`pkg-config --libs-only-L openssl`" ; export LDFLAGS
fi

%py2_build
%py3_build

%install
%set_build_flags
if pkg-config openssl ; then
	CFLAGS="$CFLAGS `pkg-config --cflags openssl`" ; export CFLAGS
	LDFLAGS="$LDFLAGS`pkg-config --libs-only-L openssl`" ; export LDFLAGS
fi

%py2_install
%py3_install

%check
%{__python2} setup.py test
%{__python3} setup.py test

%files -n python2-m2crypto
%doc CHANGES README.rst
%license LICENCE
%{python2_sitearch}/M2Crypto
%{python2_sitearch}/M2Crypto-*.egg-info/

%files -n python3-m2crypto
%doc CHANGES README.rst
%license LICENCE
%{python3_sitearch}/M2Crypto
%{python3_sitearch}/M2Crypto-*.egg-info/

%changelog
openSUSE Build Service is sponsored by