Fix dire deprecation warnings (#1627071)

epel9
Miro Hrončok 6 years ago
parent 4bf006ca4b
commit 05a4c7d078

@ -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

@ -2,11 +2,13 @@
Name: python-%{srcname} Name: python-%{srcname}
Summary: A python based HTML parser/tokenizer Summary: A python based HTML parser/tokenizer
Version: 1.0.1 Version: 1.0.1
Release: 1%{?dist} Release: 2%{?dist}
Epoch: 1 Epoch: 1
License: MIT License: MIT
URL: https://github.com/html5lib/html5lib-python URL: https://github.com/html5lib/html5lib-python
Source0: %pypi_source Source0: %pypi_source
Patch0: %{url}/pull/403.patch#/collections-abc.patch
BuildArch: noarch BuildArch: noarch
%?python_enable_dependency_generator %?python_enable_dependency_generator
@ -64,7 +66,7 @@ specification for maximum compatibility with major desktop web browsers.
%prep %prep
%autosetup -n %{srcname}-%{version} %autosetup -p1 -n %{srcname}-%{version}
%build %build
%py2_build %py2_build
@ -109,6 +111,9 @@ cp html5lib/tests/testdata{_nope,}/encoding/chardet/test_big5.txt
%changelog %changelog
* Mon Sep 24 2018 Miro Hrončok <mhroncok@redhat.com> - 1:1.0.1-2
- Fix dire deprecation warnings (#1627071)
* Mon Aug 20 2018 Miro Hrončok <mhroncok@redhat.com> - 1:1.0.1-1 * Mon Aug 20 2018 Miro Hrončok <mhroncok@redhat.com> - 1:1.0.1-1
- Update to 1.0.1 (#1584176) - Update to 1.0.1 (#1584176)

Loading…
Cancel
Save