commit 8ce82b3be10eb07bb31ad8072229322c9d04ace5 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 11:14:57 2019 -0400 Package init diff --git a/collections-abc.patch b/collections-abc.patch new file mode 100644 index 0000000..4a7ff78 --- /dev/null +++ b/collections-abc.patch @@ -0,0 +1,44 @@ +From 322a2d57bfdc52a9ce14bee93f9abb372cc08487 Mon Sep 17 00:00:00 2001 +From: 5j9 <5j9@users.noreply.github.com> +Date: Sun, 23 Sep 2018 11:32:46 +0330 +Subject: [PATCH] Try to import MutableMapping from collections.abc + +Note that collections.abc has been added in Python 3.3. + +Fixes #402 +--- + html5lib/_trie/_base.py | 5 ++++- + html5lib/treebuilders/dom.py | 5 ++++- + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/html5lib/_trie/_base.py b/html5lib/_trie/_base.py +index a1158bbb..6b71975f 100644 +--- a/html5lib/_trie/_base.py ++++ b/html5lib/_trie/_base.py +@@ -1,6 +1,9 @@ + from __future__ import absolute_import, division, unicode_literals + +-from collections import Mapping ++try: ++ from collections.abc import Mapping ++except ImportError: # Python 2.7 ++ from collections import Mapping + + + class Trie(Mapping): +diff --git a/html5lib/treebuilders/dom.py b/html5lib/treebuilders/dom.py +index dcfac220..d8b53004 100644 +--- a/html5lib/treebuilders/dom.py ++++ b/html5lib/treebuilders/dom.py +@@ -1,7 +1,10 @@ + from __future__ import absolute_import, division, unicode_literals + + +-from collections import MutableMapping ++try: ++ from collections.abc import MutableMapping ++except ImportError: # Python 2.7 ++ from collections import MutableMapping + from xml.dom import minidom, Node + import weakref + diff --git a/html5lib-1.0.1.tar.gz b/html5lib-1.0.1.tar.gz new file mode 100644 index 0000000..dd2171c Binary files /dev/null and b/html5lib-1.0.1.tar.gz differ diff --git a/python-html5lib.spec b/python-html5lib.spec new file mode 100644 index 0000000..c9abffb --- /dev/null +++ b/python-html5lib.spec @@ -0,0 +1,80 @@ +Name: python-html5lib +Version: 1.0.1 +Release: 3 +Epoch: 1 +Summary: HTML parser based on the WHAT-WG Web Applications 1 +License: MIT +URL: https://github.com/html5lib/html5lib-python +Source0: https://github.com/html5lib/html5lib-python/archive/html5lib-%{version}.tar.gz +Patch0: collections-abc.patch + +BuildArch: noarch + +%?python_enable_dependency_generator + +%description +Html5lib is a pure-python library for parsing HTML. It is designed to conform +to the WHATWG HTML specification, as is implemented by all major web browsers. + +%package -n python2-html5lib +Summary: python2 package for html5lib +BuildRequires: python2-devel python2-setuptools python2-mock python2-pytest python2-six +BuildRequires: python2-webencodings python2-chardet python2-genshi python2-lxml +%{?python_provide:%python_provide python2-html5lib} + +%description -n python2-html5lib +python2 package for html5lib. + +%package -n python3-html5lib +Summary: python3 package for html5lib +BuildRequires: python3-devel python3-setuptools python3-mock python3-pytest python3-pytest-expect +BuildRequires: python3-webencodings python3-chardet python3-genshi python3-lxml python3-six +%{?python_provide:%python_provide python3-html5lib} + +%description -n python3-html5lib +python3 package for html5lib. + +%package_help + +%prep +%autosetup -n html5lib-%{version} -p1 + +%build +%py2_build +%py3_build + +%install +%py2_install +%py3_install + +%check +%{__python3} -m pytest + +sed -i \ + -e 's/config.option.update_xfail/False/' \ + -e 's/^fail_if_missing_pytest_expect.*//' \ + html5lib/tests/conftest.py + +mv html5lib/tests/testdata{,_nope} +mkdir -p html5lib/tests/testdata/encoding/chardet/ +cp html5lib/tests/testdata{_nope,}/encoding/chardet/test_big5.txt + +%{__python2} -m pytest + +%files -n python2-html5lib +%defattr(-,root,root) +%license LICENSE +%{python2_sitelib}/* + +%files -n python3-html5lib +%defattr(-,root,root) +%license LICENSE +%{python3_sitelib}/* + +%files help +%defattr(-,root,root) +%doc CHANGES.rst README.rst + +%changelog +* Tue Sep 17 2019 openEuler Buildteam - 1.0.1-3 +- Package init