diff --git a/07db761f9f.patch b/07db761f9f.patch deleted file mode 100644 index f6070a5281dc37f2ceee27dc8e518aef2848f22f..0000000000000000000000000000000000000000 --- a/07db761f9f.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 07db761f9f027d1814a43686cda6fca26e37a931 Mon Sep 17 00:00:00 2001 -From: Stefan Behnel -Date: Thu, 11 May 2023 10:29:02 +0200 -Subject: [PATCH] Avoid using the deprecated "imp" module. - -Closes https://bugs.launchpad.net/lxml/+bug/2018137 ---- - src/lxml/html/tests/test_html5parser.py | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/src/lxml/html/tests/test_html5parser.py b/src/lxml/html/tests/test_html5parser.py -index 56afe98b7..bcf7f1b12 100644 ---- a/src/lxml/html/tests/test_html5parser.py -+++ b/src/lxml/html/tests/test_html5parser.py -@@ -1,5 +1,4 @@ - import os --import imp - try: - from StringIO import StringIO - except ImportError: # python 3 -@@ -45,7 +44,10 @@ def find_module(self, fullname, path=None): - return None - - def load_module(self, fullname): -- mod = sys.modules.setdefault(fullname, imp.new_module(fullname)) -+ fake_module = object() -+ fake_module.__qualname__ = fullname -+ fake_module.__name__ = fullname.rsplit('.', 1)[-1] -+ mod = sys.modules.setdefault(fullname, fake_module) - mod.__file__, mod.__loader__, mod.__path__ = "", self, [] - mod.__dict__.update(self.mocks[fullname]) - return mod diff --git a/380.patch b/380.patch deleted file mode 100644 index daac4452f03897134763c14e88313abced121885..0000000000000000000000000000000000000000 --- a/380.patch +++ /dev/null @@ -1,24 +0,0 @@ -From d18f2f22218ea0e0b5327b5a2bda789afdf16e41 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= -Date: Fri, 14 Jul 2023 12:18:25 +0200 -Subject: [PATCH] Skip test_isoschematron.test_schematron_invalid_schema_empty - without the RNG file - -The expected SchematronParseError only happens when validate_schema is true. ---- - src/lxml/tests/test_isoschematron.py | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/lxml/tests/test_isoschematron.py b/src/lxml/tests/test_isoschematron.py -index 6d2aa3fb6..900f257c3 100644 ---- a/src/lxml/tests/test_isoschematron.py -+++ b/src/lxml/tests/test_isoschematron.py -@@ -55,6 +55,8 @@ def test_schematron_empty_pattern(self): - schema = isoschematron.Schematron(schema) - self.assertTrue(schema) - -+ @unittest.skipIf(not isoschematron.schematron_schema_valid_supported, -+ 'SchematronParseError is risen only when validate_schema is true') - def test_schematron_invalid_schema_empty(self): - schema = self.parse('''\ - diff --git a/Make-the-validation-of-ISO-Schematron-files-optional.patch b/Make-the-validation-of-ISO-Schematron-files-optional.patch deleted file mode 100644 index d07006ed25801ed4528d321f8b8cfcb73981e220..0000000000000000000000000000000000000000 --- a/Make-the-validation-of-ISO-Schematron-files-optional.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 4ac96ce046e9f58141bd66639ba8cb1fad9deefb 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 | 11 +++++++++++ - doc/validation.txt | 9 +++++++++ - src/lxml/isoschematron/__init__.py | 24 +++++++++++++++++++----- - 3 files changed, 39 insertions(+), 5 deletions(-) - -diff --git a/CHANGES.txt b/CHANGES.txt -index c684ad5..40e32cd 100644 ---- a/CHANGES.txt -+++ b/CHANGES.txt -@@ -2,6 +2,17 @@ - lxml changelog - ============== - -+4.9.2+ -+====== -+ -+* 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) - ================== - -diff --git a/doc/validation.txt b/doc/validation.txt -index af9d007..27c0ccd 100644 ---- a/doc/validation.txt -+++ b/doc/validation.txt -@@ -615,6 +615,15 @@ The usage of validation phases is a unique feature of ISO-Schematron and can be - 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 4.9.2-8, 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 4.9.2-8 to detect whether schema file validation is available. -+ - (Pre-ISO-Schematron) - -------------------- - -diff --git a/src/lxml/isoschematron/__init__.py b/src/lxml/isoschematron/__init__.py -index 5967b10..2846a66 100644 ---- a/src/lxml/isoschematron/__init__.py -+++ b/src/lxml/isoschematron/__init__.py -@@ -61,10 +61,16 @@ iso_svrl_for_xslt1 = _etree.XSLT(_etree.parse( - 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) --- -2.40.1 - diff --git a/Skip-failing-test-test_html_prefix_nsmap.patch b/Skip-failing-test-test_html_prefix_nsmap.patch deleted file mode 100644 index 7d936e3cd1fa8814bb9f07e77f89b953d334b6f4..0000000000000000000000000000000000000000 --- a/Skip-failing-test-test_html_prefix_nsmap.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 91729cf581f764c3321f644206568f18d0fc92f4 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= -Date: Thu, 18 May 2023 08:00:48 +0200 -Subject: [PATCH] Skip failing test test_html_prefix_nsmap - -Upstream issue: https://bugs.launchpad.net/lxml/+bug/2016939 ---- - src/lxml/tests/test_etree.py | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/src/lxml/tests/test_etree.py b/src/lxml/tests/test_etree.py -index 0339796..1994a7f 100644 ---- a/src/lxml/tests/test_etree.py -+++ b/src/lxml/tests/test_etree.py -@@ -27,6 +27,8 @@ from .common_imports import SillyFileLike, LargeFileLikeUnicode, doctest, make_d - from .common_imports import canonicalize, _str, _bytes - from .common_imports import SimpleFSPath - -+from unittest import skip -+ - print(""" - TESTED VERSION: %s""" % etree.__version__ + """ - Python: %r""" % (sys.version_info,) + """ -@@ -3067,6 +3069,7 @@ class ETreeOnlyTestCase(HelperTestCase): - self.assertEqual(re, e.nsmap) - self.assertEqual(r, s.nsmap) - -+ @skip - def test_html_prefix_nsmap(self): - etree = self.etree - el = etree.HTML('aa').find('.//page-description') --- -2.40.1 - diff --git a/c6b7e621e4.patch b/c6b7e621e4.patch deleted file mode 100644 index fbdb61dabf9d6b9422b5ff004de51a1af919876a..0000000000000000000000000000000000000000 --- a/c6b7e621e4.patch +++ /dev/null @@ -1,24 +0,0 @@ -From c6b7e621e4696c02bf8f6ea423ffbbf2109748ab Mon Sep 17 00:00:00 2001 -From: Stefan Behnel -Date: Thu, 11 May 2023 10:30:15 +0200 -Subject: [PATCH] Avoid using the deprecated "imp" module. - -Closes https://bugs.launchpad.net/lxml/+bug/2018137 ---- - src/lxml/html/tests/test_html5parser.py | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/lxml/html/tests/test_html5parser.py b/src/lxml/html/tests/test_html5parser.py -index bcf7f1b12..57878a5e3 100644 ---- a/src/lxml/html/tests/test_html5parser.py -+++ b/src/lxml/html/tests/test_html5parser.py -@@ -44,7 +44,8 @@ def find_module(self, fullname, path=None): - return None - - def load_module(self, fullname): -- fake_module = object() -+ class Cls: pass -+ fake_module = Cls() - fake_module.__qualname__ = fullname - fake_module.__name__ = fullname.rsplit('.', 1)[-1] - mod = sys.modules.setdefault(fullname, fake_module) diff --git a/lxml-4.9.2.tar.gz b/lxml-4.9.2.tar.gz deleted file mode 100644 index b52656b3a62f8613c89bb5f0b5eea0c2f8c5f7d4..0000000000000000000000000000000000000000 Binary files a/lxml-4.9.2.tar.gz and /dev/null differ diff --git a/lxml-5.3.0.tar.gz b/lxml-5.3.0.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..4916a0bd7dca53be2b255b4b43d4319c944ffa2f Binary files /dev/null and b/lxml-5.3.0.tar.gz differ diff --git a/python-lxml.spec b/python-lxml.spec index b9427d080568e0ce515c872f0bccb5d4919b9a25..08ca090a50fb20f5e491d1066c432b6d7b6cd6e4 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -1,8 +1,8 @@ -%define anolis_release 3 +%define anolis_release 1 %global modname lxml Name: python-%{modname} -Version: 4.9.2 +Version: 5.3.0 Release: %{anolis_release}%{?dist} Summary: XML processing library combining libxml2/libxslt with the ElementTree API @@ -13,20 +13,6 @@ Summary: XML processing library combining libxml2/libxslt with the Elemen License: BSD and MIT and zlib URL: https://github.com/lxml/lxml Source0: https://github.com/lxml/lxml/archive/refs/tags/%{modname}-%{version}.tar.gz -# Make the validation of ISO-Schematron files optional in lxml, -# depending on the availability of the RNG validation file -# Rebased from https://github.com/lxml/lxml/commit/4bfab2c821961fb4c5ed8a04e329778c9b09a1df -# Will be included in lxml 5.0 -Patch001: Make-the-validation-of-ISO-Schematron-files-optional.patch -# Skip test_isoschematron.test_schematron_invalid_schema_empty without the RNG file -Patch002: https://github.com/lxml/lxml/pull/380.patch - -# Upstream issue: https://bugs.launchpad.net/lxml/+bug/2016939 -Patch003: Skip-failing-test-test_html_prefix_nsmap.patch - -# Avoid using the deprecated "imp" module (removed in Python 3.12) -Patch004: https://github.com/lxml/lxml/commit/07db761f9f.patch -Patch005: https://github.com/lxml/lxml/commit/c6b7e621e4.patch BuildRequires: gcc BuildRequires: libxml2-devel @@ -46,9 +32,6 @@ Summary: %{summary} BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-Cython -Suggests: python3dist(cssselect) >= 0.7 -Suggests: python3dist(html5lib) -Suggests: python3dist(beautifulsoup4) %{?python_provide:%python_provide python3-%{modname}} %description -n python3-%{modname} %{_description} @@ -68,32 +51,47 @@ Doc files for python3-%{modname}. # Remove pregenerated Cython C sources find -type f -name '*.c' -print -delete -%generate_buildrequires -%pyproject_buildrequires - %build -%pyproject_wheel +%py3_build %install -%pyproject_install -%pyproject_save_files %{modname} +%py3_install +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . %check -# The tests assume inplace build, so we copy the built library to source-dir. -# If not done that, Python can either import the tests or the extension modules, but not both. -cp -a build/lib.%{python3_platform}-*/* src/ -# The options are: verbose, unit, functional -%{python3} test.py -vuf +make test %files -n python3-%{modname} %license LICENSES.txt doc/licenses/BSD.txt doc/licenses/elementtree.txt %{python3_sitearch}/%{modname}/ -%{python3_sitearch}/%{modname}-%{version}.dist-info/ +%{python3_sitearch}/%{modname}-%{version}-py3.11.egg-info/ %files -n python3-%{modname}-doc %doc README.rst src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt %changelog +* Thu Apr 17 2025 mgb01105731 - 5.3.0-1 +- Update to 5.3.0 to fix build err with Cython 3 + * Wed Mar 13 2024 Zhao Hang - 4.9.2-3 - Rebuild with python3.11