From 772af585a37680bb519b4574f19914c0b73fb8b4 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 9 May 2023 05:26:39 +0000 Subject: [PATCH] import python3.11-lxml-4.9.2-3.el9 --- .gitignore | 1 + .python3.11-lxml.metadata | 1 + SOURCES/get-lxml-source.sh | 29 +++++++++++ SPECS/python3.11-lxml.spec | 102 +++++++++++++++++++++++++++++++++++++ 4 files changed, 133 insertions(+) create mode 100644 .gitignore create mode 100644 .python3.11-lxml.metadata create mode 100755 SOURCES/get-lxml-source.sh create mode 100644 SPECS/python3.11-lxml.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3038ca3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/lxml-4.9.2-no-isoschematron.tar.gz diff --git a/.python3.11-lxml.metadata b/.python3.11-lxml.metadata new file mode 100644 index 0000000..ce60b7c --- /dev/null +++ b/.python3.11-lxml.metadata @@ -0,0 +1 @@ +143ff39a17bc468563e752bab91d1f15a6f59668 SOURCES/lxml-4.9.2-no-isoschematron.tar.gz diff --git a/SOURCES/get-lxml-source.sh b/SOURCES/get-lxml-source.sh new file mode 100755 index 0000000..9d79f3a --- /dev/null +++ b/SOURCES/get-lxml-source.sh @@ -0,0 +1,29 @@ +#! /bin/bash -ex + +# Download a release of lxml (if missing) and remove the isoschematron module from it + +version=$1 + +if [ -z "${version}" ]; then + echo "Usage: $0 VERSION" >& 2 + echo "" >& 2 + echo "example: $0 4.9.2" >& 2 + exit 1 +fi + +versionedname=lxml-${version} +orig_archive=${versionedname}.tar.gz +new_archive=${versionedname}-no-isoschematron.tar.gz + +if [ ! -e ${orig_archive} ]; then + wget -N https://files.pythonhosted.org/packages/source/l/lxml/${orig_archive} +fi + +deleted_module=lxml-${version}/src/lxml/isoschematron/ +deleted_test=lxml-${version}/src/lxml/tests/test_isoschematron.py + +# tar --delete does not operate on compressed archives, so do +# gz decompression explicitly +gzip --decompress ${orig_archive} +tar -v --delete -f ${orig_archive//.gz} {$deleted_module,$deleted_test} +gzip -cf ${orig_archive//.gz} > ${new_archive} diff --git a/SPECS/python3.11-lxml.spec b/SPECS/python3.11-lxml.spec new file mode 100644 index 0000000..e3d2ccc --- /dev/null +++ b/SPECS/python3.11-lxml.spec @@ -0,0 +1,102 @@ +%global __python3 /usr/bin/python3.11 +%global python3_pkgversion 3.11 + +Name: python%{python3_pkgversion}-lxml +Version: 4.9.2 +Release: 3%{?dist} +Summary: XML processing library combining libxml2/libxslt with the ElementTree API + +# The lxml project is licensed under BSD-3-Clause +# Some code is derived from ElementTree and cElementTree +# thus using the MIT-CMU elementtree license +# .xsl schematron files are under the MIT license +License: BSD and MIT +URL: https://github.com/lxml/lxml +# We use the get-lxml-source.sh script to generate the tarball +# without the isoschematron submodule as it contains a problematic +# license. +# See: https://gitlab.com/fedora/legal/fedora-license-data/-/issues/154 +Source0: lxml-%{version}-no-isoschematron.tar.gz +Source1: get-lxml-source.sh + +BuildRequires: gcc +BuildRequires: libxml2-devel +BuildRequires: libxslt-devel + +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-rpm-macros +BuildRequires: python%{python3_pkgversion}-setuptools +BuildRequires: python%{python3_pkgversion}-Cython + +%global _description \ +lxml is a Pythonic, mature binding for the libxml2 and libxslt libraries. It\ +provides safe and convenient access to these libraries using the ElementTree It\ +extends the ElementTree API significantly to offer support for XPath, RelaxNG,\ +XML Schema, XSLT, C14N and much more. + +%description %{_description} + +%prep +%autosetup -n lxml-%{version} -p1 + +# Remove isoschematron module due to problematic license +sed -i "s/, 'lxml.isoschematron'//" setup.py +# Remove the doctests for it (the documentation is not shipped) +# The command [d]eletes all lines from the first pattern to the second +sed -Ei '/^Schematron$/,/^\(Pre-ISO-Schematron\)$/d' doc/validation.txt + +# Remove pregenerated Cython C sources +# We need to do this after %%pyproject_buildrequires because setup.py errors +# without Cython and without the .c files. +find -type f -name '*.c' -print -delete >&2 + +%build +env WITH_CYTHON=true %py3_build + +%install +%py3_install + +%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 + +%files -n python%{python3_pkgversion}-lxml +%license doc/licenses/BSD.txt doc/licenses/elementtree.txt +%doc README.rst +%{python3_sitearch}/lxml/ +%{python3_sitearch}/lxml-*.egg-info/ + +%changelog +* Thu Feb 16 2023 Charalampos Stratakis - 4.9.2-3 +- Remove the isoschematron submodule + +* Fri Feb 10 2023 Charalampos Stratakis - 4.9.2-2 +- Remove the extras subpackages + +* Mon Nov 14 2022 Charalampos Stratakis - 4.9.2-1 +- Initial package +- Fedora contributions by: + Alexander Todorov + Bill Nottingham + Charalampos Stratakis + Dan Horák + David Malcolm + Dennis Gilmore + Fabio Alessandro Locati + Igor Raits + Jason ティビツ + Jeffrey C. Ollie + Jesse Keating + Kevin Fenzi + Lumir Balhar + Mikolaj Izdebski + Miro Hrončok + Peter Robinson + Robert Kuska + Shahms King + Slavek Kabrda + tomspur + Ville Skyttä