diff options
-rw-r--r-- | import-layers/yocto-poky/bitbake/lib/bs4/builder/_html5lib.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/import-layers/yocto-poky/bitbake/lib/bs4/builder/_html5lib.py b/import-layers/yocto-poky/bitbake/lib/bs4/builder/_html5lib.py index f0e5924ebb..2b7a70aa11 100644 --- a/import-layers/yocto-poky/bitbake/lib/bs4/builder/_html5lib.py +++ b/import-layers/yocto-poky/bitbake/lib/bs4/builder/_html5lib.py @@ -15,7 +15,14 @@ from bs4.element import ( whitespace_re, ) import html5lib +try: + # html5lib >= 0.99999999/1.0b9 + from html5lib.treebuilders import base as treebuildersbase +except ImportError: + # html5lib <= 0.9999999/1.0b8 + from html5lib.treebuilders import _base as treebuildersbase from html5lib.constants import namespaces + from bs4.element import ( Comment, Doctype, @@ -67,7 +74,7 @@ class HTML5TreeBuilder(HTMLTreeBuilder): return '<html><head></head><body>%s</body></html>' % fragment -class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder): +class TreeBuilderForHtml5lib(treebuildersbase.TreeBuilder): def __init__(self, soup, namespaceHTMLElements): self.soup = soup @@ -105,7 +112,7 @@ class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder): return self.soup def getFragment(self): - return html5lib.treebuilders._base.TreeBuilder.getFragment(self).element + return treebuildersbase.TreeBuilder.getFragment(self).element class AttrList(object): def __init__(self, element): @@ -137,9 +144,9 @@ class AttrList(object): return name in list(self.attrs.keys()) -class Element(html5lib.treebuilders._base.Node): +class Element(treebuildersbase.Node): def __init__(self, element, soup, namespace): - html5lib.treebuilders._base.Node.__init__(self, element.name) + treebuildersbase.Node.__init__(self, element.name) self.element = element self.soup = soup self.namespace = namespace @@ -324,7 +331,7 @@ class Element(html5lib.treebuilders._base.Node): class TextNode(Element): def __init__(self, element, soup): - html5lib.treebuilders._base.Node.__init__(self, None) + treebuildersbase.Node.__init__(self, None) self.element = element self.soup = soup |