summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Lublin <daniel@lublin.se>2016-12-05 17:42:05 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-03-28 11:56:38 (GMT)
commit87631919819b6f85f23f57689cd1065c64d7fb03 (patch)
tree1171d138913d85e0003ab37297105f8c774ab438
parentea6d21066a7cce2fef08ad66287170c5995bb1e2 (diff)
downloadpoky-fido.tar.gz
bitbake: lib/bs4: Fix imports from html5lib >= 0.9999999/1.0b8fido
As of html5lib 0.9999999/1.0b8 (released on July 14, 2016), some modules have moved from _base to base. Handle this, while staying compatible with earlier versions. (Bitbake rev: edd90cd858da5da564e9849ebc0849a8a8173d4f) Signed-off-by: Daniel Lublin <daniel@lublin.se> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bs4/builder/_html5lib.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/bitbake/lib/bs4/builder/_html5lib.py b/bitbake/lib/bs4/builder/_html5lib.py
index 7de36ae7..0f4007a 100644
--- a/bitbake/lib/bs4/builder/_html5lib.py
+++ b/bitbake/lib/bs4/builder/_html5lib.py
@@ -11,7 +11,14 @@ from bs4.builder import (
11 ) 11 )
12from bs4.element import NamespacedAttribute 12from bs4.element import NamespacedAttribute
13import html5lib 13import html5lib
14try:
15 # html5lib >= 0.99999999/1.0b9
16 from html5lib.treebuilders import base as treebuildersbase
17except ImportError:
18 # html5lib <= 0.9999999/1.0b8
19 from html5lib.treebuilders import _base as treebuildersbase
14from html5lib.constants import namespaces 20from html5lib.constants import namespaces
21
15from bs4.element import ( 22from bs4.element import (
16 Comment, 23 Comment,
17 Doctype, 24 Doctype,
@@ -54,7 +61,7 @@ class HTML5TreeBuilder(HTMLTreeBuilder):
54 return u'<html><head></head><body>%s</body></html>' % fragment 61 return u'<html><head></head><body>%s</body></html>' % fragment
55 62
56 63
57class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder): 64class TreeBuilderForHtml5lib(treebuildersbase.TreeBuilder):
58 65
59 def __init__(self, soup, namespaceHTMLElements): 66 def __init__(self, soup, namespaceHTMLElements):
60 self.soup = soup 67 self.soup = soup
@@ -92,7 +99,7 @@ class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder):
92 return self.soup 99 return self.soup
93 100
94 def getFragment(self): 101 def getFragment(self):
95 return html5lib.treebuilders._base.TreeBuilder.getFragment(self).element 102 return treebuildersbase.TreeBuilder.getFragment(self).element
96 103
97class AttrList(object): 104class AttrList(object):
98 def __init__(self, element): 105 def __init__(self, element):
@@ -115,9 +122,9 @@ class AttrList(object):
115 return name in list(self.attrs.keys()) 122 return name in list(self.attrs.keys())
116 123
117 124
118class Element(html5lib.treebuilders._base.Node): 125class Element(treebuildersbase.Node):
119 def __init__(self, element, soup, namespace): 126 def __init__(self, element, soup, namespace):
120 html5lib.treebuilders._base.Node.__init__(self, element.name) 127 treebuildersbase.Node.__init__(self, element.name)
121 self.element = element 128 self.element = element
122 self.soup = soup 129 self.soup = soup
123 self.namespace = namespace 130 self.namespace = namespace
@@ -277,7 +284,7 @@ class Element(html5lib.treebuilders._base.Node):
277 284
278class TextNode(Element): 285class TextNode(Element):
279 def __init__(self, element, soup): 286 def __init__(self, element, soup):
280 html5lib.treebuilders._base.Node.__init__(self, None) 287 treebuildersbase.Node.__init__(self, None)
281 self.element = element 288 self.element = element
282 self.soup = soup 289 self.soup = soup
283 290