Blob Blame History Raw
%global modname bleach

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

License:        ASL 2.0
URL:            https://github.com/mozilla/bleach
Source0:        %{url}/archive/v%{version}/%{modname}-%{version}.tar.gz

BuildArch:      noarch

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

%description %{_description}

%package -n python2-%{modname}
Summary:        %{summary}
%{?python_provide:%python_provide python2-%{modname}}
BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
BuildRequires:  python2-pytest
BuildRequires:  python2-pytest-runner
BuildRequires:  python2-six
BuildRequires:  python2-html5lib
Requires:       python2-six
Requires:       python2-html5lib

%description -n python2-%{modname} %{_description}

Python 2 version.

%package -n python3-%{modname}
Summary:        An easy whitelist-based HTML-sanitizing tool
%{?python_provide:%python_provide python3-%{modname}}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-pytest
BuildRequires:  python3-pytest-runner
BuildRequires:  python3-six
BuildRequires:  python3-html5lib
Requires:       python3-six
Requires:       python3-html5lib

%description -n python3-%{modname} %{_description}

Python 3 version.

%prep
%autosetup -n %{modname}-%{version} -p1

sed -i 's/pytest-runner>=2.0,<3dev/pytest-runner/' setup.py

# Remove vendored libraries which were added for https://github.com/mozilla/bleach/issues/386
rm -r bleach/_vendor/
# Bleach has a shim layer that references the vendored html5lib we just deleted. Let's patch up the
# imports to use the real html5lib.
sed -i "s/bleach._vendor.html5lib/html5lib/g" bleach/html5lib_shim.py


%build
%py2_build
%py3_build

%install
%py2_install
%py3_install

%check
! find %{buildroot}%{python2_sitelib}/bleach/ -type d | grep vendor

if [ $? -ne 0 ]; then
    echo "Detected vendored libraries; please remove them."
    /usr/bin/false
fi;

! find %{buildroot}%{python3_sitelib}/bleach/ -type d | grep vendor

if [ $? -ne 0 ]; then
    echo "Detected vendored libraries; please remove them."
    /usr/bin/false
fi;

%{__python2} setup.py test
%{__python3} setup.py test

%files -n python2-%{modname}
%license LICENSE
%doc README.rst
%{python2_sitelib}/%{modname}-*.egg-info/
%{python2_sitelib}/%{modname}/

%files -n python3-%{modname}
%license LICENSE
%doc README.rst
%{python3_sitelib}/%{modname}-*.egg-info/
%{python3_sitelib}/%{modname}/

%changelog
* Fri Aug 16 2019 Miro Hrončok <mhroncok@redhat.com> - 3.1.0-3
- Rebuilt for Python 3.8

* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Wed Mar 06 2019 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.1.0-1
- Update to 3.1.0.
- https://github.com/mozilla/bleach/blob/v3.1.0/CHANGES

* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Fri Dec 14 2018 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.0.2-1
- Update to 3.0.2 (#1641626).
- https://github.com/mozilla/bleach/blob/v3.0.2/CHANGES

* Wed Dec 05 2018 Randy Barlow <bowlofeggs@fedoraproject.org> - 2.1.4-1
- Update to 2.1.4.
- https://github.com/mozilla/bleach/blob/v2.1.4/CHANGES

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Sun Jun 17 2018 Miro Hrončok <mhroncok@redhat.com> - 2.1.3-2
- Rebuilt for Python 3.7

* Tue Mar 06 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.1.3-1
- Update to 2.1.3

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Fri Dec 08 2017 Matthias Runge <mrunge@redhat.com> - 2.1.2-1
- update to 2.1.2 (rhbz#1523423)

* Tue Oct 03 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.1.1-1
- Update to 2.1.1

* Fri Sep 29 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.1-1
- Update to 2.1

* Fri Jul 28 2017 Matthias Runge <mrunge@redhat.com> - 2.0-1
- rebase to 2.0 (rhbz#1431339)

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Jan 02 2017 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 1.5-1
- Update to 1.5.0

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 1.4.3-2
- Rebuild for Python 3.6

* Fri Aug 26 2016 Igor Gnatenko <ignatenko@redhat.com> - 1.4.3-1
- Update to 1.4.3
- Fix packaging

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.1-7
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.1-5
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* 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)