%if 0%{?fedora} || 0%{?rhel} > 7
%bcond_with python2
%bcond_without python3
%else
%bcond_without python2
%bcond_with python3
%endif
%global pypi_name django-debreach
Name: python-%{pypi_name}
Version: 1.5.2
Release: 1%{?dist}
Summary: Basic/extra mitigation against the BREACH attack for Django projects
License: BSD
URL: http://github.com/lpomfrey/django-debreach
Source0: https://files.pythonhosted.org/packages/source/d/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch: noarch
%if %{with python2}
BuildRequires: python2-devel
BuildRequires: python2-django
BuildRequires: python2-setuptools
%endif
%if %{with python3}
BuildRequires: python3-devel
BuildRequires: python3dist(django)
BuildRequires: python3dist(setuptools)
BuildRequires: python3dist(sphinx)
%endif
%description
Basic/extra mitigation against the BREACH attack for Django projects.
When combined with rate limiting in your web-server, or by using something
like django-ratelimit, the techniques here should provide at least some
protection against the BREACH attack.
%if %{with python2}
%package -n python2-%{pypi_name}
Summary: %{summary}
%{?python_provide:%python_provide python2-%{pypi_name}}
Requires: python2-django
%description -n python2-%{pypi_name}
Basic/extra mitigation against the BREACH attack for Django projects.
When combined with rate limiting in your web-server, or by using something
like django-ratelimit, the techniques here should provide at least some
protection against the BREACH attack.
%endif
%if %{with python3}
%package -n python3-%{pypi_name}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{pypi_name}}
Requires: python3dist(django)
%description -n python3-%{pypi_name}
Basic/extra mitigation against the BREACH attack for Django projects.
When combined with rate limiting in your web-server, or by using something
like django-ratelimit, the techniques here should provide at least some
protection against the BREACH attack.
%endif
%prep
%autosetup -n %{pypi_name}-%{version}
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info
%build
%if %{with python2}
%py2_build
%endif
%if %{with python3}
%py3_build
%endif
%install
# Must do the default python version install last because
# the scripts in /usr/bin are overwritten with every setup.py install.
%if %{with python2}
%py2_install
%endif
%if %{with python3}
%py3_install
%endif
%check
%if %{with python2}
PYTHONPATH=. %{__python2} setup.py test
%endif
%if %{with python3}
PYTHONPATH=. %{__python3} setup.py test
%endif
%if %{with python2}
%files -n python2-%{pypi_name}
%license LICENSE
%doc README.rst
%{python2_sitelib}/debreach
%{python2_sitelib}/django_debreach-%{version}-py?.?.egg-info
%endif
%if %{with python3}
%files -n python3-%{pypi_name}
%license LICENSE
%doc README.rst
%{python3_sitelib}/debreach
%{python3_sitelib}/django_debreach-%{version}-py?.?.egg-info
%endif
%changelog
* Fri Aug 31 2018 Javier Peña <jpena@redhat.com> - 1.5.2-1
- Initial package.