Skip to content
Snippets Groups Projects
Commit 27191e34 authored by Leo's avatar Leo
Browse files

main/libxml2: finish removing python2 bits

parent 77da6c3e
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=libxml2
pkgver=2.9.10
pkgrel=1
pkgrel=2
pkgdesc="XML parsing library, version 2"
url="http://www.xmlsoft.org/"
arch="all"
......@@ -15,6 +15,7 @@ subpackages="$pkgname-dbg $pkgname-doc $pkgname-dev $pkgname-utils
options="!strip"
source="http://xmlsoft.org/sources/libxml2-$pkgver.tar.gz
revert-Make-xmlFreeNodeList-non-recursive.patch
libxml2-2.9.8-python3-unicode-errors.patch
"
# secfixes:
......@@ -39,11 +40,9 @@ prepare() {
# We don't build libxml2 with icu.
rm test/icu_parse_test.xml
cp -ra "$builddir" "$builddir"-python2
}
libxml2_configure() {
build() {
./configure \
--build=$CBUILD \
--host=$CHOST \
......@@ -53,31 +52,17 @@ libxml2_configure() {
--infodir=/usr/share/info \
--with-lzma \
--with-zlib \
"$@"
}
build() {
cd "$builddir"
libxml2_configure \
--with-python=/usr/bin/python3
make
msg "build python2"
cd "$builddir"-python2
libxml2_configure \
--with-python=/usr/bin/python2
make
}
check() {
rm "$builddir"-python2/test/ebcdic_566012.xml
make -C "$builddir"-python2 runtests
rm -f test/ebcdic_566012.xml
make runtests
}
package() {
cd "$builddir"
make -j1 DESTDIR="$pkgdir" install
make -j1 -C "$builddir"-python2/python DESTDIR="$pkgdir" install
# We don't need static lib for python bindings.
rm "$pkgdir"/usr/lib/python*/site-packages/*.a
......@@ -102,4 +87,5 @@ utils() {
}
sha512sums="0adfd12bfde89cbd6296ba6e66b6bed4edb814a74b4265bda34d95c41d9d92c696ee7adb0c737aaf9cc6e10426a31a35079b2a23d26c074e299858da12c072ed libxml2-2.9.10.tar.gz
347178e432379d543683cba21b902e7305202c03e8dbd724ae395963d677096a5cfc4e345e208d498163ca5174683c167610fc2b297090476038bc2bb7c84b4f revert-Make-xmlFreeNodeList-non-recursive.patch"
347178e432379d543683cba21b902e7305202c03e8dbd724ae395963d677096a5cfc4e345e208d498163ca5174683c167610fc2b297090476038bc2bb7c84b4f revert-Make-xmlFreeNodeList-non-recursive.patch
a205c97fa1488fb8907cfa08b5f82e2055c80b86213dc3cc5c4b526fe6aa786bcc4e4eeb226c44635a1d021307b39e3940f706c42fb60e9e3e9b490a84164df7 libxml2-2.9.8-python3-unicode-errors.patch"
Index: libxml2-2.9.5/python/libxml.c
===================================================================
--- libxml2-2.9.5.orig/python/libxml.c
+++ libxml2-2.9.5/python/libxml.c
@@ -1620,6 +1620,7 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU
PyObject *message;
PyObject *result;
char str[1000];
+ unsigned char *ptr = (unsigned char *)str;
#ifdef DEBUG_ERROR
printf("libxml_xmlErrorFuncHandler(%p, %s, ...) called\n", ctx, msg);
@@ -1636,12 +1637,20 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU
str[999] = 0;
va_end(ap);
+#if PY_MAJOR_VERSION >= 3
+ /* Ensure the error string doesn't start at UTF8 continuation. */
+ while (*ptr && (*ptr & 0xc0) == 0x80)
+ ptr++;
+#endif
+
list = PyTuple_New(2);
PyTuple_SetItem(list, 0, libxml_xmlPythonErrorFuncCtxt);
Py_XINCREF(libxml_xmlPythonErrorFuncCtxt);
- message = libxml_charPtrConstWrap(str);
+ message = libxml_charPtrConstWrap(ptr);
PyTuple_SetItem(list, 1, message);
result = PyEval_CallObject(libxml_xmlPythonErrorFuncHandler, list);
+ /* Forget any errors caused in the error handler. */
+ PyErr_Clear();
Py_XDECREF(list);
Py_XDECREF(result);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment