diff --git a/ISO-Schematron-schema-optional.patch b/ISO-Schematron-schema-optional.patch deleted file mode 100644 index 4c7bd46..0000000 --- a/ISO-Schematron-schema-optional.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 4bfab2c821961fb4c5ed8a04e329778c9b09a1df Mon Sep 17 00:00:00 2001 -From: Stefan Behnel -Date: Wed, 12 Jul 2023 16:59:07 +0200 -Subject: [PATCH] Make the validation of ISO-Schematron files optional in lxml, - depending on the availability of the RNG validation file. Some lxml - distributions discard the validation schema file due to licensing issues. - -See https://bugs.launchpad.net/lxml/+bug/2024343 ---- - CHANGES.txt | 8 ++++++++ - doc/validation.txt | 9 +++++++++ - src/lxml/isoschematron/__init__.py | 24 +++++++++++++++++++----- - 3 files changed, 36 insertions(+), 5 deletions(-) - -Index: lxml-4.9.3/CHANGES.txt -=================================================================== ---- lxml-4.9.3.orig/CHANGES.txt -+++ lxml-4.9.3/CHANGES.txt -@@ -27,6 +27,14 @@ Other changes - * Built with Cython 0.29.36 to adapt to changes in Python 3.12. - - -+* LP#2024343: The validation of the schema file itself is now optional in the -+ ISO-Schematron implementation. This was done because some lxml distributions -+ discard the RNG validation schema file due to licensing issues. The validation -+ can now always be disabled with ``Schematron(..., validate_schema=False)``. -+ It is enabled by default if available and disabled otherwise. The module -+ constant ``lxml.isoschematron.schematron_schema_valid_supported`` can be used -+ to detect whether schema file validation is available. -+ - 4.9.2 (2022-12-13) - ================== - -Index: lxml-4.9.3/doc/validation.txt -=================================================================== ---- lxml-4.9.3.orig/doc/validation.txt -+++ lxml-4.9.3/doc/validation.txt -@@ -615,6 +615,15 @@ The usage of validation phases is a uniq - a very powerful tool e.g. for establishing validation stages or to provide - different validators for different "validation audiences". - -+Note: Some lxml distributions exclude the validation schema file due to licensing issues. -+Since lxml 5.0, the validation of the user provided schema can be disabled with -+``Schematron(..., validate_schema=False)``. -+It is enabled by default if available and disabled otherwise. Previous versions of -+lxml always had it enabled and failed at import time if the file was not available. -+Thus, some distributions chose to remove the entire ISO-Schematron support. -+The module constant ``lxml.isoschematron.schematron_schema_valid_supported`` can be used -+since lxml 5.0 to detect whether schema file validation is available. -+ - (Pre-ISO-Schematron) - -------------------- - -Index: lxml-4.9.3/src/lxml/isoschematron/__init__.py -=================================================================== ---- lxml-4.9.3.orig/src/lxml/isoschematron/__init__.py -+++ lxml-4.9.3/src/lxml/isoschematron/__init__.py -@@ -61,10 +61,16 @@ iso_svrl_for_xslt1 = _etree.XSLT(_etree. - svrl_validation_errors = _etree.XPath( - '//svrl:failed-assert', namespaces={'svrl': SVRL_NS}) - -- - # RelaxNG validator for schematron schemas --schematron_schema_valid = _etree.RelaxNG( -- file=os.path.join(_resources_dir, 'rng', 'iso-schematron.rng')) -+schematron_schema_valid_supported = False -+try: -+ schematron_schema_valid = _etree.RelaxNG( -+ file=os.path.join(_resources_dir, 'rng', 'iso-schematron.rng')) -+ schematron_schema_valid_supported = True -+except _etree.RelaxNGParseError: -+ # Some distributions delete the file due to licensing issues. -+ def schematron_schema_valid(arg): -+ raise NotImplementedError("Validating the ISO schematron requires iso-schematron.rng") - - - def stylesheet_params(**kwargs): -@@ -153,6 +159,13 @@ class Schematron(_etree._Validator): - report document gets stored and can be accessed as the ``validation_report`` - property. - -+ If ``validate_schema`` is set to False, the validation of the schema file -+ itself is disabled. Validation happens by default after building the full -+ schema, unless the schema validation file cannot be found at import time, -+ in which case the validation gets disabled. Some lxml distributions exclude -+ this file due to licensing issues. ISO-Schematron validation can then still -+ be used normally, but the schemas themselves cannot be validated. -+ - Here is a usage example:: - - >>> from lxml import etree -@@ -234,7 +247,8 @@ class Schematron(_etree._Validator): - def __init__(self, etree=None, file=None, include=True, expand=True, - include_params={}, expand_params={}, compile_params={}, - store_schematron=False, store_xslt=False, store_report=False, -- phase=None, error_finder=ASSERTS_ONLY): -+ phase=None, error_finder=ASSERTS_ONLY, -+ validate_schema=schematron_schema_valid_supported): - super(Schematron, self).__init__() - - self._store_report = store_report -@@ -273,7 +287,7 @@ class Schematron(_etree._Validator): - schematron = self._include(schematron, **include_params) - if expand: - schematron = self._expand(schematron, **expand_params) -- if not schematron_schema_valid(schematron): -+ if validate_schema and not schematron_schema_valid(schematron): - raise _etree.SchematronParseError( - "invalid schematron schema: %s" % - schematron_schema_valid.error_log) diff --git a/close_file_before_test.patch b/close_file_before_test.patch deleted file mode 100644 index c50bdfe..0000000 --- a/close_file_before_test.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- - src/lxml/tests/test_etree.py | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - ---- a/src/lxml/tests/test_etree.py -+++ b/src/lxml/tests/test_etree.py -@@ -18,6 +18,7 @@ import re - import gc - import operator - import textwrap -+import tempfile - import zlib - import gzip - -@@ -5276,9 +5277,11 @@ class ETreeWriteTestCase(HelperTestCase) - - def test_write_file_gzip_parse(self): - tree = self.parse(_bytes(''+''*200+'')) -- with tmpfile() as filename: -- tree.write(filename, compression=9) -- data = etree.tostring(etree.parse(filename)) -+ with tempfile.NamedTemporaryFile() as f: -+ tree.write(f.name, compression=9) -+ f.file.flush() -+ f.file.seek(0) -+ data = etree.tostring(etree.parse(f.name)) - self.assertEqual(_bytes(''+''*200+''), - data) - diff --git a/lxml-4.9.4.tar.gz b/lxml-4.9.4.tar.gz deleted file mode 100644 index 3bbfb61..0000000 --- a/lxml-4.9.4.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b1541e50b78e15fa06a2670157a1962ef06591d4c998b998047fff5e3236880e -size 3576664 diff --git a/lxml-5.1.0.tar.gz b/lxml-5.1.0.tar.gz new file mode 100644 index 0000000..5dcb371 --- /dev/null +++ b/lxml-5.1.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3eea6ed6e6c918e468e693c41ef07f3c3acc310b70ddd9cc72d9ef84bc9564ca +size 3839638 diff --git a/python-lxml.changes b/python-lxml.changes index 2dd1c48..d86c223 100644 --- a/python-lxml.changes +++ b/python-lxml.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Sun Jan 14 10:00:32 UTC 2024 - Adrian Schröter + +- update to version 5.1.0: + Details on https://lxml.de/5.1/changes-5.1.0.html + removed merged patches: + - ISO-Schematron-schema-optional.patch + - remove-ISO-Schematron-schema.patch + - close_file_before_test.patch + ------------------------------------------------------------------- Wed Dec 20 22:04:14 UTC 2023 - Dirk Müller diff --git a/python-lxml.spec b/python-lxml.spec index 55bb2c6..adb1e98 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -1,7 +1,7 @@ # # spec file for package python-lxml # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-lxml -Version: 4.9.4 +Version: 5.1.0 Release: 0 Summary: Pythonic XML processing library License: BSD-3-Clause AND GPL-2.0-or-later @@ -27,24 +27,18 @@ URL: https://lxml.de/ Source0: https://files.pythonhosted.org/packages/source/l/lxml/lxml-%{version}.tar.gz Source1: https://lxml.de/lxmldoc-4.5.2.pdf Source99: python-lxml.rpmlintrc -# PATCH-FIX-UPSTREAM close_file_before_test.patch bsc#1206555 mcepl@suse.com -# make sure the testing data are flushed to the file -Patch0: close_file_before_test.patch # PATCH-FIX-OPENSUSE Skip a test under libxml2 2.10.4+ # https://bugs.launchpad.net/lxml/+bug/2016939 Patch1: skip-test-under-libxml2-2.10.4.patch # PATCH-FIX-OPENSUSE Skip a test under libxml2 2.11.1+ # https://bugs.launchpad.net/lxml/+bug/2018522 Patch2: skip-test-under-libxml2-2.11.1.patch -# PATCH-FIX-UPSTREAM ISO-Schematron-schema-optional.patch lp#2024343 mcepl@suse.com -# Make ISO Schematron RNG validation schemes optional and then remove it gh#lxml/lxml@4bfab2c82196 -Patch3: ISO-Schematron-schema-optional.patch -# PATCH-FIX-UPSTREAM remove-ISO-Schematron-schema.patch gl#fedora/legal/fedora-license-data/-#154 mcepl@suse.com -# Actually remove the schema -Patch4: remove-ISO-Schematron-schema.patch -BuildRequires: %{python_module Cython >= 0.29.7 with %python-Cython < 3} +BuildRequires: %{python_module Cython >= 3.0.7} BuildRequires: %{python_module base} BuildRequires: %{python_module cssselect >= 0.9.1} +# cyclic dependency +#BuildRequires: %{python_module html5lib} +#BuildRequires: %{python_module beautifulsoup4} BuildRequires: %{python_module setuptools >= 18.0.1} BuildRequires: fdupes %if 0%{?suse_version} == 1500 @@ -113,7 +107,7 @@ export LANG=en_US.UTF-8 export PYTHONUNBUFFERED=x # cyclic dependency between html5lib and lxml rm -v src/lxml/html/tests/test_html5parser.py -%{python_expand PYTHON3="$python" %make_build test3} +%{python_expand PYTHON3="$python" %make_build test} %install %python_install diff --git a/remove-ISO-Schematron-schema.patch b/remove-ISO-Schematron-schema.patch deleted file mode 100644 index 1bba569..0000000 --- a/remove-ISO-Schematron-schema.patch +++ /dev/null @@ -1,731 +0,0 @@ ---- - src/lxml/isoschematron/resources/rng/iso-schematron.rng | 709 ---------------- - src/lxml/tests/test_isoschematron.py | 1 - 2 files changed, 1 insertion(+), 709 deletions(-) - -Index: lxml-4.9.2/src/lxml/isoschematron/resources/rng/iso-schematron.rng -=================================================================== ---- lxml-4.9.2.orig/src/lxml/isoschematron/resources/rng/iso-schematron.rng -+++ /dev/null -@@ -1,709 +0,0 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ltr -- rtl -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- true -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- false -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- false -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- true -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- false -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- preserve -- default -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 1 -- -- -- -Index: lxml-4.9.2/src/lxml/tests/test_isoschematron.py -=================================================================== ---- lxml-4.9.2.orig/src/lxml/tests/test_isoschematron.py -+++ lxml-4.9.2/src/lxml/tests/test_isoschematron.py -@@ -55,6 +55,7 @@ class ETreeISOSchematronTestCase(HelperT - schema = isoschematron.Schematron(schema) - self.assertTrue(schema) - -+ @unittest.skip("No RNG schema present, validation is not possible.") - def test_schematron_invalid_schema_empty(self): - schema = self.parse('''\ - diff --git a/skip-test-under-libxml2-2.10.4.patch b/skip-test-under-libxml2-2.10.4.patch index d3fb77d..ce944ab 100644 --- a/skip-test-under-libxml2-2.10.4.patch +++ b/skip-test-under-libxml2-2.10.4.patch @@ -1,12 +1,12 @@ -Index: lxml-4.9.2/src/lxml/tests/test_etree.py +Index: lxml-5.1.0/src/lxml/tests/test_etree.py =================================================================== ---- lxml-4.9.2.orig/src/lxml/tests/test_etree.py -+++ lxml-4.9.2/src/lxml/tests/test_etree.py -@@ -3068,6 +3068,7 @@ class ETreeOnlyTestCase(HelperTestCase): +--- lxml-5.1.0.orig/src/lxml/tests/test_etree.py ++++ lxml-5.1.0/src/lxml/tests/test_etree.py +@@ -3256,6 +3256,7 @@ class ETreeOnlyTestCase(HelperTestCase): self.assertEqual(re, e.nsmap) self.assertEqual(r, s.nsmap) + @unittest.skipIf(etree.LIBXML_VERSION >= (2, 10, 4), "libxml2 regression ignores namespaces") def test_html_prefix_nsmap(self): etree = self.etree - el = etree.HTML('aa').find('.//page-description') + el = etree.HTML('aa') diff --git a/skip-test-under-libxml2-2.11.1.patch b/skip-test-under-libxml2-2.11.1.patch index 1139722..11492ab 100644 --- a/skip-test-under-libxml2-2.11.1.patch +++ b/skip-test-under-libxml2-2.11.1.patch @@ -1,8 +1,8 @@ -Index: lxml-4.9.2/src/lxml/tests/test_io.py +Index: lxml-5.1.0/src/lxml/tests/test_io.py =================================================================== ---- lxml-4.9.2.orig/src/lxml/tests/test_io.py -+++ lxml-4.9.2/src/lxml/tests/test_io.py -@@ -15,6 +15,7 @@ from .common_imports import ( +--- lxml-5.1.0.orig/src/lxml/tests/test_io.py ++++ lxml-5.1.0/src/lxml/tests/test_io.py +@@ -12,6 +12,7 @@ from .common_imports import ( read_file, write_to_file, BytesIO, tmpfile ) @@ -10,11 +10,11 @@ Index: lxml-4.9.2/src/lxml/tests/test_io.py class _IOTestCaseBase(HelperTestCase): """(c)ElementTree compatibility for IO functions/methods -@@ -304,6 +305,7 @@ class _IOTestCaseBase(HelperTestCase): +@@ -305,6 +306,7 @@ class _IOTestCaseBase(HelperTestCase): os.unlink(f.name) self.assertEqual(utext, root.text) + @unittest.skipIf(lxml.etree.LIBXML_VERSION >= (2, 11, 1), "libxml2 regression has issues with utf16") def test_iterparse_utf16_bom(self): - utext = _str('Søk på nettet') + utext = 'Søk på nettet' uxml = '

%s

' % utext