summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Lublin <daniel@lublin.se>2016-12-05 18:42:05 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-03-28 12:56:38 +0100
commit87631919819b6f85f23f57689cd1065c64d7fb03 (patch)
tree1171d138913d85e0003ab37297105f8c774ab438
parentea6d21066a7cce2fef08ad66287170c5995bb1e2 (diff)
downloadpoky-fido.tar.gz
poky-fido.tar.bz2
poky-fido.zip
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 7de36ae75e..0f4007a9bd 100644
--- a/bitbake/lib/bs4/builder/_html5lib.py
+++ b/bitbake/lib/bs4/builder/_html5lib.py
@@ -11,7 +11,14 @@ from bs4.builder import (
)
from bs4.element import NamespacedAttribute
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,
@@ -54,7 +61,7 @@ class HTML5TreeBuilder(HTMLTreeBuilder):
return u'<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
@@ -92,7 +99,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):
@@ -115,9 +122,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
@@ -277,7 +284,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