Blob Blame History Raw
%if 0%{?fedora} > 12
%global with_python3 1
%else
%global with_python3 0
%endif
%global pypi_name bleach

Name:           python-%{pypi_name}
Version:        1.4.1
Release:        3%{?dist}
Summary:        An easy whitelist-based HTML-sanitizing tool

License:        ASL 2.0
URL:            http://github.com/jsocol/bleach
Source0:        https://pypi.python.org/packages/source/b/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch

BuildRequires:  python2-devel
BuildRequires:  python-nose >= 1.3

# Runtime requirements are test requirements, mirror them here
BuildRequires:  python-six
BuildRequires:  python-html5lib >= 0.999

Requires:       python-six
Requires:       python-html5lib >= 0.999

%description
Bleach is an HTML sanitizing library that escapes or strips markup and
attributes based on a white list.

%if 0%{?with_python3}
%package -n python3-%{pypi_name}
BuildRequires:  python3-devel
BuildRequires:  python3-nose >= 1.3
# Runtime requirements are test requirements, mirror them here
BuildRequires:  python3-six
BuildRequires:  python3-html5lib >= 0.999
Requires:       python3-html5lib >= 0.999
Requires:       python3-six

Summary:        An easy whitelist-based HTML-sanitizing tool

%description -n python3-%{pypi_name}
Bleach is an HTML sanitizing library that escapes or strips markup and
attributes based on a white list.
%endif


%prep
%setup -q -n %{pypi_name}-%{version}
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif

%build
%{__python2} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif


%install
%{__python2} setup.py install --skip-build --root %{buildroot}
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
popd
%endif

%check
%{__python2} setup.py test

%if 0%{?with_python3}
%{__python3} setup.py test
%endif


%files
%doc README.rst
%license LICENSE
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info

%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%doc README.rst
%license LICENSE
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%endif

%changelog
* Mon Jun 15 2015 Matthias Runge <mrunge@redhat.com> - 1.4.1-3
- fix requirements to install only a single version, not both
  (rhbz#1231426)

* Thu Feb 12 2015 Matthias Runge <mrunge@redhat.com> - 1.4.1-2
- add python3 subpackage

* Sat Feb 07 2015 Matthias Runge <mrunge@redhat.com> - 1.4.1-1
- Initial package. (rhbz#1190378)