Hi ports@,

While looking at py-lxml's deps I came across an issue in py-html5lib.
py-lxml 3.6.0 broke "make test" but it turns out it's html5lib's
fault: it was using lxml incorrectly, the issue was noticed and fixed
already, but not yet released:
    https://github.com/lxml/lxml/pull/172#issuecomment-169119391

This update backports a patch from head of line to address the issue:
make test wins now with py-lxml 3.6.0.  It also has the happy property
of not breaking "make test" with the current py-lxml (3.4.3).  It also
addresses a portcheck nit (line > 80 cols).

If nobody cares I'll also take MAINTAINER.

Pax, -A
--
http://haqistan.net/~attila | [email protected] | 0x62A729CF
Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/py-html5lib/Makefile,v
retrieving revision 1.11
diff -u -p -r1.11 Makefile
--- Makefile	1 Jan 2016 20:22:09 -0000	1.11
+++ Makefile	27 Apr 2016 00:08:27 -0000
@@ -6,6 +6,7 @@ MODPY_EGG_VERSION=	0.9999999
 DISTNAME=		html5lib-${MODPY_EGG_VERSION}
 PKGNAME=		py-${DISTNAME}
 CATEGORIES=    		devel www textproc
+REVISION=		1
 
 HOMEPAGE=		https://github.com/html5lib/html5lib-python/
 
@@ -25,6 +26,7 @@ FLAVORS =		python3
 FLAVOR ?=
 
 do-test:
-	cd ${WRKSRC} && ${LOCALBASE}/bin/nosetests${MODPY_BIN_SUFFIX} --first-package-wins
+	cd ${WRKSRC} && ${LOCALBASE}/bin/nosetests${MODPY_BIN_SUFFIX} \
+	    --first-package-wins
 
 .include <bsd.port.mk>
Index: patches/patch-html5lib_ihatexml_py
===================================================================
RCS file: patches/patch-html5lib_ihatexml_py
diff -N patches/patch-html5lib_ihatexml_py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-html5lib_ihatexml_py	27 Apr 2016 00:08:27 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+Backport of patch for comment issue
+--- html5lib/ihatexml.py.orig	Fri Apr 22 18:44:14 2016
++++ html5lib/ihatexml.py	Fri Apr 22 18:45:49 2016
+@@ -225,6 +225,9 @@ class InfosetFilter(object):
+             while "--" in data:
+                 warnings.warn("Comments cannot contain adjacent dashes", DataLossWarning)
+                 data = data.replace("--", "- -")
++            if data.endswith("-"):
++                warnings.warn("Comments cannot end in a dash", DataLossWarning)
++                data += " "
+         return data
+ 
+     def coerceCharacters(self, data):
Index: patches/patch-html5lib_treebuilders_etree_lxml_py
===================================================================
RCS file: patches/patch-html5lib_treebuilders_etree_lxml_py
diff -N patches/patch-html5lib_treebuilders_etree_lxml_py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-html5lib_treebuilders_etree_lxml_py	27 Apr 2016 00:08:27 -0000
@@ -0,0 +1,43 @@
+$OpenBSD$
+
+Backport patch from HEAD to stop test fails due to py-lxml update to 3.6.0
+https://github.com/lxml/lxml/pull/172#issuecomment-169119391
+--- html5lib/treebuilders/etree_lxml.py.orig	Mon Sep  7 18:36:25 2015
++++ html5lib/treebuilders/etree_lxml.py	Fri Apr 22 18:50:50 2016
+@@ -54,7 +54,7 @@ class Document(object):
+ def testSerializer(element):
+     rv = []
+     finalText = None
+-    infosetFilter = ihatexml.InfosetFilter()
++    infosetFilter = ihatexml.InfosetFilter(preventDoubleDashComments=True)
+ 
+     def serializeElement(element, indent=0):
+         if not hasattr(element, "tag"):
+@@ -189,7 +189,7 @@ class TreeBuilder(_base.TreeBuilder):
+ 
+     def __init__(self, namespaceHTMLElements, fullTree=False):
+         builder = etree_builders.getETreeModule(etree, fullTree=fullTree)
+-        infosetFilter = self.infosetFilter = ihatexml.InfosetFilter()
++        infosetFilter = self.infosetFilter = ihatexml.InfosetFilter(preventDoubleDashComments=True)
+         self.namespaceHTMLElements = namespaceHTMLElements
+ 
+         class Attributes(dict):
+@@ -257,7 +257,7 @@ class TreeBuilder(_base.TreeBuilder):
+             data = property(_getData, _setData)
+ 
+         self.elementClass = Element
+-        self.commentClass = builder.Comment
++        self.commentClass = Comment
+         # self.fragmentClass = builder.DocumentFragment
+         _base.TreeBuilder.__init__(self, namespaceHTMLElements)
+ 
+@@ -344,7 +344,8 @@ class TreeBuilder(_base.TreeBuilder):
+ 
+         # Append the initial comments:
+         for comment_token in self.initial_comments:
+-            root.addprevious(etree.Comment(comment_token["data"]))
++            comment = self.commentClass(comment_token["data"])
++            root.addprevious(comment._element)
+ 
+         # Create the root document and add the ElementTree to it
+         self.document = self.documentClass()

Reply via email to