dev-python/lxml: Sync with gentoo

It's from gentoo commit 5fff0082743ecd13049cb14f170aa5d9dc887f28.
This commit is contained in:
Krzesimir Nowak 2021-11-17 20:54:22 +01:00
parent 22be97f004
commit 3e5920e7fb
10 changed files with 666 additions and 245 deletions

View File

@ -1,2 +1,2 @@
DIST lxml-3.7.3.tar.gz 3797713 SHA256 aa502d78a51ee7d127b4824ff96500f0181d3c7826e6ee7b800d068be79361c7 SHA512 9bf1142e81b6e1c8a47e296774d7e448d9ed47de3672f7442cc33274b07252baa47a9346efa9d2fda7b7bb66beb95bbc81f0ae16c9f808ff568f330991dd6d13 WHIRLPOOL d3881f308622ed8beb03a59bbf8256a55b92f5cf41c2c9a0c65c1e53acceea33ab93f420151330b09e8dbde3f717d5c095aa0275406355ec4a17105de46b6bae
DIST lxml-3.8.0.tar.gz 3795205 SHA256 736f72be15caad8116891eb6aa4a078b590d231fdc63818c40c21624ac71db96 SHA512 08f6f352e22ed2bc199a5f34a1c6b5f7b41ec282dc0026c9f16a06466c27e39e8eb18608ba4493636170eeac4b0194f7050445e1cc9bd0a4628573c404593088 WHIRLPOOL b09d7509ca55df74c5ced03ca91b72e0f373df6cb22331a452a35cfe3aa305bb9417280ae0b4835cd4abd29f7df465468799fa25c1b8d732152222c74fee51e1
DIST lxml-4.6.3.tar.gz 948931 BLAKE2B 373248827cb6bc0698b632ef60978adb2b8f7c37444fa1804567f08eb669018dc38fadf52422262fd96280e88c59578d244e4c5a1ed55609af55c010b3bf2b09 SHA512 50e42d6269dc45b4c0ab3285c49307f8bee87fcc4b9e0f531e1ee37bcf83c5938b7e361f906a3158fac8df89a79b932dd64a8839455e45f45f3a5f0ba73ff6a5
DIST lxml-4.6.4.tar.gz 953275 BLAKE2B 7dae0fe0c92c937d823429b32ae952e501e193835892d40746aa35e48586df4e497865f246362ef10430cc9187cd54f98078b7edcc0fd9f421ac9d15994e7b2a SHA512 4e62b7c9ceec47f490136e86e9875aae3f3dccd0ee5e504f8128c62cdb111e00e64ee35678028438b87d32253fdeb8e1184d4017b56e06dfbc93cd0e8736101f

View File

