dev-python/lxml: Sync with Gentoo

It's from Gentoo commit 05e7f4e069e35839e971f46c004b529a6c7abedd.
This commit is contained in:
Flatcar Buildbot 2024-09-02 07:14:50 +00:00 committed by Krzesimir Nowak
parent 50f9efc06f
commit 7dafc6758b
3 changed files with 297 additions and 0 deletions

View File

@ -1 +1,2 @@
DIST lxml-5.2.2.gh.tar.gz 950650 BLAKE2B d9e3bd96f386a808eca58ffa9a6b5a79e43102b7161fac9b97905de2bd22d21feaddb093e27463f597ef5378d754011c2999a38953e6288595b8dd171976688b SHA512 20b87a2d6e7ac82b6979d6fd18ecd5c224fec6eeee6b69d47a5bf2947ce53e6a517d1b86ab68836a5974f78ce86551ddc2317c1a7255932b418b98dc64d59376
DIST lxml-5.3.0.gh.tar.gz 951199 BLAKE2B 8317179c524856593b323f665c288ddddd8af7e716e1ddf1222a857c8466cfc62a6c20b21744ca418f809a3c8492216c5c9c38cfa62f2e7d51daea7343b6810b SHA512 514477bf4c865541233d73f20de816b51d265dbd75c56a0d13779e14527c73e85ca890718d06c08728da228d410459016e9cb8abdad4d03b44a81a04a198fb54

View File

@ -0,0 +1,177 @@
From b6ba59657c8c7e169e8eeb763d85ca6136df3eea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Fri, 29 Mar 2024 16:22:00 +0100
Subject: [PATCH] skip tests that are broken on pypy
---
src/lxml/tests/test_http_io.py | 3 ++-
src/lxml/tests/test_nsclasses.py | 3 ++-
src/lxml/tests/test_objectify.py | 37 ++++++++++++++++++++++++++++++--
3 files changed, 39 insertions(+), 4 deletions(-)
diff --git a/src/lxml/tests/test_http_io.py b/src/lxml/tests/test_http_io.py
index 8385e393..0b259299 100644
--- a/src/lxml/tests/test_http_io.py
+++ b/src/lxml/tests/test_http_io.py
@@ -10,3 +10,3 @@ import gzip
-from .common_imports import etree, HelperTestCase, BytesIO, _bytes
+from .common_imports import etree, HelperTestCase, BytesIO, _bytes, IS_PYPY
from .dummy_http_server import webserver, HTTPRequestCollector
@@ -14,2 +14,3 @@ from .dummy_http_server import webserver, HTTPRequestCollector
+@unittest.skipIf(IS_PYPY, "broken on pypy")
class HttpIOTestCase(HelperTestCase):
diff --git a/src/lxml/tests/test_nsclasses.py b/src/lxml/tests/test_nsclasses.py
index 0c33f20c..08540001 100644
--- a/src/lxml/tests/test_nsclasses.py
+++ b/src/lxml/tests/test_nsclasses.py
@@ -8,3 +8,3 @@ import unittest
-from .common_imports import etree, HelperTestCase, _bytes, make_doctest
+from .common_imports import etree, HelperTestCase, _bytes, make_doctest, IS_PYPY
@@ -45,2 +45,3 @@ class ETreeNamespaceClassesTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_ns_classes(self):
diff --git a/src/lxml/tests/test_objectify.py b/src/lxml/tests/test_objectify.py
index 39fe0098..92c857f8 100644
--- a/src/lxml/tests/test_objectify.py
+++ b/src/lxml/tests/test_objectify.py
@@ -10,3 +10,4 @@ import unittest
from .common_imports import (
- etree, HelperTestCase, fileInTestDir, doctest, make_doctest, _bytes, _str, BytesIO
+ etree, HelperTestCase, fileInTestDir, doctest, make_doctest, _bytes, _str, BytesIO,
+ IS_PYPY
)
@@ -383,2 +384,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_setattr(self):
@@ -818,2 +820,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_build_tree(self):
@@ -847,2 +850,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_bool(self):
@@ -884,2 +888,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_str(self):
@@ -891,2 +896,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_str_intliteral(self):
@@ -898,2 +904,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_str_floatliteral(self):
@@ -905,2 +912,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_str_mul(self):
@@ -917,2 +925,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_str_add(self):
@@ -992,2 +1001,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_ustr(self):
@@ -999,2 +1009,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_ustr_intliteral(self):
@@ -1006,2 +1017,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_ustr_floatliteral(self):
@@ -1013,2 +1025,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_ustr_mul(self):
@@ -1025,2 +1038,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_ustr_add(self):
@@ -1050,2 +1064,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_int(self):
@@ -1066,2 +1081,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_float(self):
@@ -1082,2 +1098,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_float_precision(self):
@@ -1101,2 +1118,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_float_precision_consistency(self):
@@ -1187,2 +1205,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_unregistered(self):
@@ -1349,2 +1368,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_str_cmp(self):
@@ -1376,2 +1396,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_int_cmp(self):
@@ -1398,2 +1419,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_bool_cmp(self):
@@ -2067,2 +2089,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_registered_type_stringify(self):
@@ -2537,2 +2560,3 @@ class ObjectifyTestCase(HelperTestCase):
# type-looked-up as ObjectifiedElement (no annotations)
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_efactory_int(self):
@@ -2542,2 +2566,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_efactory_float(self):
@@ -2547,2 +2572,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_efactory_str(self):
@@ -2552,2 +2578,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_efactory_unicode(self):
@@ -2557,2 +2584,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_efactory_bool(self):
@@ -2562,2 +2590,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_efactory_none(self):
@@ -2567,2 +2596,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_efactory_value_concatenation(self):
@@ -2577,2 +2607,3 @@ class ObjectifyTestCase(HelperTestCase):
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_efactory_nested(self):
@@ -2745,3 +2776,5 @@ def test_suite():
suite.addTests(doctest.DocTestSuite(objectify))
- suite.addTests([make_doctest('objectify.txt')])
+ if not IS_PYPY:
+ suite.addTests([make_doctest('objectify.txt')])
+ suite.addTests([make_doctest('../../../doc/objectify.txt')])
return suite
--
2.46.0

View File

@ -0,0 +1,119 @@
# Copyright 1999-2024 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_{10..13} pypy3 )
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 ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-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.0.10[${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}-5.3.0-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() {
use doc && emake 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
}