%global modname lxml
%global _description \
The lxml XML toolkit is a Pythonic binding for the C libraries libxml2 and libxslt. \
It is unique in that it combines the speed and XML feature completeness of these libraries with \
the simplicity of a native Python API, mostly compatible but superior to the well-known ElementTree API. \
The latest release works with all CPython versions from 2.7 to 3.7.

Name:           python-%{modname}
Version:        4.5.2
Release:        6
Summary:        XML processing library combining libxml2/libxslt with the ElementTree API
License:        BSD
URL:            http://lxml.de
Source0:        http://lxml.de/files/%{modname}-%{version}.tgz

Patch6000:      backport-CVE-2020-27783-1.patch
Patch6001:      backport-CVE-2020-27783-2.patch
Patch6002:      backport-CVE-2021-28957.patch
Patch6003:      backport-0001-CVE-2021-43818.patch
Patch6004:      backport-0002-CVE-2021-43818.patch
Patch6005:      backport-Cleaner-cover-some-more-cases-where-scripts-could-sn.patch

BuildRequires:  gcc libxml2-devel libxslt-devel

%description %{_description}

%package -n     python2-%{modname}
Summary:        %{summary}
BuildRequires:  python2-devel python2-setuptools python2-Cython
%{?python_provide:%python_provide python2-%{modname}}

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

%package -n     python3-%{modname}
Summary:        %{summary}
BuildRequires:  python3-devel python3-setuptools python3-Cython
%{?python_provide:%python_provide python3-%{modname}}

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

%package_help

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

%build
export WITH_CYTHON=true
%py2_build
%py3_build

%install
%py2_install
%py3_install

%check
make test3

%files -n python2-%{modname}
%license doc/licenses/ZopePublicLicense.txt LICENSES.txt
%{python2_sitearch}/%{modname}/
%{python2_sitearch}/*.egg-info/

%files -n python3-%{modname}
%license doc/licenses/ZopePublicLicense.txt LICENSES.txt
%{python3_sitearch}/%{modname}/
%{python3_sitearch}/*.egg-info/

%files help
%doc README.rst src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt

%changelog
* Sat Jan 22 2022 shixuantong <shixuantong@huawei.com> - 4.5.2-6
- Cleaner: cover some more cases where scripts could sneak through in specially crafted style content.

* Wed Jan 19 2022 shixuantong <shixuantong@huawei.com> - 4.5.2-5
- enable check

* Wed Dec 22 2021 shixuantong <shixuantong@huawei.com> - 4.5.2-4
- fix CVE-2021-43818

* Wed Apr 14 2021 shixuantong <shixuantong@huawei.com> - 4.5.2-3
- fix CVE-2021-28957

* Fri Feb 05 2021 shixuantong <shixuantong@huawei.com> - 4.5.2-2
- fix CVE-2020-27783

* Tue Jan 05 2020 shixuantong <shixuantong@huawei.com> - 4.5.2-1
- update version to 4.5.2

* Fri Aug 21 2020 shixuantong <shixuantong@huawei.com> - 4.2.3-5
- add release version for rebuild

* Mon May 18 2020 wangchen <wangchen137@huawei.com> - 4.2.3-4
- rebuild for python-lxml

* Mon Sep 16 2019 openEuler Buildteam <buildteam@openeuler.org> - 4.2.3-3
- Package init
