Sync from SUSE:ALP:Source:Standard:1.0 saltbundlepy-lxml revision ec86ce4b25d62e10284836253080d31c

This commit is contained in:
Adrian Schröter 2024-07-15 12:53:59 +02:00
commit 2b248cb2aa
13 changed files with 2752 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

View File

@ -0,0 +1,110 @@
From 4bfab2c821961fb4c5ed8a04e329778c9b09a1df Mon Sep 17 00:00:00 2001
From: Stefan Behnel <stefan_ml@behnel.de>
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)

View File

@ -0,0 +1,29 @@
---
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('<a>'+'<b/>'*200+'</a>'))
- 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('<a>'+'<b/>'*200+'</a>'),
data)

View File

@ -0,0 +1,15 @@
--- a/src/lxml/tests/test_unicode.py
+++ b/src/lxml/tests/test_unicode.py
@@ -167,7 +167,11 @@
def test_illegal_utf8_recover(self):
data = _bytes('<test>\x80\x80\x80</test>', encoding='iso8859-1')
parser = etree.XMLParser(recover=True)
- self.assertRaises(etree.XMLSyntaxError, etree.fromstring, data, parser)
+ if etree.LIBXML_VERSION >= (2, 12, 0):
+ tree = etree.fromstring(data, parser)
+ self.assertEqual('\ufffd\ufffd\ufffd', tree.text)
+ else:
+ self.assertRaises(etree.XMLSyntaxError, etree.fromstring, data, parser)
def _test_encoding(self, encoding, xml_encoding_name=None):
foo = """<?xml version='1.0' encoding='%s'?>\n<tag attrib='123'></tag>""" % (

BIN
lxml-4.9.3.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,731 @@
---
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 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright © ISO/IEC 2015 -->
-<!--
- The following permission notice and disclaimer shall be included in all
- copies of this XML schema ("the Schema"), and derivations of the Schema:
-
- Permission is hereby granted, free of charge in perpetuity, to any
- person obtaining a copy of the Schema, to use, copy, modify, merge and
- distribute free of charge, copies of the Schema for the purposes of
- developing, implementing, installing and using software based on the
- Schema, and to permit persons to whom the Schema is furnished to do so,
- subject to the following conditions:
-
- THE SCHEMA IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SCHEMA OR THE USE OR
- OTHER DEALINGS IN THE SCHEMA.
-
- In addition, any modified copy of the Schema shall include the following
- notice:
-
- "THIS SCHEMA HAS BEEN MODIFIED FROM THE SCHEMA DEFINED IN ISO/IEC 19757-3,
- AND SHOULD NOT BE INTERPRETED AS COMPLYING WITH THAT STANDARD".
--->
-<grammar ns="http://purl.oclc.org/dsdl/schematron" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
- <start>
- <ref name="schema"/>
- </start>
- <!-- Element declarations -->
- <define name="schema">
- <element name="schema">
- <optional>
- <attribute name="id">
- <data type="ID"/>
- </attribute>
- </optional>
- <ref name="rich"/>
- <optional>
- <attribute name="schemaVersion">
- <ref name="non-empty-string"/>
- </attribute>
- </optional>
- <optional>
- <attribute name="defaultPhase">
- <data type="IDREF"/>
- </attribute>
- </optional>
- <optional>
- <attribute name="queryBinding">
- <ref name="non-empty-string"/>
- </attribute>
- </optional>
- <interleave>
- <ref name="foreign"/>
- <zeroOrMore>
- <ref name="inclusion"/>
- </zeroOrMore>
- <group>
- <optional>
- <ref name="title"/>
- </optional>
- <zeroOrMore>
- <ref name="ns"/>
- </zeroOrMore>
- <zeroOrMore>
- <ref name="p"/>
- </zeroOrMore>
- <zeroOrMore>
- <ref name="let"/>
- </zeroOrMore>
- <zeroOrMore>
- <ref name="phase"/>
- </zeroOrMore>
- <oneOrMore>
- <ref name="pattern"/>
- </oneOrMore>
- <zeroOrMore>
- <ref name="p"/>
- </zeroOrMore>
- <optional>
- <ref name="diagnostics"/>
- </optional>
- <optional>
- <!-- edited (lxml): required in standard, optional here (since it can be empty anyway) -->
- <ref name="properties"/>
- </optional>
- </group>
- </interleave>
- </element>
- </define>
- <define name="active">
- <element name="active">
- <attribute name="pattern">
- <data type="IDREF"/>
- </attribute>
- <interleave>
- <ref name="foreign"/>
- <zeroOrMore>
- <choice>
- <text/>
- <ref name="dir"/>
- <ref name="emph"/>
- <ref name="span"/>
- </choice>
- </zeroOrMore>
- </interleave>
- </element>
- </define>
- <define name="assert">
- <element name="assert">
- <attribute name="test">
- <ref name="exprValue"/>
- </attribute>
- <optional>
- <attribute name="flag">
- <ref name="flagValue"/>
- </attribute>
- </optional>
- <optional>
- <attribute name="id">
- <data type="ID"/>
- </attribute>
- </optional>
- <optional>
- <attribute name="diagnostics">
- <data type="IDREFS"/>
- </attribute>
- </optional>
- <optional>
- <attribute name="properties">
- <data type="IDREFS"/>
- </attribute>
- </optional>
- <ref name="rich"/>
- <ref name="linkable"/>
- <interleave>
- <ref name="foreign"/>
- <zeroOrMore>
- <choice>
- <text/>
- <ref name="name"/>
- <ref name="value-of"/>
- <ref name="emph"/>
- <ref name="dir"/>
- <ref name="span"/>
- </choice>
- </zeroOrMore>
- </interleave>
- </element>
- </define>
- <define name="diagnostic">
- <element name="diagnostic">
- <attribute name="id">
- <data type="ID"/>
- </attribute>
- <ref name="rich"/>
- <interleave>
- <ref name="foreign"/>
- <zeroOrMore>
- <choice>
- <text/>
- <ref name="value-of"/>
- <ref name="emph"/>
- <ref name="dir"/>
- <ref name="span"/>
- </choice>
- </zeroOrMore>
- </interleave>
- </element>
- </define>
- <define name="diagnostics">
- <element name="diagnostics">
- <interleave>
- <ref name="foreign"/>
- <zeroOrMore>
- <ref name="inclusion"/>
- </zeroOrMore>
- <zeroOrMore>
- <ref name="diagnostic"/>
- </zeroOrMore>
- </interleave>
- </element>
- </define>
- <define name="dir">
- <element name="dir">
- <optional>
- <attribute name="value">
- <choice>
- <value>ltr</value>
- <value>rtl</value>
- </choice>
- </attribute>
- </optional>
- <interleave>
- <ref name="foreign"/>
- <text/>
- </interleave>
- </element>
- </define>
- <define name="emph">
- <element name="emph">
- <text/>
- </element>
- </define>
- <define name="extends">
- <element name="extends">
- <choice>
- <attribute name="rule">
- <data type="IDREF"/>
- </attribute>
- <attribute name="href">
- <ref name="uriValue"/>
- </attribute>
- </choice>
- <ref name="foreign-empty"/>
- </element>
- </define>
- <define name="let">
- <element name="let">
- <attribute name="name">
- <ref name="nameValue"/>
- </attribute>
- <choice>
- <attribute name="value">
- <data type="string" datatypeLibrary=""/>
- </attribute>
- <oneOrMore>
- <ref name="foreign-element"/>
- </oneOrMore>
- </choice>
- </element>
- </define>
- <define name="name">
- <element name="name">
- <optional>
- <attribute name="path">
- <ref name="pathValue"/>
- </attribute>
- </optional>
- <ref name="foreign-empty"/>
- </element>
- </define>
- <define name="ns">
- <element name="ns">
- <attribute name="uri">
- <ref name="uriValue"/>
- </attribute>
- <attribute name="prefix">
- <ref name="nameValue"/>
- </attribute>
- <ref name="foreign-empty"/>
- </element>
- </define>
- <define name="p">
- <element name="p">
- <optional>
- <attribute name="id">
- <data type="ID"/>
- </attribute>
- </optional>
- <optional>
- <attribute name="class">
- <ref name="classValue"/>
- </attribute>
- </optional>
- <optional>
- <attribute name="icon">
- <ref name="uriValue"/>
- </attribute>
- </optional>
- <interleave>
- <ref name="foreign"/>
- <zeroOrMore>
- <choice>
- <text/>
- <ref name="dir"/>
- <ref name="emph"/>
- <ref name="span"/>
- </choice>
- </zeroOrMore>
- </interleave>
- </element>
- </define>
- <define name="param">
- <element name="param">
- <attribute name="name">
- <ref name="nameValue"/>
- </attribute>
- <attribute name="value">
- <ref name="non-empty-string"/>
- </attribute>
- </element>
- </define>
- <define name="pattern">
- <element name="pattern">
- <optional>
- <attribute name="documents">
- <ref name="pathValue"/>
- </attribute>
- </optional>
- <ref name="rich"/>
- <interleave>
- <ref name="foreign"/>
- <zeroOrMore>
- <ref name="inclusion"/>
- </zeroOrMore>
- <choice>
- <group>
- <attribute name="abstract">
- <value>true</value>
- </attribute>
- <attribute name="id">
- <data type="ID"/>
- </attribute>
- <optional>
- <ref name="title"/>
- </optional>
- <group>
- <zeroOrMore>
- <ref name="p"/>
- </zeroOrMore>
- <zeroOrMore>
- <ref name="let"/>
- </zeroOrMore>
- <zeroOrMore>
- <ref name="rule"/>
- </zeroOrMore>
- </group>
- </group>
- <group>
- <optional>
- <attribute name="abstract">
- <value>false</value>
- </attribute>
- </optional>
- <optional>
- <attribute name="id">
- <data type="ID"/>
- </attribute>
- </optional>
- <optional>
- <ref name="title"/>
- </optional>
- <group>
- <zeroOrMore>
- <ref name="p"/>
- </zeroOrMore>
- <zeroOrMore>
- <ref name="let"/>
- </zeroOrMore>
- <zeroOrMore>
- <ref name="rule"/>
- </zeroOrMore>
- </group>
- </group>
- <group>
- <optional>
- <attribute name="abstract">
- <value>false</value>
- </attribute>
- </optional>
- <attribute name="is-a">
- <data type="IDREF"/>
- </attribute>
- <optional>
- <attribute name="id">
- <data type="ID"/>
- </attribute>
- </optional>
- <optional>
- <ref name="title"/>
- </optional>
- <group>
- <zeroOrMore>
- <ref name="p"/>
- </zeroOrMore>
- <zeroOrMore>
- <ref name="param"/>
- </zeroOrMore>
- </group>
- </group>
- </choice>
- </interleave>
- </element>
- </define>
- <define name="phase">
- <element name="phase">
- <attribute name="id">
- <data type="ID"/>
- </attribute>
- <ref name="rich"/>
- <interleave>
- <ref name="foreign"/>
- <zeroOrMore>
- <ref name="inclusion"/>
- </zeroOrMore>
- <group>
- <zeroOrMore>
- <ref name="p"/>
- </zeroOrMore>
- <zeroOrMore>
- <ref name="let"/>
- </zeroOrMore>
- <zeroOrMore>
- <ref name="active"/>
- </zeroOrMore>
- </group>
- </interleave>
- </element>
- </define>
- <define name="properties">
- <element name="properties">
- <zeroOrMore>
- <ref name="property"/>
- </zeroOrMore>
- </element>
- </define>
- <define name="property">
- <element name="property">
- <attribute name="id">
- <data type="ID"/>
- </attribute>
- <optional>
- <attribute name="role">
- <ref name="roleValue"/>
- </attribute>
- </optional>
- <optional>
- <attribute name="scheme"/>
- </optional>
- <interleave>
- <ref name="foreign"/>
- <zeroOrMore>
- <choice>
- <text/>
- <ref name="name"/>
- <ref name="value-of"/>
- <ref name="emph"/>
- <ref name="dir"/>
- <ref name="span"/>
- </choice>
- </zeroOrMore>
- </interleave>
- </element>
- </define>
- <define name="report">
- <element name="report">
- <attribute name="test">
- <ref name="exprValue"/>
- </attribute>
- <optional>
- <attribute name="flag">
- <ref name="flagValue"/>
- </attribute>
- </optional>
- <optional>
- <attribute name="id">
- <data type="ID"/>
- </attribute>
- </optional>
- <optional>
- <attribute name="diagnostics">
- <data type="IDREFS"/>
- </attribute>
- </optional>
- <optional>
- <attribute name="properties">
- <data type="IDREFS"/>
- </attribute>
- </optional>
- <ref name="rich"/>
- <ref name="linkable"/>
- <interleave>
- <ref name="foreign"/>
- <zeroOrMore>
- <choice>
- <text/>
- <ref name="name"/>
- <ref name="value-of"/>
- <ref name="emph"/>
- <ref name="dir"/>
- <ref name="span"/>
- </choice>
- </zeroOrMore>
- </interleave>
- </element>
- </define>
- <define name="rule">
- <element name="rule">
- <optional>
- <attribute name="flag">
- <ref name="flagValue"/>
- </attribute>
- </optional>
- <ref name="rich"/>
- <ref name="linkable"/>
- <interleave>
- <ref name="foreign"/>
- <zeroOrMore>
- <ref name="inclusion"/>
- </zeroOrMore>
- <choice>
- <group>
- <attribute name="abstract">
- <value>true</value>
- </attribute>
- <attribute name="id">
- <data type="ID"/>
- </attribute>
- <zeroOrMore>
- <ref name="let"/>
- </zeroOrMore>
- <oneOrMore>
- <choice>
- <ref name="assert"/>
- <ref name="report"/>
- <ref name="extends"/>
- <ref name="p"/>
- </choice>
- </oneOrMore>
- </group>
- <group>
- <attribute name="context">
- <ref name="pathValue"/>
- </attribute>
- <optional>
- <attribute name="id">
- <data type="ID"/>
- </attribute>
- </optional>
- <optional>
- <attribute name="abstract">
- <value>false</value>
- </attribute>
- </optional>
- <zeroOrMore>
- <ref name="let"/>
- </zeroOrMore>
- <oneOrMore>
- <choice>
- <ref name="assert"/>
- <ref name="report"/>
- <ref name="extends"/>
- <ref name="p"/>
- </choice>
- </oneOrMore>
- </group>
- </choice>
- </interleave>
- </element>
- </define>
- <define name="span">
- <element name="span">
- <attribute name="class">
- <ref name="classValue"/>
- </attribute>
- <interleave>
- <ref name="foreign"/>
- <text/>
- </interleave>
- </element>
- </define>
- <define name="title">
- <element name="title">
- <zeroOrMore>
- <choice>
- <text/>
- <ref name="dir"/>
- </choice>
- </zeroOrMore>
- </element>
- </define>
- <define name="value-of">
- <element name="value-of">
- <attribute name="select">
- <ref name="pathValue"/>
- </attribute>
- <ref name="foreign-empty"/>
- </element>
- </define>
- <!-- common declarations -->
- <define name="inclusion">
- <element name="include">
- <attribute name="href">
- <ref name="uriValue"/>
- </attribute>
- <ref name="foreign-empty"/>
- </element>
- </define>
- <define name="rich">
- <optional>
- <attribute name="icon">
- <ref name="uriValue"/>
- </attribute>
- </optional>
- <optional>
- <attribute name="see">
- <ref name="uriValue"/>
- </attribute>
- </optional>
- <optional>
- <attribute name="fpi">
- <ref name="fpiValue"/>
- </attribute>
- </optional>
- <optional>
- <attribute name="xml:lang">
- <ref name="langValue"/>
- </attribute>
- </optional>
- <optional>
- <attribute name="xml:space">
- <choice>
- <value>preserve</value>
- <value>default</value>
- </choice>
- </attribute>
- </optional>
- </define>
- <define name="linkable">
- <optional>
- <attribute name="role">
- <ref name="roleValue"/>
- </attribute>
- </optional>
- <optional>
- <attribute name="subject">
- <ref name="pathValue"/>
- </attribute>
- </optional>
- </define>
- <define name="foreign">
- <ref name="foreign-attributes"/>
- <zeroOrMore>
- <ref name="foreign-element"/>
- </zeroOrMore>
- </define>
- <define name="foreign-empty">
- <ref name="foreign-attributes"/>
- </define>
- <define name="foreign-attributes">
- <zeroOrMore>
- <attribute>
- <anyName>
- <except>
- <nsName ns=""/>
- <nsName ns="http://www.w3.org/XML/1998/namespace"/>
- </except>
- </anyName>
- </attribute>
- </zeroOrMore>
- </define>
- <define name="foreign-element">
- <element>
- <anyName>
- <except>
- <nsName/>
- </except>
- </anyName>
- <zeroOrMore>
- <choice>
- <attribute>
- <anyName/>
- </attribute>
- <ref name="foreign-element"/>
- <ref name="schema"/>
- <text/>
- </choice>
- </zeroOrMore>
- </element>
- </define>
- <!-- Data types -->
- <define name="uriValue">
- <data type="anyURI"/>
- </define>
- <define name="pathValue">
- <data type="string" datatypeLibrary=""/>
- </define>
- <define name="exprValue">
- <data type="string" datatypeLibrary=""/>
- </define>
- <define name="fpiValue">
- <data type="string" datatypeLibrary=""/>
- </define>
- <define name="langValue">
- <data type="language"/>
- </define>
- <define name="roleValue">
- <data type="string" datatypeLibrary=""/>
- </define>
- <define name="flagValue">
- <data type="string" datatypeLibrary=""/>
- </define>
- <define name="nameValue">
- <data type="string" datatypeLibrary=""/>
- </define>
- <!-- In the default query language binding, xsd:NCNAME -->
- <define name="classValue">
- <data type="string" datatypeLibrary=""/>
- </define>
- <define name="non-empty-string">
- <data type="token">
- <param name="minLength">1</param>
- </data>
- </define>
-</grammar>
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('''\
<schema xmlns="http://purl.oclc.org/dsdl/schematron" />

View File

@ -0,0 +1,3 @@
addFilter('python-bytecode-inconsistent-mtime')
addFilter("zero-length")
addFilter('no-dependency-on')

1614
saltbundlepy-lxml.changes Normal file

File diff suppressed because it is too large Load Diff

145
saltbundlepy-lxml.spec Normal file
View File

@ -0,0 +1,145 @@
#
# spec file for package saltbundlepy-lxml
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?!saltbundlepy_module:%define saltbundlepy_module() saltbundlepy-%{**}}
%define pythons saltbundlepy
# Disable python bytecompile for all distros
# It's called explicitly in the spec
%global __brp_python_bytecompile %{nil}
Name: saltbundlepy-lxml
Version: 4.9.3
Release: 0
Summary: Pythonic XML processing library
License: BSD-3-Clause AND GPL-2.0-or-later
Group: Development/Languages/Python
URL: https://lxml.de/
Source0: https://files.pythonhosted.org/packages/source/l/lxml/lxml-%{version}.tar.gz
# 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
# Skip failing tests in s390x due zlib HW accelarator: https://github.com/python/cpython/pull/31096
Patch5: skip_failing_test_s390x.patch
# PATCH-FIX-OPENSUSE Skip a test under libexpat 2.6.0+
# Same test gh#python/cpython#115133
Patch6: skip-test-under-libexpat-2.6.0.patch
Patch7: fix-test_illegal_utf8_recover.patch
BuildRequires: %{saltbundlepy_module cssselect >= 0.9.1}
BuildRequires: %{saltbundlepy_module cython >= 0.29.7}
BuildRequires: %{saltbundlepy_module devel >= 3.10}
BuildRequires: %{saltbundlepy_module setuptools >= 18.0.1}
BuildRequires: fdupes
%if "%_vendor" == "debbuild"
BuildRequires: libxml2-dev >= 2.7.0
BuildRequires: libxslt1-dev >= 1.1.23
BuildRequires: zlib1g-dev
%else
BuildRequires: libxml2-devel >= 2.7.0
BuildRequires: libxslt-devel >= 1.1.23
BuildRequires: pkgconfig(zlib)
%endif
BuildRequires: saltbundlepy-rpm-macros
Requires: saltbundlepy-cssselect >= 0.9.1
%python_subpackages
%description
lxml is a Pythonic binding for the libxml2 and libxslt libraries. It
provides convenient access to these libraries using the ElementTree
API. It extends the ElementTree API significantly to offer support for XPath,
RelaxNG, XML Schema, XSLT and C14N.
%package -n %{name}-doc
Summary: Documentation for python-lxml, an XML processing library
Group: Documentation/Other
BuildArch: noarch
%description -n %{name}-doc
lxml is a Pythonic binding for the libxml2 and libxslt libraries. It
provides convenient access to these libraries using the ElementTree
API. It extends the ElementTree API significantly to offer support for XPath,
RelaxNG, XML Schema, XSLT and C14N.
This package contains documentation for lxml (HTML and PDF).
%package devel
Summary: Development files for python-lxml
Group: Development/Libraries/Python
Requires: %{name} = %{version}
%description devel
lxml is a Pythonic binding for the libxml2 and libxslt libraries. It
provides convenient access to these libraries using the ElementTree
API. It extends the ElementTree API significantly to offer support for XPath,
RelaxNG, XML Schema, XSLT and C14N.
This package contains header files needed to use lxml's C API.
%prep
%autosetup -p1 -n lxml-%{version}
# remove generated files
find -name '*.c' -delete -print
rm src/lxml/lxml.etree.h
rm src/lxml/lxml.etree_api.h
%build
export CFLAGS="%{optflags}"
%python_build --with-cython
%check
# The tests fail on SLE 11 due to broken incremental parsing in libxml2
export CFLAGS="%{optflags}"
export LANG=en_US.UTF-8
export PYTHONUNBUFFERED=x
PYTHON3=%{__saltbundlepy} make %{?_smp_mflags} test3
%install
%python_install
%fdupes %{buildroot}
%files %{python_files}
%license LICENSES.txt
%doc CHANGES.txt CREDITS.txt README.rst
%{python_sitearch}/lxml/
%{python_sitearch}/lxml-%{version}-py%{python_version}.egg-info
%exclude %{python_sitearch}/lxml/*.h
%exclude %{python_sitearch}/lxml/includes/*.h
%files %{python_files devel}
%license LICENSES.txt
%{python_sitearch}/lxml/*.h
%{python_sitearch}/lxml/includes/*.h
%files -n %{name}-doc
%license LICENSES.txt
%doc doc/html
%changelog

View File

@ -0,0 +1,16 @@
Index: lxml-4.9.3/src/lxml/tests/test_elementtree.py
===================================================================
--- lxml-4.9.3.orig/src/lxml/tests/test_elementtree.py
+++ lxml-4.9.3/src/lxml/tests/test_elementtree.py
@@ -4396,8 +4396,10 @@ class _XMLPullParserTest(unittest.TestCa
self.assertEqual([(action, elem.tag) for action, elem in events],
expected)
+ # Fails with chunk_size in [1, 5], so replacing with 22,
+ # gh#python/cpython#115289
def test_simple_xml(self):
- for chunk_size in (None, 1, 5):
+ for chunk_size in (None, 22):
#with self.subTest(chunk_size=chunk_size):
parser = self.etree.XMLPullParser()
self.assert_event_tags(parser, [])

View File

@ -0,0 +1,12 @@
Index: lxml-4.9.2/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):
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('<hha:page-description>aa</hha:page-description>').find('.//page-description')

View File

@ -0,0 +1,20 @@
Index: lxml-4.9.2/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 (
read_file, write_to_file, BytesIO, tmpfile
)
+import lxml
class _IOTestCaseBase(HelperTestCase):
"""(c)ElementTree compatibility for IO functions/methods
@@ -304,6 +305,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')
uxml = '<?xml version="1.0" encoding="UTF-16"?><p>%s</p>' % utext

View File

@ -0,0 +1,31 @@
Index: lxml-4.9.2/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
@@ -10,7 +10,7 @@ test_elementtree
from __future__ import absolute_import
from collections import OrderedDict
-import os.path
+import os
import unittest
import copy
import sys
@@ -47,6 +47,9 @@ except NameError:
# Python 3
_unicode = str
+skip_on_s390x = unittest.skipIf(hasattr(os, 'uname') and os.uname().machine == 's390x',
+ 'skipped on s390x')
+
class ETreeOnlyTestCase(HelperTestCase):
"""Tests only for etree, not ElementTree"""
@@ -5275,6 +5278,7 @@ class ETreeWriteTestCase(HelperTestCase)
self.assertEqual(_bytes('<a>'+'<b/>'*200+'</a>'),
data)
+ @skip_on_s390x
def test_write_file_gzip_parse(self):
tree = self.parse(_bytes('<a>'+'<b/>'*200+'</a>'))
with tempfile.NamedTemporaryFile() as f: