dev-python/lxml: Bump to 6.0.4

Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2026-04-13 05:28:59 +02:00
parent f1750b7ae5
commit ffa40d405b
3 changed files with 228 additions and 0 deletions

View File

@@ -1 +1,2 @@
DIST lxml-6.0.2.gh.tar.gz 990107 BLAKE2B c01a94fef56754599100b65927b40c2d786d631f02bbfe6cff3865a00531ab26fc6a0fe5cf9b02bdcf01beb45ef94fd4436ed4c06f5c8fd9e707bcae80c0f2f4 SHA512 164dc5e38e394f4396faf0b06729039f6807a227e1a2755a6991e6dce569cc64244d5edfd2cf2af0d4e845d7155a76f6e391e32f3d5aac21dff3c07cbbe06460
DIST lxml-6.0.4.gh.tar.gz 992033 BLAKE2B fefffe0c0bdf79a2527c53ce54a079e01f40ce3fc6624ba13b199c88c49c6d4c2d9e59760f6a0646d3f2fa21d9e50a42d3319eb74ad91a044dd5f3d37385914c SHA512 8738d0912ee293f478da87affe07b9ca85542732023bab6ac32dfe97ced9695fcc1bf31e4ddc6d5a2d1d3f87be818344d9414b314e94853b0e82bc0fbe0e51f9

View File

