Daniel Jakots <[email protected]> writes:

> On Fri, 29 Apr 2016 14:35:28 -0500, attila <[email protected]>
> wrote:
>
>> 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
>
> I think
> https://github.com/html5lib/html5lib-python/commit/0c551c9519e47f76f8f185089ed71cb9539b6e00
> is a better link to give.

Yes, agreed.  Comments in patches updated.

>> If nobody cares I'll also take MAINTAINER.
>
> Sure, make a new patch with that and the REVISION set to 0 as noted by
> landry@. :)

Yes, also done.

> Cheers,
> Daniel

Thank you both for the feedback.  Updated patch attached.

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	2 May 2016 16:29:32 -0000
@@ -6,9 +6,12 @@ MODPY_EGG_VERSION=	0.9999999
 DISTNAME=		html5lib-${MODPY_EGG_VERSION}
 PKGNAME=		py-${DISTNAME}
 CATEGORIES=    		devel www textproc
+REVISION=		0
 
 HOMEPAGE=		https://github.com/html5lib/html5lib-python/
 
+MAINTAINER =    	Sean Levy <[email protected]>
+
 # MIT
 PERMIT_PACKAGE_CDROM=	Yes
 
@@ -25,6 +28,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	2 May 2016 16:29:32 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+Backport of patch for comment issue:
+https://github.com/html5lib/html5lib-python/commit/0c551c9519e47f76f8f185089ed71cb9539b6e00
+--- 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	2 May 2016 16:29:32 -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/html5lib/html5lib-python/commit/0c551c9519e47f76f8f185089ed71cb9539b6e00
+--- 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