diff options
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bs4/builder/_html5lib.py | 17 |
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 | ) |
17 | import html5lib | 17 | import html5lib |
18 | try: | ||
19 | # html5lib >= 0.99999999/1.0b9 | ||
20 | from html5lib.treebuilders import base as treebuildersbase | ||
21 | except ImportError: | ||
22 | # html5lib <= 0.9999999/1.0b8 | ||
23 | from html5lib.treebuilders import _base as treebuildersbase | ||
18 | from html5lib.constants import namespaces | 24 | from html5lib.constants import namespaces |
25 | |||
19 | from bs4.element import ( | 26 | from 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 | ||
70 | class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder): | 77 | class 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 | ||
110 | class AttrList(object): | 117 | class 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 | ||
140 | class Element(html5lib.treebuilders._base.Node): | 147 | class 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 | ||
325 | class TextNode(Element): | 332 | class 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 | ||