@@ -0,0 +1,107 @@
From f3c07ca0ea5908462a26370f7d7a18bbbc8ae416 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Mon, 13 Apr 2026 05:28:04 +0200
Subject: [PATCH] Skip tests failing on PyPy
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The test failures occur in older lxml versions too, so it's either
a regression in PyPy itself or in Cython.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
src/lxml/tests/test_etree.py | 6 +++++-
src/lxml/tests/test_xslt.py | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/lxml/tests/test_etree.py b/src/lxml/tests/test_etree.py
index 5658ad73..5cf4f136 100644
--- a/src/lxml/tests/test_etree.py
+++ b/src/lxml/tests/test_etree.py
@@ -26,7 +26,7 @@ from .common_imports import etree, HelperTestCase, needs_feature
from .common_imports import fileInTestDir, fileUrlInTestDir, read_file, path2url, tmpfile
from .common_imports import SillyFileLike, LargeFileLikeUnicode, doctest, make_doctest
from .common_imports import canonicalize, _str, _bytes
-from .common_imports import SimpleFSPath
+from .common_imports import SimpleFSPath, IS_PYPY
print(f"""
TESTED VERSION: {etree.__version__}
@@ -5308,6 +5308,7 @@ class ETreeC14NTestCase(HelperTestCase):
self.assertEqual(b'<a><b></b></a>',
data)
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_c14n_file_gzip(self):
tree = self.parse(b'<a>'+b'<b/>'*200+b'</a>')
with tmpfile() as filename:
@@ -5317,6 +5318,7 @@ class ETreeC14NTestCase(HelperTestCase):
self.assertEqual(b'<a>'+b'<b></b>'*200+b'</a>',
data)
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_c14n_file_gzip_pathlike(self):
tree = self.parse(b'<a>'+b'<b/>'*200+b'</a>')
with tmpfile() as filename:
@@ -5624,6 +5626,7 @@ class ETreeWriteTestCase(HelperTestCase):
self.assertEqual(b'<a><b/></a>',
data)
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_write_file_gzip(self):
tree = self.parse(b'<a>'+b'<b/>'*200+b'</a>')
with tmpfile() as filename:
@@ -5633,6 +5636,7 @@ class ETreeWriteTestCase(HelperTestCase):
self.assertEqual(b'<a>'+b'<b/>'*200+b'</a>',
data)
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_write_file_gzip_pathlike(self):
tree = self.parse(b'<a>'+b'<b/>'*200+b'</a>')
with tmpfile() as filename:
diff --git a/src/lxml/tests/test_xslt.py b/src/lxml/tests/test_xslt.py
index 244a46f7..87c084cf 100644
--- a/src/lxml/tests/test_xslt.py
+++ b/src/lxml/tests/test_xslt.py
@@ -14,7 +14,7 @@ from textwrap import dedent
from tempfile import NamedTemporaryFile, mkdtemp
from .common_imports import (
- etree, HelperTestCase, fileInTestDir, make_doctest, SimpleFSPath
+ etree, HelperTestCase, fileInTestDir, make_doctest, SimpleFSPath, IS_PYPY
)
@@ -164,6 +164,7 @@ class ETreeXSLTTestCase(HelperTestCase):
finally:
os.unlink(f.name)
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_xslt_write_output_file_path(self):
with self._xslt_setup() as res:
f = NamedTemporaryFile(delete=False)
@@ -177,6 +178,7 @@ class ETreeXSLTTestCase(HelperTestCase):
finally:
os.unlink(f.name)
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_xslt_write_output_file_pathlike(self):
with self._xslt_setup() as res:
f = NamedTemporaryFile(delete=False)
@@ -190,6 +192,7 @@ class ETreeXSLTTestCase(HelperTestCase):
finally:
os.unlink(f.name)
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_xslt_write_output_file_path_urlescaped(self):
# libxml2 should not unescape file paths.
with self._xslt_setup() as res:
@@ -204,6 +207,7 @@ class ETreeXSLTTestCase(HelperTestCase):
finally:
os.unlink(f.name)
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_xslt_write_output_file_path_urlescaped_plus(self):
with self._xslt_setup() as res:
f = NamedTemporaryFile(prefix='p+%2e', suffix='.xml.gz', delete=False)

View File

@@ -0,0 +1,120 @@
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{11..14} pypy3_11 )
inherit distutils-r1 optfeature toolchain-funcs
DESCRIPTION="A Pythonic binding for the libxml2 and libxslt libraries"
HOMEPAGE="
https://lxml.de/
https://pypi.org/project/lxml/
https://github.com/lxml/lxml/
"
SRC_URI="
https://github.com/lxml/lxml/archive/${P}.tar.gz
-> ${P}.gh.tar.gz
"
S=${WORKDIR}/lxml-${P}
LICENSE="BSD ElementTree GPL-2 PSF-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos ~x64-solaris"
IUSE="doc examples +threads test"
RESTRICT="!test? ( test )"
# Note: lib{xml2,xslt} are used as C libraries, not Python modules.
DEPEND="
>=dev-libs/libxml2-2.10.3:=
>=dev-libs/libxslt-1.1.38
"
RDEPEND="
${DEPEND}
"
BDEPEND="
virtual/pkgconfig
>=dev-python/cython-3.1.4[${PYTHON_USEDEP}]
doc? (
$(python_gen_any_dep '
dev-python/docutils[${PYTHON_USEDEP}]
dev-python/pygments[${PYTHON_USEDEP}]
dev-python/sphinx[${PYTHON_USEDEP}]
dev-python/sphinx-rtd-theme[${PYTHON_USEDEP}]
')
)
test? (
dev-python/cssselect[${PYTHON_USEDEP}]
)
"
PATCHES=(
"${FILESDIR}/${PN}-6.0.4-pypy.patch"
)
python_check_deps() {
use doc || return 0
python_has_version -b "dev-python/docutils[${PYTHON_USEDEP}]" &&
python_has_version -b "dev-python/pygments[${PYTHON_USEDEP}]" &&
python_has_version -b "dev-python/sphinx[${PYTHON_USEDEP}]" &&
python_has_version -b "dev-python/sphinx-rtd-theme[${PYTHON_USEDEP}]"
}
python_prepare_all() {
# don't use some random SDK on Darwin
sed -i -e '/_ldflags =/s/=.*isysroot.*darwin.*None/= None/' \
setupinfo.py || die
distutils-r1_python_prepare_all
}
python_compile() {
local DISTUTILS_ARGS=(
# by default it adds -w to CFLAGS
--warnings
)
tc-export PKG_CONFIG
distutils-r1_python_compile
}
python_compile_all() {
# disable automagic dep on coverage
use doc && emake CYTHON_WITH_COVERAGE= html
}
python_test() {
local dir=${BUILD_DIR}/test$(python_get_sitedir)/lxml
local -x PATH=${BUILD_DIR}/test/usr/bin:${PATH}
cp -al "${BUILD_DIR}"/{install,test} || die
cp -al src/lxml/tests "${dir}/" || die
cp -al src/lxml/html/tests "${dir}/html/" || die
mkdir "${dir}"/../../doc || die
# this one needs to be copied, because upstream uses doc/../../../doc
cp -r "${S}"/doc "${dir}"/../../ || die
ln -s "${S}"/doc "${dir}"/../../../../ || die
"${EPYTHON}" test.py --no-src -vv --all-levels -p ||
die "Tests fail on ${EPYTHON}"
}
python_install_all() {
if use doc; then
local DOCS=( README.rst *.txt doc/*.txt )
local HTML_DOCS=( doc/html/. )
fi
if use examples; then
dodoc -r samples
fi
distutils-r1_python_install_all
}
pkg_postinst() {
optfeature "Support for BeautifulSoup as a parser backend" dev-python/beautifulsoup4
optfeature "Translates CSS selectors to XPath 1.0 expressions" dev-python/cssselect
optfeature "Support for lxml.html.clean sanitizer" dev-python/lxml-html-clean
}