summaryrefslogtreecommitdiff
path: root/dev-python/lxml
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/lxml')
-rw-r--r--dev-python/lxml/Manifest2
-rw-r--r--dev-python/lxml/files/lxml-6.0.4-pypy.patch107
-rw-r--r--dev-python/lxml/lxml-6.1.0.ebuild120
-rw-r--r--dev-python/lxml/lxml-6.1.1.ebuild123
-rw-r--r--dev-python/lxml/metadata.xml13
5 files changed, 365 insertions, 0 deletions
diff --git a/dev-python/lxml/Manifest b/dev-python/lxml/Manifest
new file mode 100644
index 000000000000..9f573ba16b5b
--- /dev/null
+++ b/dev-python/lxml/Manifest
@@ -0,0 +1,2 @@
+DIST lxml-6.1.0.gh.tar.gz 992616 BLAKE2B bf0269bb5d757fb91e586b73436a2502b86ba23a4f09143d1af5131ba4d8fbec57cd5ce0804113a8d258c6312f17404b0d67992722f19b9544610bf26f7caf7b SHA512 c738958839f9fb627ede8c4758b849d60be5210617fb2f4d9d2072f9f724a54d63648964b8716b0e23eaba044d77d02e621579c7aaee53fa2e30bc206a4a8534
+DIST lxml-6.1.1.gh.tar.gz 995492 BLAKE2B 0ddb8b59ad1c6fa237830fed00ee5fd8626930a25baa08ab8343530568ae2917dfc2c8bd72a2f700ac62a1420db628ef63a86178790e4405844ccfd271ca3bdb SHA512 c8bd3825f5b15af8a39b7e0a11b114ad67bcfcaf8fd08928e34918ea194525d26fa498057a30a014e452817d78a839bea7cf5221f089ae8ba0d4f5f4527dc62d
diff --git a/dev-python/lxml/files/lxml-6.0.4-pypy.patch b/dev-python/lxml/files/lxml-6.0.4-pypy.patch
new file mode 100644
index 000000000000..deb1dd030213
--- /dev/null
+++ b/dev-python/lxml/files/lxml-6.0.4-pypy.patch
@@ -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)
diff --git a/dev-python/lxml/lxml-6.1.0.ebuild b/dev-python/lxml/lxml-6.1.0.ebuild
new file mode 100644
index 000000000000..c8a269d1e40a
--- /dev/null
+++ b/dev-python/lxml/lxml-6.1.0.ebuild
@@ -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_{13..14} )
+
+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
+}
diff --git a/dev-python/lxml/lxml-6.1.1.ebuild b/dev-python/lxml/lxml-6.1.1.ebuild
new file mode 100644
index 000000000000..a39f0336a7b0
--- /dev/null
+++ b/dev-python/lxml/lxml-6.1.1.ebuild
@@ -0,0 +1,123 @@
+# 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_{13..14} )
+
+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() {
+ # tests are completely broken on pypy by now
+ [[ ${EPYTHON} == pypy* ]] && return
+
+ 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
+}
diff --git a/dev-python/lxml/metadata.xml b/dev-python/lxml/metadata.xml
new file mode 100644
index 000000000000..9a7df49d2481
--- /dev/null
+++ b/dev-python/lxml/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://docs.baldeagleos.com/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ <name>Python</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="cpe">cpe:/a:lxml:lxml</remote-id>
+ <bugs-to>https://bugs.launchpad.net/lxml</bugs-to>
+ </upstream>
+ <origin>baldeagleos-repo</origin>
+</pkgmetadata>