summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-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