@ -1,39 +0,0 @@
setupinfo.py | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/setupinfo.py b/setupinfo.py
index e04c38f..0549eaa 100644
--- a/setupinfo.py
+++ b/setupinfo.py
@@ -93,19 +93,6 @@ def ext_modules(static_include_dirs, static_library_dirs,
source_extension = ".c"
print("Building without Cython.")
- lib_versions = get_library_versions()
- versions_ok = True
- if lib_versions[0]:
- print("Using build configuration of libxml2 %s and libxslt %s" %
- lib_versions)
- versions_ok = check_min_version(lib_versions[0], (2, 7, 0), 'libxml2')
- else:
- print("Using build configuration of libxslt %s" %
- lib_versions[1])
- versions_ok |= check_min_version(lib_versions[1], (1, 1, 23), 'libxslt')
- if not versions_ok:
- raise RuntimeError("Dependency missing")
-
base_dir = get_base_dir()
_include_dirs = _prefer_reldirs(
base_dir, include_dirs(static_include_dirs) + [INCLUDE_PACKAGE_PATH])
@@ -358,8 +345,9 @@ def get_library_versions():
def flags(option):
- xml2_flags = run_command(find_xml2_config(), "--%s" % option)
- xslt_flags = run_command(find_xslt_config(), "--%s" % option)
+ pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config')
+ xml2_flags = run_command(pkg_config, 'libxml-2.0', '--%s' % option)
+ xslt_flags = run_command(pkg_config, 'libxslt', '--%s' % option)
flag_list = xml2_flags.split()
for flag in xslt_flags.split():

View File

@ -1,36 +0,0 @@
diff --git a/src/lxml/tests/test_xmlschema.py b/src/lxml/tests/test_xmlschema.py
index 26d8432..b41c097 100644
--- a/src/lxml/tests/test_xmlschema.py
+++ b/src/lxml/tests/test_xmlschema.py
@@ -168,31 +168,6 @@ class ETreeXMLSchemaTestCase(HelperTestCase):
self.assertEqual('ho', root[2].get('hardy'))
self.assertEqual('hey', root[3].get('hardy'))
- def test_xmlschema_parse_fixed_attributes(self):
- # does not work as of libxml2 2.7.3
- schema = self.parse('''
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <xsd:element name="a" type="AType"/>
- <xsd:complexType name="AType">
- <xsd:sequence minOccurs="3" maxOccurs="3">
- <xsd:element name="b" type="BType" />
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="BType">
- <xsd:attribute name="hardy" type="xsd:string" fixed="hey" />
- </xsd:complexType>
-</xsd:schema>
-''')
- schema = etree.XMLSchema(schema)
- parser = etree.XMLParser(schema=schema, attribute_defaults=True)
-
- tree_valid = self.parse('<a><b/><b hardy="hey"/><b/></a>',
- parser=parser)
- root = tree_valid.getroot()
- self.assertEqual('hey', root[0].get('hardy'))
- self.assertEqual('hey', root[1].get('hardy'))
- self.assertEqual('hey', root[2].get('hardy'))
-
def test_xmlschema_stringio(self):
schema_file = BytesIO('''
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

View File

@ -0,0 +1,434 @@
From 1804702b5e3c85c1a16014d62365a29d0a6d0c75 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Thu, 30 Jan 2020 06:15:27 +0100
Subject: [PATCH] Skip tests failing on PyPy
---
src/lxml/tests/test_elementtree.py | 3 +-
src/lxml/tests/test_errors.py | 3 +-
src/lxml/tests/test_http_io.py | 3 +-
src/lxml/tests/test_nsclasses.py | 3 +-
src/lxml/tests/test_objectify.py | 41 +++++++++++++++++++++++++--
src/lxml/tests/test_xpathevaluator.py | 7 +++--
src/lxml/tests/test_xslt.py | 7 +++--
7 files changed, 56 insertions(+), 11 deletions(-)
diff --git a/src/lxml/tests/test_elementtree.py b/src/lxml/tests/test_elementtree.py
index 78d8964d..f3f28044 100644
--- a/src/lxml/tests/test_elementtree.py
+++ b/src/lxml/tests/test_elementtree.py
@@ -26,7 +26,7 @@ from .common_imports import (
BytesIO, etree, HelperTestCase,
ElementTree, cElementTree, ET_VERSION, CET_VERSION,
filter_by_version, fileInTestDir, canonicalize, tmpfile,
- _str, _bytes, unicode, IS_PYTHON2
+ _str, _bytes, unicode, IS_PYTHON2, IS_PYPY
)
if cElementTree is not None and (CET_VERSION <= (1,0,7) or sys.version_info[0] >= 3):
@@ -2956,6 +2956,7 @@ class _ETreeTestCaseBase(HelperTestCase):
self.assertEqual('TEST', root2[0].get('{%s}a' % ns_href))
required_versions_ET['test_register_namespace'] = (1,3)
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_register_namespace(self):
# ET 1.3+
Element = self.etree.Element
diff --git a/src/lxml/tests/test_errors.py b/src/lxml/tests/test_errors.py
index c0aee744..33111429 100644
--- a/src/lxml/tests/test_errors.py
+++ b/src/lxml/tests/test_errors.py
@@ -11,7 +11,7 @@ import unittest
import sys, gc, os.path
from lxml import etree
-from .common_imports import HelperTestCase
+from .common_imports import HelperTestCase, IS_PYPY
class ErrorTestCase(HelperTestCase):
@@ -25,6 +25,7 @@ class ErrorTestCase(HelperTestCase):
def test_empty_parse(self):
self.assertRaises(etree.XMLSyntaxError, etree.fromstring, '')
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_element_cyclic_gc_none(self):
# test if cyclic reference can crash etree
Element = self.etree.Element
diff --git a/src/lxml/tests/test_http_io.py b/src/lxml/tests/test_http_io.py
index f9eff39a..edf2bd81 100644
--- a/src/lxml/tests/test_http_io.py
+++ b/src/lxml/tests/test_http_io.py
@@ -11,10 +11,11 @@ import textwrap
import sys
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
+@unittest.skipIf(IS_PYPY, "broken on pypy")
class HttpIOTestCase(HelperTestCase):
etree = etree
diff --git a/src/lxml/tests/test_nsclasses.py b/src/lxml/tests/test_nsclasses.py
index a0aa608d..5aa5dc48 100644
--- a/src/lxml/tests/test_nsclasses.py
+++ b/src/lxml/tests/test_nsclasses.py
@@ -9,7 +9,7 @@ from __future__ import absolute_import
import unittest
-from .common_imports import etree, HelperTestCase, _bytes, make_doctest
+from .common_imports import etree, HelperTestCase, _bytes, make_doctest, IS_PYPY
class ETreeNamespaceClassesTestCase(HelperTestCase):
@@ -46,6 +46,7 @@ class ETreeNamespaceClassesTestCase(HelperTestCase):
self.Namespace('ns02').clear()
self.Namespace('ns03').clear()
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_ns_classes(self):
bluff_dict = {'bluff' : self.bluff_class}
maeh_dict = {'maeh' : self.maeh_class}
diff --git a/src/lxml/tests/test_objectify.py b/src/lxml/tests/test_objectify.py
index a12ae7e1..83ba4ced 100644
--- a/src/lxml/tests/test_objectify.py
+++ b/src/lxml/tests/test_objectify.py
@@ -9,7 +9,8 @@ from __future__ import absolute_import
import unittest, operator
from .common_imports import (
- etree, HelperTestCase, fileInTestDir, doctest, make_doctest, _bytes, _str, BytesIO
+ etree, HelperTestCase, fileInTestDir, doctest, make_doctest, _bytes, _str, BytesIO,
+ IS_PYPY
)
from lxml import objectify
@@ -213,11 +214,13 @@ class ObjectifyTestCase(HelperTestCase):
expected.update(DEFAULT_NSMAP)
self.assertEqual(root.value.nsmap, expected)
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_date_element_efactory_text(self):
# ObjectifiedDataElement can also be used as E-Factory
value = objectify.ObjectifiedDataElement('test', 'toast')
self.assertEqual(value.text, 'testtoast')
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_date_element_efactory_tail(self):
# ObjectifiedDataElement can also be used as E-Factory
value = objectify.ObjectifiedElement(objectify.ObjectifiedDataElement(), 'test', 'toast')
@@ -374,6 +377,7 @@ class ObjectifyTestCase(HelperTestCase):
self.assertEqual("4", getattr(root.c1, "{}c2").text)
self.assertEqual("0", getattr(root.c1, "c2").text)
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_setattr(self):
for val in [
2, 2**32, 1.2, "Won't get fooled again",
@@ -809,6 +813,7 @@ class ObjectifyTestCase(HelperTestCase):
self.assertEqual(3, len(root.findall(".//b")))
self.assertEqual(2, len(root.findall("b")))
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_build_tree(self):
root = self.Element('root')
root.a = 5
@@ -838,6 +843,7 @@ class ObjectifyTestCase(HelperTestCase):
self.assertEqual(value, None)
self.assertEqual(value.get(XML_SCHEMA_NIL_ATTR), "true")
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_bool(self):
Element = self.Element
SubElement = self.etree.SubElement
@@ -871,6 +877,7 @@ class ObjectifyTestCase(HelperTestCase):
self.assertTrue(isinstance(value, objectify.BoolElement))
self.assertEqual(value, False)
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_str(self):
Element = self.Element
SubElement = self.etree.SubElement
@@ -878,6 +885,7 @@ class ObjectifyTestCase(HelperTestCase):
root.s = "test"
self.assertTrue(isinstance(root.s, objectify.StringElement))
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_str_intliteral(self):
Element = self.Element
SubElement = self.etree.SubElement
@@ -885,6 +893,7 @@ class ObjectifyTestCase(HelperTestCase):
root.s = "3"
self.assertTrue(isinstance(root.s, objectify.StringElement))
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_str_floatliteral(self):
Element = self.Element
SubElement = self.etree.SubElement
@@ -892,6 +901,7 @@ class ObjectifyTestCase(HelperTestCase):
root.s = "3.72"
self.assertTrue(isinstance(root.s, objectify.StringElement))
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_str_mul(self):
Element = self.Element
SubElement = self.etree.SubElement
@@ -904,6 +914,7 @@ class ObjectifyTestCase(HelperTestCase):
self.assertRaises(TypeError, operator.mul, root.s, "honk")
self.assertRaises(TypeError, operator.mul, "honk", root.s)
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_str_add(self):
Element = self.Element
SubElement = self.etree.SubElement
@@ -914,6 +925,7 @@ class ObjectifyTestCase(HelperTestCase):
self.assertEqual("test" + s, root.s + s)
self.assertEqual(s + "test", s + root.s)
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_str_mod(self):
s = "%d %f %s %r"
el = objectify.DataElement(s)
@@ -979,6 +991,7 @@ class ObjectifyTestCase(HelperTestCase):
self.assertTrue(isinstance(value, objectify.StringElement))
self.assertEqual(value, "3.20")
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_ustr(self):
Element = self.Element
SubElement = self.etree.SubElement
@@ -986,6 +999,7 @@ class ObjectifyTestCase(HelperTestCase):
root.s = _str("test")
self.assertTrue(isinstance(root.s, objectify.StringElement))
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_ustr_intliteral(self):
Element = self.Element
SubElement = self.etree.SubElement
@@ -993,6 +1007,7 @@ class ObjectifyTestCase(HelperTestCase):
root.s = _str("3")
self.assertTrue(isinstance(root.s, objectify.StringElement))
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_ustr_floatliteral(self):
Element = self.Element
SubElement = self.etree.SubElement
@@ -1000,6 +1015,7 @@ class ObjectifyTestCase(HelperTestCase):
root.s = _str("3.72")
self.assertTrue(isinstance(root.s, objectify.StringElement))
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_ustr_mul(self):
Element = self.Element
SubElement = self.etree.SubElement
@@ -1012,6 +1028,7 @@ class ObjectifyTestCase(HelperTestCase):
self.assertRaises(TypeError, operator.mul, root.s, _str("honk"))
self.assertRaises(TypeError, operator.mul, _str("honk"), root.s)
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_ustr_add(self):
Element = self.Element
SubElement = self.etree.SubElement
@@ -1037,6 +1054,7 @@ class ObjectifyTestCase(HelperTestCase):
self.assertTrue(isinstance(value, objectify.StringElement))
self.assertEqual(value, _str("3.20"))
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_int(self):
Element = self.Element
root = Element("{objectified}root")
@@ -1053,6 +1071,7 @@ class ObjectifyTestCase(HelperTestCase):
value = objectify.DataElement(123)
self.assertEqual(hash(value), hash(123))
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_float(self):
Element = self.Element
SubElement = self.etree.SubElement
@@ -1069,6 +1088,7 @@ class ObjectifyTestCase(HelperTestCase):
value = objectify.DataElement(5.5)
self.assertEqual(hash(value), hash(5.5))
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_float_precision(self):
# test not losing precision by shortened float str() value
# repr(2.305064300557): '2.305064300557'
@@ -1088,6 +1108,7 @@ class ObjectifyTestCase(HelperTestCase):
s = "2.305064300557"
self.assertEqual(objectify.FloatElement(s), float(s))
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_float_precision_consistency(self):
# test consistent FloatElement values for the different instantiation
# possibilities
@@ -1169,6 +1190,7 @@ class ObjectifyTestCase(HelperTestCase):
self.assertEqual(value.text, None)
self.assertEqual(value.pyval, None)
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_unregistered(self):
Element = self.Element
SubElement = self.etree.SubElement
@@ -1331,6 +1353,7 @@ class ObjectifyTestCase(HelperTestCase):
self.assertEqual(["why", "try"],
strs)
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_str_cmp(self):
XML = self.XML
root = XML(_bytes('<root><b>test</b><b>taste</b><b></b><b/></root>'))
@@ -1358,6 +1381,7 @@ class ObjectifyTestCase(HelperTestCase):
self.assertEqual(root.b, "")
self.assertEqual("", root.b)
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_int_cmp(self):
XML = self.XML
root = XML(_bytes('<root><b>5</b><b>6</b></root>'))
@@ -1380,6 +1404,7 @@ class ObjectifyTestCase(HelperTestCase):
# float + long share the NumberElement implementation with int
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_type_bool_cmp(self):
XML = self.XML
root = XML(_bytes('<root><b>false</b><b>true</b></root>'))
@@ -2049,6 +2074,7 @@ class ObjectifyTestCase(HelperTestCase):
before = [objectify.getRegisteredTypes()[0].name],
after = [objectify.getRegisteredTypes()[1].name])
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_registered_type_stringify(self):
from datetime import datetime
def parse_date(value):
@@ -2519,46 +2545,55 @@ class ObjectifyTestCase(HelperTestCase):
# E-Factory tests, need to use sub-elements as root element is always
# type-looked-up as ObjectifiedElement (no annotations)
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_efactory_int(self):
E = objectify.E
root = E.root(E.val(23))
self.assertTrue(isinstance(root.val, objectify.IntElement))
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_efactory_float(self):
E = objectify.E
root = E.root(E.val(233.23))
self.assertTrue(isinstance(root.val, objectify.FloatElement))
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_efactory_str(self):
E = objectify.E
root = E.root(E.val("what?"))
self.assertTrue(isinstance(root.val, objectify.StringElement))
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_efactory_unicode(self):
E = objectify.E
root = E.root(E.val(_str("blöödy häll", encoding="ISO-8859-1")))
self.assertTrue(isinstance(root.val, objectify.StringElement))
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_efactory_bool(self):
E = objectify.E
root = E.root(E.val(True))
self.assertTrue(isinstance(root.val, objectify.BoolElement))
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_efactory_none(self):
E = objectify.E
root = E.root(E.val(None))
self.assertTrue(isinstance(root.val, objectify.NoneElement))
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_efactory_value_concatenation(self):
E = objectify.E
root = E.root(E.val(1, "foo", 2.0, "bar ", True, None))
self.assertTrue(isinstance(root.val, objectify.StringElement))
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_efactory_attrib(self):
E = objectify.E
root = E.root(foo="bar")
self.assertEqual(root.get("foo"), "bar")
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_efactory_nested(self):
E = objectify.E
DataElement = objectify.DataElement
@@ -2573,6 +2608,7 @@ class ObjectifyTestCase(HelperTestCase):
self.assertTrue(isinstance(root.value[0], objectify.IntElement))
self.assertTrue(isinstance(root.value[1], objectify.FloatElement))
+ @unittest.skipIf(IS_PYPY, "broken on pypy")
def test_efactory_subtype(self):
class Attribute(objectify.ObjectifiedDataElement):
def __init__(self):
@@ -2674,7 +2710,8 @@ def test_suite():
suite = unittest.TestSuite()
suite.addTests([unittest.makeSuite(ObjectifyTestCase)])
suite.addTests(doctest.DocTestSuite(objectify))
- suite.addTests([make_doctest('../../../doc/objectify.txt')])
+ if not IS_PYPY:
+ suite.addTests([make_doctest('../../../doc/objectify.txt')])
return suite
if __name__ == '__main__':
diff --git a/src/lxml/tests/test_xpathevaluator.py b/src/lxml/tests/test_xpathevaluator.py
index 13ee97ec..6d162c6d 100644
--- a/src/lxml/tests/test_xpathevaluator.py
+++ b/src/lxml/tests/test_xpathevaluator.py
@@ -8,7 +8,7 @@ from __future__ import absolute_import
import unittest, sys
-from .common_imports import etree, HelperTestCase, _bytes, BytesIO, doctest, make_doctest
+from .common_imports import etree, HelperTestCase, _bytes, BytesIO, doctest, make_doctest, IS_PYPY
class ETreeXPathTestCase(HelperTestCase):
@@ -740,8 +740,9 @@ def test_suite():
suite.addTests([unittest.makeSuite(ETreeXPathExsltTestCase)])
suite.addTests([unittest.makeSuite(ETreeETXPathClassTestCase)])
suite.addTests([doctest.DocTestSuite()])
- suite.addTests(
- [make_doctest('../../../doc/xpathxslt.txt')])
+ if not IS_PYPY:
+ suite.addTests(
+ [make_doctest('../../../doc/xpathxslt.txt')])
return suite
if __name__ == '__main__':
diff --git a/src/lxml/tests/test_xslt.py b/src/lxml/tests/test_xslt.py
index cde23357..41f8d78b 100644
--- a/src/lxml/tests/test_xslt.py
+++ b/src/lxml/tests/test_xslt.py
@@ -17,6 +17,8 @@ from textwrap import dedent
from tempfile import NamedTemporaryFile, mkdtemp
is_python3 = sys.version_info[0] >= 3
+is_pypy = (getattr(sys, 'implementation', None) == 'pypy' or
+ getattr(sys, 'pypy_version_info', None) is not None)
try:
unicode
@@ -2085,8 +2087,9 @@ def test_suite():
suite.addTests([unittest.makeSuite(Py3XSLTTestCase)])
suite.addTests(
[make_doctest('../../../doc/extensions.txt')])
- suite.addTests(
- [make_doctest('../../../doc/xpathxslt.txt')])
+ if not is_pypy:
+ suite.addTests(
+ [make_doctest('../../../doc/xpathxslt.txt')])
return suite
if __name__ == '__main__':
--
2.25.0

View File

@ -0,0 +1,22 @@
https://github.com/lxml/lxml/commit/852ed1092bd80b6b9a51db24371047ec88843031
https://bugs.gentoo.org/791190
From: Stefan Behnel <stefan_ml@behnel.de>
Date: Tue, 18 May 2021 22:02:02 +0200
Subject: [PATCH] Adapt a test to a behavioural change in libxml2 2.9.11+.
--- a/src/lxml/tests/test_etree.py
+++ b/src/lxml/tests/test_etree.py
@@ -3036,7 +3036,10 @@ def test_subelement_nsmap(self):
def test_html_prefix_nsmap(self):
etree = self.etree
el = etree.HTML('<hha:page-description>aa</hha:page-description>').find('.//page-description')
- self.assertEqual({'hha': None}, el.nsmap)
+ if etree.LIBXML_VERSION < (2, 9, 11):
+ self.assertEqual({'hha': None}, el.nsmap)
+ else:
+ self.assertEqual({}, el.nsmap)
def test_getchildren(self):
Element = self.etree.Element

View File

@ -1,80 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
inherit distutils-r1 eutils flag-o-matic toolchain-funcs
DESCRIPTION="A Pythonic binding for the libxml2 and libxslt libraries"
HOMEPAGE="http://lxml.de/ https://pypi.python.org/pypi/lxml/"
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
LICENSE="BSD ElementTree GPL-2 PSF-2"
SLOT="0"
KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
IUSE="doc examples +threads test"
# Note: lib{xml2,xslt} are used as C libraries, not Python modules.
RDEPEND="
>=dev-libs/libxml2-2.9.2
>=dev-libs/libxslt-1.1.28"
DEPEND="${RDEPEND}
dev-python/setuptools[${PYTHON_USEDEP}]
test? ( dev-python/cssselect[${PYTHON_USEDEP}] )
"
DISTUTILS_IN_SOURCE_BUILD=1
PATCHES=(
"${FILESDIR}"/${PN}-3.5.0-cross-compile.patch
# This patch removes a testcase that fails because of issues
# in libxml2.
#
# Upstream bug: https://bugs.launchpad.net/lxml/+bug/1608479
"${FILESDIR}"/${PN}-3.6.4-fix-test_xmlschema.patch
)
python_prepare_all() {
# avoid replacing PYTHONPATH in tests.
sed -i '/sys\.path/d' test.py || die
distutils-r1_python_prepare_all
}
python_compile() {
if [[ ${EPYTHON} != python3* ]]; then
local -x CFLAGS="${CFLAGS}"
append-cflags -fno-strict-aliasing
fi
tc-export PKG_CONFIG
distutils-r1_python_compile
}
python_test() {
cp -r -l src/lxml/tests "${BUILD_DIR}"/lib/lxml/ || die
cp -r -l src/lxml/html/tests "${BUILD_DIR}"/lib/lxml/html/ || die
ln -s "${S}"/doc "${BUILD_DIR}"/ || die
"${EPYTHON}" test.py -vv --all-levels -p || die "Test ${test} fails with ${EPYTHON}"
}
python_install_all() {
if use doc; then
local DOCS=( *.txt doc/*.txt )
local HTML_DOCS=( doc/html/. )
fi
if use examples; then
docinto examples
dodoc -r samples/.
fi
distutils-r1_python_install_all
}
pkg_postinst() {
optfeature "Support for BeautifulSoup3 as a parser backend" dev-python/beautifulsoup
optfeature "Translates CSS selectors to XPath 1.0 expressions" dev-python/cssselect
}

View File

@ -1,80 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
inherit distutils-r1 eutils flag-o-matic toolchain-funcs
DESCRIPTION="A Pythonic binding for the libxml2 and libxslt libraries"
HOMEPAGE="http://lxml.de/ https://pypi.python.org/pypi/lxml/ https://github.com/lxml/lxml"
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
LICENSE="BSD ElementTree GPL-2 PSF-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
IUSE="doc examples +threads test"
# Note: lib{xml2,xslt} are used as C libraries, not Python modules.
RDEPEND="
>=dev-libs/libxml2-2.9.2
>=dev-libs/libxslt-1.1.28"
DEPEND="${RDEPEND}
dev-python/setuptools[${PYTHON_USEDEP}]
test? ( dev-python/cssselect[${PYTHON_USEDEP}] )
"
DISTUTILS_IN_SOURCE_BUILD=1
PATCHES=(
"${FILESDIR}"/${PN}-3.5.0-cross-compile.patch
# This patch removes a testcase that fails because of issues
# in libxml2.
#
# Upstream bug: https://bugs.launchpad.net/lxml/+bug/1608479
"${FILESDIR}"/${PN}-3.6.4-fix-test_xmlschema.patch
)
python_prepare_all() {
# avoid replacing PYTHONPATH in tests.
sed -i '/sys\.path/d' test.py || die
distutils-r1_python_prepare_all
}
python_compile() {
if [[ ${EPYTHON} != python3* ]]; then
local -x CFLAGS="${CFLAGS}"
append-cflags -fno-strict-aliasing
fi
tc-export PKG_CONFIG
distutils-r1_python_compile
}
python_test() {
cp -r -l src/lxml/tests "${BUILD_DIR}"/lib/lxml/ || die
cp -r -l src/lxml/html/tests "${BUILD_DIR}"/lib/lxml/html/ || die
ln -s "${S}"/doc "${BUILD_DIR}"/ || die
"${EPYTHON}" test.py -vv --all-levels -p || die "Test ${test} fails with ${EPYTHON}"
}
python_install_all() {
if use doc; then
local DOCS=( *.txt doc/*.txt )
local HTML_DOCS=( doc/html/. )
fi
if use examples; then
docinto examples
dodoc -r samples/.
fi
distutils-r1_python_install_all
}
pkg_postinst() {
optfeature "Support for BeautifulSoup3 as a parser backend" dev-python/beautifulsoup
optfeature "Translates CSS selectors to XPath 1.0 expressions" dev-python/cssselect
}

View File

@ -0,0 +1,101 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{7..10} 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"
S=${WORKDIR}/lxml-${P}
LICENSE="BSD ElementTree GPL-2 PSF-2"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
IUSE="doc examples +threads test"
RESTRICT="!test? ( test )"
# Note: lib{xml2,xslt} are used as C libraries, not Python modules.
RDEPEND="
>=dev-libs/libxml2-2.9.12-r2
>=dev-libs/libxslt-1.1.28"
DEPEND="${RDEPEND}"
BDEPEND="
virtual/pkgconfig
dev-python/cython[${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}] )
"
DISTUTILS_IN_SOURCE_BUILD=1
PATCHES=(
"${FILESDIR}"/${PN}-4.6.0-tests-pypy.patch
"${FILESDIR}"/${P}-tests-libxml2.patch
)
python_check_deps() {
use doc || return 0
has_version "dev-python/docutils[${PYTHON_USEDEP}]" &&
has_version "dev-python/pygments[${PYTHON_USEDEP}]" &&
has_version "dev-python/sphinx[${PYTHON_USEDEP}]" &&
has_version "dev-python/sphinx_rtd_theme[${PYTHON_USEDEP}]"
}
python_prepare_all() {
# avoid replacing PYTHONPATH in tests.
sed -i -e '/sys\.path/d' test.py || die
# 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() {
if ! python_is_python3; then
local -x CFLAGS="${CFLAGS} -fno-strict-aliasing"
fi
tc-export PKG_CONFIG
distutils-r1_python_compile
}
python_compile_all() {
use doc && emake html
}
python_test() {
cp -r -l src/lxml/tests "${BUILD_DIR}"/lib/lxml/ || die
cp -r -l src/lxml/html/tests "${BUILD_DIR}"/lib/lxml/html/ || die
ln -s "${S}"/doc "${BUILD_DIR}"/ || die
"${EPYTHON}" test.py -vv --all-levels -p || die "Test ${test} fails with ${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
}

View File

@ -0,0 +1,97 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{8..10} 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"
S=${WORKDIR}/lxml-${P}
LICENSE="BSD ElementTree GPL-2 PSF-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
IUSE="doc examples +threads test"
RESTRICT="!test? ( test )"
# Note: lib{xml2,xslt} are used as C libraries, not Python modules.
RDEPEND="
>=dev-libs/libxml2-2.9.12-r2
>=dev-libs/libxslt-1.1.28"
DEPEND="${RDEPEND}"
BDEPEND="
virtual/pkgconfig
dev-python/cython[${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}] )
"
DISTUTILS_IN_SOURCE_BUILD=1
PATCHES=(
"${FILESDIR}"/${PN}-4.6.0-tests-pypy.patch
)
python_check_deps() {
use doc || return 0
has_version "dev-python/docutils[${PYTHON_USEDEP}]" &&
has_version "dev-python/pygments[${PYTHON_USEDEP}]" &&
has_version "dev-python/sphinx[${PYTHON_USEDEP}]" &&
has_version "dev-python/sphinx_rtd_theme[${PYTHON_USEDEP}]"
}
python_prepare_all() {
# avoid replacing PYTHONPATH in tests.
sed -i -e '/sys\.path/d' test.py || die
# 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() {
tc-export PKG_CONFIG
distutils-r1_python_compile
}
python_compile_all() {
use doc && emake html
}
python_test() {
cp -r -l src/lxml/tests "${BUILD_DIR}"/lib/lxml/ || die
cp -r -l src/lxml/html/tests "${BUILD_DIR}"/lib/lxml/html/ || die
ln -s "${S}"/doc "${BUILD_DIR}"/ || die
"${EPYTHON}" test.py -vv --all-levels -p || die "Test ${test} fails with ${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
}

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>python@gentoo.org</email>
@ -7,5 +7,7 @@
</maintainer>
<upstream>
<remote-id type="pypi">lxml</remote-id>
<remote-id type="github">lxml/lxml</remote-id>
<bugs-to>https://bugs.launchpad.net/lxml</bugs-to>
</upstream>
</pkgmetadata>