On Thu, May 13, 2021 at 08:32:43AM -0400, Daniel Dickman wrote: > Diff below backports a commit so libxml can be built under python 3.9. > > ok?
OK bluhm@ Could you put this link into the patch file? Then it is easier to find upstream for comparison. https://gitlab.gnome.org/GNOME/libxml2/-/commit/e4fb36841800038c289997432ca547c9bfef9db1 > Index: Makefile > =================================================================== > RCS file: /cvs/ports/textproc/libxml/Makefile,v > retrieving revision 1.188 > diff -u -p -u -r1.188 Makefile > --- Makefile 12 May 2021 11:22:35 -0000 1.188 > +++ Makefile 13 May 2021 12:30:47 -0000 > @@ -5,7 +5,7 @@ COMMENT-python= Python bindings for lib > > VERSION= 2.9.10 > REVISION-main= 4 > -REVISION-python= 5 > +REVISION-python= 6 > DISTNAME= libxml2-${VERSION} > PKGNAME-main= libxml-${VERSION} > PKGNAME-python= py3-libxml-${VERSION} > Index: patches/patch-python_libxml_c > =================================================================== > RCS file: /cvs/ports/textproc/libxml/patches/patch-python_libxml_c,v > retrieving revision 1.1 > diff -u -p -u -r1.1 patch-python_libxml_c > --- patches/patch-python_libxml_c 10 Jun 2020 22:54:58 -0000 1.1 > +++ patches/patch-python_libxml_c 13 May 2021 12:30:47 -0000 > @@ -2,9 +2,29 @@ $OpenBSD: patch-python_libxml_c,v 1.1 20 > > https://gitlab.gnome.org/GNOME/libxml2/-/issues/64 > > +Backport commit e4fb3684 for python 3.9 support > + > Index: python/libxml.c > --- python/libxml.c.orig > +++ python/libxml.c > +@@ -294,7 +294,7 @@ xmlPythonFileReadRaw (void * context, char * buffer, i > + lenread = PyBytes_Size(ret); > + data = PyBytes_AsString(ret); > + #ifdef PyUnicode_Check > +- } else if PyUnicode_Check (ret) { > ++ } else if (PyUnicode_Check (ret)) { > + #if PY_VERSION_HEX >= 0x03030000 > + Py_ssize_t size; > + const char *tmp; > +@@ -359,7 +359,7 @@ xmlPythonFileRead (void * context, char * buffer, int > + lenread = PyBytes_Size(ret); > + data = PyBytes_AsString(ret); > + #ifdef PyUnicode_Check > +- } else if PyUnicode_Check (ret) { > ++ } else if (PyUnicode_Check (ret)) { > + #if PY_VERSION_HEX >= 0x03030000 > + Py_ssize_t size; > + const char *tmp; > @@ -1620,6 +1620,7 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNUSED void *ctx, > PyObject *message; > PyObject *result; > Index: patches/patch-python_types_c > =================================================================== > RCS file: patches/patch-python_types_c > diff -N patches/patch-python_types_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-python_types_c 13 May 2021 12:30:47 -0000 > @@ -0,0 +1,53 @@ > +$OpenBSD$ > + > +Backport commit e4fb3684 for python 3.9 support > + > +Index: python/types.c > +--- python/types.c.orig > ++++ python/types.c > +@@ -602,16 +602,16 @@ libxml_xmlXPathObjectPtrConvert(PyObject *obj) > + if (obj == NULL) { > + return (NULL); > + } > +- if PyFloat_Check (obj) { > ++ if (PyFloat_Check (obj)) { > + ret = xmlXPathNewFloat((double) PyFloat_AS_DOUBLE(obj)); > +- } else if PyLong_Check(obj) { > ++ } else if (PyLong_Check(obj)) { > + #ifdef PyLong_AS_LONG > + ret = xmlXPathNewFloat((double) PyLong_AS_LONG(obj)); > + #else > + ret = xmlXPathNewFloat((double) PyInt_AS_LONG(obj)); > + #endif > + #ifdef PyBool_Check > +- } else if PyBool_Check (obj) { > ++ } else if (PyBool_Check (obj)) { > + > + if (obj == Py_True) { > + ret = xmlXPathNewBoolean(1); > +@@ -620,14 +620,14 @@ libxml_xmlXPathObjectPtrConvert(PyObject *obj) > + ret = xmlXPathNewBoolean(0); > + } > + #endif > +- } else if PyBytes_Check (obj) { > ++ } else if (PyBytes_Check (obj)) { > + xmlChar *str; > + > + str = xmlStrndup((const xmlChar *) PyBytes_AS_STRING(obj), > + PyBytes_GET_SIZE(obj)); > + ret = xmlXPathWrapString(str); > + #ifdef PyUnicode_Check > +- } else if PyUnicode_Check (obj) { > ++ } else if (PyUnicode_Check (obj)) { > + #if PY_VERSION_HEX >= 0x03030000 > + xmlChar *str; > + const char *tmp; > +@@ -650,7 +650,7 @@ libxml_xmlXPathObjectPtrConvert(PyObject *obj) > + ret = xmlXPathWrapString(str); > + #endif > + #endif > +- } else if PyList_Check (obj) { > ++ } else if (PyList_Check (obj)) { > + int i; > + PyObject *node; > + xmlNodePtr cur;
