File python-pysaml2.spec of Package python-pysaml2

#
# spec file for package python-pysaml2
#
# 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-%{**}}

# Test reqs are heavy, thus only have it on demand:
%bcond_with tests

Name:           python-pysaml2
%global modname pysaml2
Version:        4.5.0
Release:        0
Summary:        Python implementation of SAML Version 2 to be used in a WSGI environment
License:        Apache-2.0
Group:          Development/Languages/Python
Url:            https://github.com/rohe/%{modname}
Source:         https://pypi.io/packages/source/p/%{modname}/%{modname}-%{version}.tar.gz
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
# Test requirements:
%if %{with tests}
BuildRequires:  %{python_module cryptography}
BuildRequires:  %{python_module decorator}
BuildRequires:  %{python_module future}
BuildRequires:  %{python_module mako}
BuildRequires:  %{python_module mongodict}
BuildRequires:  %{python_module pyOpenSSL}
BuildRequires:  %{python_module pyasn1}
BuildRequires:  %{python_module pymongo}
BuildRequires:  %{python_module pytest}
BuildRequires:  %{python_module python-dateutil}
BuildRequires:  %{python_module python-memcached}
BuildRequires:  %{python_module pytz}
BuildRequires:  %{python_module repoze.who}
BuildRequires:  %{python_module requests >= 1.0.0}
%endif
Requires:       python-Paste
Requires:       python-cryptography
Requires:       python-decorator
Requires:       python-defusedxml
Requires:       python-future
Requires:       python-pyOpenSSL
Requires:       python-python-dateutil
Requires:       python-pytz
Requires:       python-repoze.who
Requires:       python-requests >= 1.0.0
Requires:       python-six
Requires:       python-zope.interface
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%python_subpackages

%description
PySAML2 is a pure python implementation of SAML2.
It contains all necessary pieces for building a
SAML2 service provider or an identity provider.

%prep
%setup -q -n %{modname}-%{version}
sed -i "s/python-memcached == 1.51/python-memcached/" setup.py
# delete shebang of files not in executable path
find src/ -name '*.py' -print0 | xargs -0 sed -i '1s/#!.*$//'

%build
%python_build

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

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

%files %{python_files}
%defattr(-,root,root,-)
%doc README.rst LICENSE.txt
%python3_only %{_bindir}/make_metadata.py
%python3_only %{_bindir}/parse_xsd2.py
%python3_only %{_bindir}/mdexport.py
%python3_only %{_bindir}/merge_metadata.py
%{python_sitelib}/*

%changelog