libxml2: drop python bindings (#5682)

They are deprecated upstream, and their build process has changed
with 2.15, so remove them now to make the upgrade easier.
This commit is contained in:
Christoph Reiter 2025-09-29 06:39:07 +02:00 committed by GitHub
parent bf0cde41de
commit 53e93419ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 65 deletions

View File

@ -1,13 +1,13 @@
# Maintainer: Alexey Pavlov <alexpux@gmail.com> # Maintainer: Alexey Pavlov <alexpux@gmail.com>
pkgbase=libxml2 pkgbase=libxml2
pkgname=('libxml2' 'libxml2-devel' 'libxml2-python') pkgname=('libxml2' 'libxml2-devel')
pkgver=2.14.6 pkgver=2.14.6
pkgrel=1 pkgrel=2
pkgdesc="XML parsing library, version 2" pkgdesc="XML parsing library, version 2"
arch=(i686 x86_64) arch=(i686 x86_64)
license=('spdx:MIT') license=('spdx:MIT')
makedepends=('gcc' 'python-devel' 'libreadline-devel' makedepends=('gcc' 'libreadline-devel'
'liblzma-devel' 'zlib-devel' 'autotools') 'liblzma-devel' 'zlib-devel' 'autotools')
url="https://gitlab.gnome.org/GNOME/libxml2/-/wikis/" url="https://gitlab.gnome.org/GNOME/libxml2/-/wikis/"
msys2_repository_url="https://gitlab.gnome.org/GNOME/libxml2" msys2_repository_url="https://gitlab.gnome.org/GNOME/libxml2"
@ -15,11 +15,9 @@ msys2_references=(
"cpe: cpe:/a:xmlsoft:libxml2" "cpe: cpe:/a:xmlsoft:libxml2"
) )
source=("https://download.gnome.org/sources/libxml2/${pkgver%.*}/${pkgbase}-${pkgver}.tar.xz" source=("https://download.gnome.org/sources/libxml2/${pkgver%.*}/${pkgbase}-${pkgver}.tar.xz"
https://www.w3.org/XML/Test/xmlts20130923.tar.gz https://www.w3.org/XML/Test/xmlts20130923.tar.gz)
libxml2-2.9.8-python3-unicode-errors.patch)
sha256sums=('7ce458a0affeb83f0b55f1f4f9e0e55735dbfc1a9de124ee86fb4a66b597203a' sha256sums=('7ce458a0affeb83f0b55f1f4f9e0e55735dbfc1a9de124ee86fb4a66b597203a'
'9b61db9f5dbffa545f4b8d78422167083a8568c59bd1129f94138f936cf6fc1f' '9b61db9f5dbffa545f4b8d78422167083a8568c59bd1129f94138f936cf6fc1f')
'0f5d465503b24271e11752262af89c58eb0b26b4901c3b021bd843e6e5d4e95a')
# Helper macros to help make tasks easier # # Helper macros to help make tasks easier #
apply_patch_with_msg() { apply_patch_with_msg() {
@ -47,10 +45,6 @@ prepare() {
mv xmlconf -t ${pkgbase}-${pkgver} mv xmlconf -t ${pkgbase}-${pkgver}
cd ${pkgbase}-${pkgver} cd ${pkgbase}-${pkgver}
# From https://src.fedoraproject.org/rpms/libxml2/tree/main
apply_patch_with_msg \
libxml2-2.9.8-python3-unicode-errors.patch
autoreconf -vfi autoreconf -vfi
} }
@ -74,15 +68,12 @@ build() {
--with-http \ --with-http \
--with-lzma \ --with-lzma \
--without-icu \ --without-icu \
--without-python \
--enable-shared \ --enable-shared \
--enable-static \ --enable-static
--with-python=/usr/bin/python
make make
make DESTDIR=${srcdir}/dest install make DESTDIR=${srcdir}/dest install
PYTHON_SITELIB="$(python -c 'import site, sys; sys.stdout.write(site.getsitepackages()[0])')"
mv ${srcdir}/dest${PYTHON_SITELIB}/${pkgbase/lib/msys-}mod.dll ${srcdir}/dest${PYTHON_SITELIB}/${pkgbase}mod.dll
sed -i -e "s:${pkgbase/lib/msys-}mod:${PN}mod:g" ${srcdir}/dest${PYTHON_SITELIB}/${pkgbase}mod.la
} }
check() { check() {
@ -109,27 +100,10 @@ package_libxml2-devel() {
options=('staticlibs') options=('staticlibs')
depends=("libxml2=${pkgver}" 'libreadline-devel' 'liblzma-devel' 'zlib-devel') depends=("libxml2=${pkgver}" 'libreadline-devel' 'liblzma-devel' 'zlib-devel')
PYTHON_SITELIB="$(python -c 'import site, sys; sys.stdout.write(site.getsitepackages()[0])')"
mkdir -p ${pkgdir}/usr/{bin,share} mkdir -p ${pkgdir}/usr/{bin,share}
cp -f ${srcdir}/dest/usr/bin/*-config ${pkgdir}/usr/bin/ cp -f ${srcdir}/dest/usr/bin/*-config ${pkgdir}/usr/bin/
cp -rf ${srcdir}/dest/usr/include ${pkgdir}/usr/ cp -rf ${srcdir}/dest/usr/include ${pkgdir}/usr/
cp -rf ${srcdir}/dest/usr/lib ${pkgdir}/usr/ cp -rf ${srcdir}/dest/usr/lib ${pkgdir}/usr/
rm -rf ${pkgdir}${PYTHON_SITELIB}
cp -rf ${srcdir}/dest/usr/share/doc ${pkgdir}/usr/share/ cp -rf ${srcdir}/dest/usr/share/doc ${pkgdir}/usr/share/
cp -rf ${srcdir}/dest/usr/share/gtk-doc ${pkgdir}/usr/share/ cp -rf ${srcdir}/dest/usr/share/gtk-doc ${pkgdir}/usr/share/
} }
package_libxml2-python(){
pkgdesc="Libxml2 python modules"
depends=('libxml2')
groups=('python-modules')
options=('staticlibs')
PYTHON_SITELIB="$(python -c 'import site, sys; sys.stdout.write(site.getsitepackages()[0])')"
mkdir -p ${pkgdir}/${PYTHON_SITELIB}
mkdir -p ${pkgdir}/usr/share/doc
cp -rf ${srcdir}/dest${PYTHON_SITELIB}/* ${pkgdir}${PYTHON_SITELIB}/
python -m compileall \
-o 0 -o 1 -q -s"${pkgdir}" -p"/" "${pkgdir}${PYTHON_SITELIB}/"
}

View File

@ -1,32 +0,0 @@
--- libxml2-2.11.4/python/libxml.c.orig 2023-04-11 14:19:21.000000000 +0200
+++ libxml2-2.11.4/python/libxml.c 2023-06-21 10:57:38.374264200 +0200
@@ -1606,6 +1606,7 @@
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);
@@ -1622,12 +1623,20 @@
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 = PyObject_CallObject(libxml_xmlPythonErrorFuncHandler, list);
+ /* Forget any errors caused in the error handler. */
+ PyErr_Clear();
Py_XDECREF(list);
Py_XDECREF(result);
}