File python-pysaml2.spec of Package python-pysaml2

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


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

Name:           python-pysaml2
Version:        4.0.2
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/pysaml2
Source:         https://pypi.python.org/packages/source/p/pysaml2/pysaml2-%{version}.tar.gz
# https://github.com/IdentityPython/pysaml2/issues/45
Patch0:         quick-fix-for-the-authentication-bypass-due-to-optimizations.patch
Patch1:         fix-xxe-in-xml-parsing.patch
# https://github.com/IdentityPython/pysaml2/commit/5e9d5acbcd8ae45c4e736ac521fd2df5b1c62e25
Patch2:         0001-Fix-XML-Signature-Wrapping-XSW-vulnerabilities.patch
# https://github.com/IdentityPython/pysaml2/commit/7323f5c20efb59424d853c822e7a26d1aa3e84aa
Patch3:         0001-Always-generate-a-random-IV-for-AES-operations.patch
# https://github.com/IdentityPython/pysaml2/commit/1d8fd268f5bf887480a403a7a5ef8f048157cc14
Patch4:         0004-Strengthen-XSW-tests.patch
Patch5:         0005-Fix-the-parser-to-not-break-on-ePTID-AttributeValues.patch
Patch6:         0006-Add-xsd-schemas.patch
Patch7:         0007-Fix-CVE-2021-21238-SAML-XML-Signature-wrapping.patch
# https://github.com/IdentityPython/pysaml2/commit/46578df0695269a16f1c94171f1429873f90ed99
Patch8:         0008-Fix-CVE-2021-21239-Restrict-the-key-data-that-xmlsec.patch
Patch9:         0009-Make-previous-commits-python2-compatible.patch
BuildRequires:  python-devel
BuildRequires:  python-setuptools
# Test requirements:
%if %{with tests}
BuildRequires:  python-decorator
BuildRequires:  python-mako
BuildRequires:  python-mongodict
BuildRequires:  python-pyOpenSSL
BuildRequires:  python-pyasn1
BuildRequires:  python-pycrypto
BuildRequires:  python-pymongo
BuildRequires:  python-pytest
BuildRequires:  python-python-dateutil
BuildRequires:  python-python-memcached
BuildRequires:  python-pytz
BuildRequires:  python-repoze.who
BuildRequires:  python-requests >= 1.0.0
BuildRequires:  python-xmlschema
%endif
%if 0%{?suse_release}
# NOTE(saschpe): xmlsec has a lot of deps and some issues, thus not require it:
Recommends:     python-xmlsec
%endif
Requires:       python-Paste
Requires:       python-decorator
Requires:       python-defusedxml
Requires:       python-pyOpenSSL
Requires:       python-pycrypto >= 2.5
Requires:       python-python-dateutil
Requires:       python-pytz
Requires:       python-repoze.who
Requires:       python-requests >= 1.0.0
Requires:       python-six
Requires:       python-xmlschema
Requires:       python-zope.interface
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch:      noarch
%endif

%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 pysaml2-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
sed -i "s/python-memcached == 1.51/python-memcached/" setup.py

%build
python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
mkdir -p %{buildroot}/%{_licensedir}

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

%files
%defattr(-,root,root,-)
%license LICENSE.txt
%doc README.rst
%dir %{_licensedir}
%{_bindir}/make_metadata.py
%{_bindir}/parse_xsd2.py
%{_bindir}/mdexport.py
%{_bindir}/merge_metadata.py
%{python_sitelib}/pysaml2-%{version}-py%{py_ver}.egg-info
#%{python_sitelib}/s2repoze
%{python_sitelib}/saml2
#%{python_sitelib}/xmldsig
#%{python_sitelib}/xmlenc

%changelog
openSUSE Build Service is sponsored by