File python-rsa.spec of Package python-rsa

# spec file for package python-rsa
# Copyright (c) 2017 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
# 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

%bcond_without tests

%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name:           python-rsa
Version:        3.4.2
Release:        0
Summary:        Pure-Python RSA Implementation
License:        Apache-2.0
Group:          Development/Languages/Python
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module pyasn1 >= 0.1.3}
%if %{with tests}
BuildRequires:  %{python_module nose}
Requires:       python-pyasn1 >= 0.1.3
BuildArch:      noarch
Requires(pre):    coreutils
Requires(post):   update-alternatives
Requires(preun):  update-alternatives

Python-RSA is a pure-Python RSA implementation. It supports encryption and
decryption, signing and verifying signatures, and key generation according to
PKCS#1 version 1.5.

%setup -q -n rsa-%{version}


%python_expand %fdupes %{buildroot}%{$python_sitelib}

%python_clone -a %{buildroot}%{_bindir}/pyrsa-priv2pub
%python_clone -a %{buildroot}%{_bindir}/pyrsa-decrypt
%python_clone -a %{buildroot}%{_bindir}/pyrsa-decrypt-bigfile
%python_clone -a %{buildroot}%{_bindir}/pyrsa-encrypt
%python_clone -a %{buildroot}%{_bindir}/pyrsa-encrypt-bigfile
%python_clone -a %{buildroot}%{_bindir}/pyrsa-keygen
%python_clone -a %{buildroot}%{_bindir}/pyrsa-sign
%python_clone -a %{buildroot}%{_bindir}/pyrsa-verify

%{python_install_alternative pyrsa-priv2pub pyrsa-decrypt pyrsa-decrypt-bigfile pyrsa-encrypt pyrsa-encrypt-bigfile pyrsa-keygen pyrsa-sign pyrsa-verify}

%python_uninstall_alternative pyrsa-priv2pub

%if %{with tests}
%python_exec test

%files %{python_files}
%python_alternative %{_bindir}/pyrsa-decrypt
%python_alternative %{_bindir}/pyrsa-decrypt-bigfile
%python_alternative %{_bindir}/pyrsa-encrypt
%python_alternative %{_bindir}/pyrsa-encrypt-bigfile
%python_alternative %{_bindir}/pyrsa-keygen
%python_alternative %{_bindir}/pyrsa-priv2pub
%python_alternative %{_bindir}/pyrsa-sign
%python_alternative %{_bindir}/pyrsa-verify