Igor Gnatenko 23f1fef
%global modname bleach
Igor Gnatenko 23f1fef
Igor Gnatenko 23f1fef
Name:           python-%{modname}
7319ee1
Version:        3.1.0
7819d22
Release:        3%{?dist}
2324349
Summary:        An easy whitelist-based HTML-sanitizing tool
2324349
2324349
License:        ASL 2.0
c70c013
URL:            https://github.com/mozilla/bleach
Igor Gnatenko 23f1fef
Source0:        %{url}/archive/v%{version}/%{modname}-%{version}.tar.gz
Igor Gnatenko 23f1fef
2324349
BuildArch:      noarch
2324349
Igor Gnatenko 23f1fef
%global _description \
Igor Gnatenko 23f1fef
Bleach is an HTML sanitizing library that escapes or strips markup and\
Igor Gnatenko 23f1fef
attributes based on a white list.
2324349
Igor Gnatenko 23f1fef
%description %{_description}
2324349
Igor Gnatenko 23f1fef
%package -n python2-%{modname}
Igor Gnatenko 23f1fef
Summary:        %{summary}
Igor Gnatenko 23f1fef
%{?python_provide:%python_provide python2-%{modname}}
Igor Gnatenko 23f1fef
BuildRequires:  python2-devel
Igor Gnatenko 23f1fef
BuildRequires:  python2-setuptools
ef6b25b
BuildRequires:  python2-pytest
ef6b25b
BuildRequires:  python2-pytest-runner
Igor Gnatenko 23f1fef
BuildRequires:  python2-six
e8bd7fe
BuildRequires:  python2-html5lib
Igor Gnatenko 23f1fef
Requires:       python2-six
e8bd7fe
Requires:       python2-html5lib
2324349
Igor Gnatenko 23f1fef
%description -n python2-%{modname} %{_description}
5147da1
Igor Gnatenko 23f1fef
Python 2 version.
Igor Gnatenko 23f1fef
Igor Gnatenko 23f1fef
%package -n python3-%{modname}
Igor Gnatenko 23f1fef
Summary:        An easy whitelist-based HTML-sanitizing tool
Igor Gnatenko 23f1fef
%{?python_provide:%python_provide python3-%{modname}}
2324349
BuildRequires:  python3-devel
Igor Gnatenko 23f1fef
BuildRequires:  python3-setuptools
ef6b25b
BuildRequires:  python3-pytest
ef6b25b
BuildRequires:  python3-pytest-runner
2324349
BuildRequires:  python3-six
Igor Gnatenko 23f1fef
BuildRequires:  python3-html5lib
2324349
Requires:       python3-six
Igor Gnatenko 23f1fef
Requires:       python3-html5lib
2324349
Igor Gnatenko 23f1fef
%description -n python3-%{modname} %{_description}
2324349
Igor Gnatenko 23f1fef
Python 3 version.
2324349
2324349
%prep
ef6b25b
%autosetup -n %{modname}-%{version} -p1
2324349
2835693
sed -i 's/pytest-runner>=2.0,<3dev/pytest-runner/' setup.py
2835693
c6eb016
# Remove vendored libraries which were added for https://github.com/mozilla/bleach/issues/386
c6eb016
rm -r bleach/_vendor/
c6eb016
# Bleach has a shim layer that references the vendored html5lib we just deleted. Let's patch up the
c6eb016
# imports to use the real html5lib.
c6eb016
sed -i "s/bleach._vendor.html5lib/html5lib/g" bleach/html5lib_shim.py
c6eb016
c6eb016
2324349
%build
Igor Gnatenko 23f1fef
%py2_build
Igor Gnatenko 23f1fef
%py3_build
2324349
2324349
%install
Igor Gnatenko 23f1fef
%py2_install
Igor Gnatenko 23f1fef
%py3_install
2324349
2324349
%check
c6eb016
! find %{buildroot}%{python2_sitelib}/bleach/ -type d | grep vendor
c6eb016
c6eb016
if [ $? -ne 0 ]; then
c6eb016
    echo "Detected vendored libraries; please remove them."
c6eb016
    /usr/bin/false
c6eb016
fi;
c6eb016
c6eb016
! find %{buildroot}%{python3_sitelib}/bleach/ -type d | grep vendor
c6eb016
c6eb016
if [ $? -ne 0 ]; then
c6eb016
    echo "Detected vendored libraries; please remove them."
c6eb016
    /usr/bin/false
c6eb016
fi;
c6eb016
2324349
%{__python2} setup.py test
2324349
%{__python3} setup.py test
2324349
Igor Gnatenko 23f1fef
%files -n python2-%{modname}
2324349
%license LICENSE
2324349
%doc README.rst
Igor Gnatenko 23f1fef
%{python2_sitelib}/%{modname}-*.egg-info/
Igor Gnatenko 23f1fef
%{python2_sitelib}/%{modname}/
Igor Gnatenko 23f1fef
Igor Gnatenko 23f1fef
%files -n python3-%{modname}
2324349
%license LICENSE
Igor Gnatenko 23f1fef
%doc README.rst
Igor Gnatenko 23f1fef
%{python3_sitelib}/%{modname}-*.egg-info/
Igor Gnatenko 23f1fef
%{python3_sitelib}/%{modname}/
2324349
2324349
%changelog
7819d22
* Fri Aug 16 2019 Miro Hrončok <mhroncok@redhat.com> - 3.1.0-3
7819d22
- Rebuilt for Python 3.8
7819d22
487954c
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.0-2
487954c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
487954c
7319ee1
* Wed Mar 06 2019 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.1.0-1
7319ee1
- Update to 3.1.0.
7319ee1
- https://github.com/mozilla/bleach/blob/v3.1.0/CHANGES
7319ee1
17656d5
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.2-2
17656d5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
17656d5
c6eb016
* Fri Dec 14 2018 Randy Barlow <bowlofeggs@fedoraproject.org> - 3.0.2-1
c6eb016
- Update to 3.0.2 (#1641626).
c6eb016
- https://github.com/mozilla/bleach/blob/v3.0.2/CHANGES
c6eb016
87a5b54
* Wed Dec 05 2018 Randy Barlow <bowlofeggs@fedoraproject.org> - 2.1.4-1
87a5b54
- Update to 2.1.4.
87a5b54
- https://github.com/mozilla/bleach/blob/v2.1.4/CHANGES
87a5b54
67c0195
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.3-3
67c0195
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
67c0195
f322e39
* Sun Jun 17 2018 Miro Hrončok <mhroncok@redhat.com> - 2.1.3-2
f322e39
- Rebuilt for Python 3.7
f322e39
f98a222
* Tue Mar 06 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.1.3-1
f98a222
- Update to 2.1.3
f98a222
417f3c2
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.2-2
417f3c2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild