File python-cryptography.spec of Package python-cryptography.8157

#
# spec file for package python-cryptography
#
# Copyright (c) 2018 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/
#


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name:           python-cryptography
Version:        1.3.1
Release:        0
Summary:        Python library which exposes cryptographic recipes and primitives
License:        Apache-2.0 or BSD-3-Clause
Group:          Development/Languages/Python
Url:            https://cryptography.io/en/latest/
Source0:        https://pypi.python.org/packages/source/c/cryptography/cryptography-%{version}.tar.gz
Source1:        https://pypi.python.org/packages/source/c/cryptography/cryptography-%{version}.tar.gz.asc
Source2:        %{name}.keyring
Source3:        https://pypi.python.org/packages/source/c/cryptography-vectors/cryptography_vectors-%{version}.tar.gz
Source4:        https://pypi.python.org/packages/source/c/cryptography-vectors/cryptography_vectors-%{version}.tar.gz.asc
# PATCH-FIX-SLE disable-uneven-sizes-tests.patch bnc#944204
Patch1:         disable-uneven-sizes-tests.patch
# PATCH-UPSTREAM: extract from upstream commit 8b8d51b752729f7237bb51274ccf158cbb4cfce0
Patch2:         python-cryptography-enable-gost.patch
BuildRequires:  %{python_module cffi >= 1.1.0}
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module six >= 1.4.1}
%ifpython2
BuildRequires:  python-enum34
BuildRequires:  python-ipaddress
%endif
BuildRequires:  fdupes
BuildRequires:  libopenssl-devel
BuildRequires:  pkg-config
BuildRequires:  python-idna >= 2.0
BuildRequires:  python-pyasn1-modules
BuildRequires:  python-rpm-macros
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
BuildRequires:  libffi43-devel
%else
BuildRequires:  python-hypothesis
BuildRequires:  pkgconfig(libffi)
%endif
# Test requirements
BuildRequires:  python-iso8601
BuildRequires:  python-pretend
BuildRequires:  python-pyasn1 >= 0.1.8
BuildRequires:  python-pytest
BuildRequires:  python-virtualenv
%requires_eq    python-cffi
%ifpython2
Requires:       python-enum34
Requires:       python-ipaddress
%endif
Requires:       python-idna >= 2.0
Requires:       python-pyasn1 >= 0.1.8
Requires:       python-setuptools
Requires:       python-six >= 1.4.1
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%python_subpackages

%description
cryptography is a package designed to expose cryptographic
recipes and primitives to Python developers.  Our goal is
for it to be your "cryptographic standard library". It
supports Python 2.6-2.7, Python 3.2+, and PyPy.

cryptography includes both high level recipes, and low
level interfaces to common cryptographic algorithms such as
symmetric ciphers, message digests and key derivation
functions.

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

# prepare vectors module
tar xvzf %{SOURCE3}

%patch1 -p1
%patch2 -p1

%build
export CFLAGS="%{optflags} -fno-strict-aliasing"
%python_build

%install
%python_install
%fdupes %{buildroot}%{_prefix}

%check
# Tests are broken for python3
%if 0%{?suse_version} >= 1210
%{python_expand if [ "$python" == "python2" ]; then
# this is going to be fun
# create virtualenv
virtualenv --system-site-packages TESTROOT
. TESTROOT/bin/activate
# install package in virtualenv
python setup.py install
# install cryptography vectors
(cd cryptography_vectors-%{version} && python setup.py install)
# run tests with virtualenv'd python
# (specify "tests" directory, otherwise py.test discovers tests in virtualenv'd setuptools)
python /usr/bin/py.test tests
# finish
deactivate
fi}
%endif

%files %{python_files}
%defattr(-,root,root,-)
%doc LICENSE LICENSE.APACHE LICENSE.BSD
%doc AUTHORS.rst CONTRIBUTING.rst CHANGELOG.rst README.rst
%{python_sitearch}/cryptography/
%{python_sitearch}/cryptography-%{version}-py%{py_ver}.egg-info/

%changelog
openSUSE Build Service is sponsored by