File saltbundlepy-m2crypto.spec of Package saltbundlepy-m2crypto
#
# spec file for package saltbundlepy-m2crypto
#
# Copyright (c) 2025 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/
#
%if 0%{?suse_version} && 0%{?suse_version} <= 1315
#!BuildIgnore: openssl
%endif
%{?!saltbundlepy_module:%define saltbundlepy_module() saltbundlepy-%{**}}
%define pythons saltbundlepy
Name: saltbundlepy-m2crypto
Version: 0.45.1
Release: 0
Summary: Crypto and SSL toolkit for Python
License: BSD-2-Clause
Group: Development/Languages/Python
URL: https://sr.ht/~mcepl/m2crypto/
Source0: https://files.pythonhosted.org/packages/source/M/M2crypto/m2crypto-%{version}.tar.gz
Source99: saltbundlepy-m2crypto.rpmlintrc
Patch100: remove-parameterized-tests.patch
BuildRequires: %{saltbundlepy_module devel >= 3.11}
BuildRequires: %{saltbundlepy_module pip}
BuildRequires: %{saltbundlepy_module pytest}
BuildRequires: %{saltbundlepy_module setuptools}
BuildRequires: %{saltbundlepy_module typing}
BuildRequires: %{saltbundlepy_module wheel}
%if 0%{?suse_version} > 1500
BuildRequires: gcc13
%endif
BuildRequires: fdupes
%if 0%{?suse_version} && 0%{?suse_version} <= 1315
BuildRequires: saltbundle-openssl
BuildRequires: saltbundle-openssl-devel
%else
BuildRequires: openssl
BuildRequires: openssl-devel
%endif
BuildRequires: saltbundlepy-rpm-macros
Requires: saltbundlepy-base
BuildRequires: saltbundle-swig
%python_subpackages
%description
M2Crypto is a crypto and SSL toolkit for Python featuring the following:
RSA, DSA, DH, HMACs, message digests, symmetric ciphers (including
AES). SSL functionality to implement clients and servers. HTTPS
extensions to Python's httplib, urllib, and xmlrpclib. Unforgeable
HMAC'ing AuthCookies for web session management. FTP/TLS client and
server. S/MIME. ZServerSSL: A HTTPS server for Zope. ZSmime: An S/MIME
messenger for Zope.
%package -n %{name}-doc
Summary: Documentation for the Crypto and SSL toolkit for Python
Group: Development/Libraries/Python
Requires: %{name} = %{version}
BuildArch: noarch
%description -n %{name}-doc
M2Crypto is a crypto and SSL toolkit for Python featuring the following:
RSA, DSA, DH, HMACs, message digests, symmetric ciphers (including
AES). SSL functionality to implement clients and servers. HTTPS
extensions to Python's httplib, urllib, and xmlrpclib. Unforgeable
HMAC'ing AuthCookies for web session management. FTP/TLS client and
server. S/MIME. ZServerSSL: A HTTPS server for Zope. ZSmime: An S/MIME
messenger for Zope.
Documentation for the Crypto and SSL toolkit for Python
%prep
%autosetup -p1 -n m2crypto-%{version}
%build
%if 0%{?suse_version} > 1500
export CC=gcc-13
%endif
export CFLAGS="%{optflags}"
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitearch}
%check
%python_expand ls -l %{buildroot}%{$python_sitearch}/M2Crypto/*.so*
export PYTEST_ADDOPTS="--import-mode=append"
# Ignore test_verify_with_static_callback that fails with openssl 3.2
donttest="test_verify_with_static_callback"
%if 0%{?rhel} >= 9
# On RHEL 9 and 10 clonses crypto policies are not allowing legacy crypto parameters.
# There are some tests (24 for now) which are failing because of it.
donttest="$donttest or test_pkey_verify_crash or test_verify_final or test_load_request_bio or test_mkreq"
%pytest_arch -k "not ($donttest)" --ignore=tests/test_smime.py tests
%else
%pytest_arch -k "not ($donttest)" tests
%endif
%files %{python_files}
%doc CHANGES LICENCE README.rst
%{python_sitearch}/[Mm]2[Cc]rypto
%{python_sitearch}/[Mm]2[Cc]rypto-%{version}*-info
%files -n %{name}-doc
%doc doc/*.rst
%changelog