summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Lublin <daniel@lublin.se>2016-12-05 18:42:05 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-07 10:43:20 +0000
commit5c1ad6852e1246fda717582d7fb4959200bf71a6 (patch)
treeaabc71001137a7211a64124dd97ee1572933ae68
parent1b4fa3f095825d09bf7002d13f59472cae9fa263 (diff)
downloadpoky-5c1ad6852e1246fda717582d7fb4959200bf71a6.tar.gz
bitbake: lib/bs4: Fix imports from html5lib >= 0.9999999/1.0b8
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: 1679188f9c55c615cae780f2b5e6852dea9cf2ec) 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 f0e5924ebb..2b7a70aa11 100644
--- a/bitbake/lib/bs4/builder/_html5lib.py
+++ b/bitbake/lib/bs4/builder/_html5lib.py
@@ -15,7 +15,14 @@ from bs4.element import (
15 whitespace_re, 15 whitespace_re,
16) 16)
17import html5lib 17import html5lib
18try:
19 # html5lib >= 0.99999999/1.0b9
20 from html5lib.treebuilders import base as treebuildersbase
21except ImportError:
22 # html5lib <= 0.9999999/1.0b8
23 from html5lib.treebuilders import _base as treebuildersbase
18from html5lib.constants import namespaces 24from html5lib.constants import namespaces
25
19from bs4.element import ( 26from bs4.element import (
20 Comment, 27 Comment,
21 Doctype, 28 Doctype,
@@ -67,7 +74,7 @@ class HTML5TreeBuilder(HTMLTreeBuilder):
67 return '<html><head></head><body>%s</body></html>' % fragment 74 return '<html><head></head><body>%s</body></html>' % fragment
68 75
69 76
70class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder): 77class TreeBuilderForHtml5lib(treebuildersbase.TreeBuilder):
71 78
72 def __init__(self, soup, namespaceHTMLElements): 79 def __init__(self, soup, namespaceHTMLElements):
73 self.soup = soup 80 self.soup = soup
@@ -105,7 +112,7 @@ class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder):
105 return self.soup 112 return self.soup
106 113
107 def getFragment(self): 114 def getFragment(self):
108 return html5lib.treebuilders._base.TreeBuilder.getFragment(self).element 115 return treebuildersbase.TreeBuilder.getFragment(self).element
109 116
110class AttrList(object): 117class AttrList(object):
111 def __init__(self, element): 118 def __init__(self, element):
@@ -137,9 +144,9 @@ class AttrList(object):
137 return name in list(self.attrs.keys()) 144 return name in list(self.attrs.keys())
138 145
139 146
140class Element(html5lib.treebuilders._base.Node): 147class Element(treebuildersbase.Node):
141 def __init__(self, element, soup, namespace): 148 def __init__(self, element, soup, namespace):
142 html5lib.treebuilders._base.Node.__init__(self, element.name) 149 treebuildersbase.Node.__init__(self, element.name)
143 self.element = element 150 self.element = element
144 self.soup = soup 151 self.soup = soup
145 self.namespace = namespace 152 self.namespace = namespace
@@ -324,7 +331,7 @@ class Element(html5lib.treebuilders._base.Node):
324 331
325class TextNode(Element): 332class TextNode(Element):
326 def __init__(self, element, soup): 333 def __init__(self, element, soup):
327 html5lib.treebuilders._base.Node.__init__(self, None) 334 treebuildersbase.Node.__init__(self, None)
328 self.element = element 335 self.element = element
329 self.soup = soup 336 self.soup = soup
330 337