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 http://bugs.opensuse.org/
#


%bcond_without tests

%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name:           python-rsa
Version:        3.4.2
Release:        0
Url:            http://stuvel.eu/rsa
Summary:        Pure-Python RSA Implementation
License:        Apache-2.0
Group:          Development/Languages/Python
Source:         https://files.pythonhosted.org/packages/source/r/rsa/rsa-%{version}.tar.gz
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}
%endif
Requires:       python-pyasn1 >= 0.1.3
BuildArch:      noarch
Requires(pre):    coreutils
Requires(post):   update-alternatives
Requires(preun):  update-alternatives
%python_subpackages

%description
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.

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

%build
%python_build

%install
%python_install
%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

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

%preun
%python_uninstall_alternative pyrsa-priv2pub

%if %{with tests}
%check
%python_exec setup.py test
%endif

%files %{python_files}
%defattr(-,root,root,-)
%doc CHANGELOG.txt LICENSE README.md
%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
%{python_sitelib}/*

%changelog
openSUSE Build Service is sponsored by