diff options
author | Daniel Lublin <daniel@lublin.se> | 2016-12-05 20:42:05 +0300 |
---|---|---|
committer | Andrew Jeffery <andrew@aj.id.au> | 2017-06-13 05:57:49 +0300 |
commit | 33a391e6ca1cd2483963d66824f39a41400588d9 (patch) | |
tree | 003c930c253e5dd759591818ac874db4a8d0ca14 | |
parent | 786908a80cdab7d14415e6bf2d0743c21828f552 (diff) | |
download | openbmc-33a391e6ca1cd2483963d66824f39a41400588d9.tar.xz |
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.
Fixes openbmc/openbmc#1766
Change-Id: I2d1957d06a697e32e5e5ca3f03da6655153cf370
Signed-off-by: Daniel Lublin <daniel@lublin.se>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from bitbake.git commit 1679188f9c55c615cae780f2b5e6852dea9cf2ec)
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
-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 f0e5924eb..2b7a70aa1 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 |