python3.14-lxml/SPECS/python3.14-lxml.spec
2026-04-16 04:56:54 -04:00

137 lines
4.9 KiB
RPMSpec

## START: Set by rpmautospec
## (rpmautospec version 0.6.5)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
release_number = 5;
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec
%global python3_pkgversion 3.14
Name: python%{python3_pkgversion}-lxml
Version: 6.0.2
Release: %autorelease
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-3-Clause AND MIT-CMU AND MIT
URL: https://github.com/lxml/lxml
# We use the get-lxml-source.sh script to generate the tarball
# without the isoschematron RNG validation file under a problematic license.
# See: https://gitlab.com/fedora/legal/fedora-license-data/-/issues/154
Source0: lxml-%{version}-no-isoschematron-rng.tar.gz
Source1: get-lxml-source.sh
# Fix two memory leaks
# Resolved upstream:
# https://github.com/lxml/lxml/commit/459d51e316c319c8f49b3b7d08fb80cbc8585f49
# https://github.com/lxml/lxml/commit/39cdf11f5d2cf6e4f810202b6e415afd350d3df2
Patch: fix-memory-leaks.patch
# Free xmlDoc when initDocDict() fails in _newXMLDoc/_newHTMLDoc.
# Downstream only
# Fixed upstream in 0b512418 by removing these initDocDict() calls entirely
# but this is backwards incompatible.
Patch: fix-initDocDict-memory-leak.patch
BuildRequires: gcc
BuildRequires: libxml2-devel
BuildRequires: libxslt-devel
BuildRequires: python%{python3_pkgversion}-devel
# Some of the extras create a build dependency loop.
# - [cssselect] Requires cssselect BuildRequires lxml
# - [html5] Requires html5lib BuildRequires lxml
# - [htmlsoup] Requires beautifulsoup4 Requires lxml
# - [html_clean] Requires lxml-html-clean Requires lxml
# Hence we provide a bcond to disable the extras altogether.
# By default, the extras are disabled in RHEL, to avoid dependencies.
%bcond extras %{undefined rhel}
%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.
%if %{with extras}
Suggests: python%{python3_pkgversion}-lxml+cssselect
Suggests: python%{python3_pkgversion}-lxml+html5
Suggests: python%{python3_pkgversion}-lxml+htmlsoup
Suggests: python%{python3_pkgversion}-lxml+html_clean
%endif
%description %{_description}
%if %{with extras}
%pyproject_extras_subpkg -n python%{python3_pkgversion}-lxml cssselect html5 htmlsoup html_clean
%endif
%prep
%autosetup -n lxml-%{version} -p1
# Don't run html5lib tests --without extras
%{!?without_extras:rm src/lxml/html/tests/test_html5parser.py}
# Remove limit for version of Cython
sed -i "s/Cython.*/Cython/" requirements.txt
sed -i 's/"Cython.*",/"Cython",/' pyproject.toml
%generate_buildrequires
%pyproject_buildrequires -x source%{?with_extras:,cssselect,html5,htmlsoup,html_clean}
%build
# 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
export WITH_CYTHON=true
%pyproject_wheel
%install
%pyproject_install
%pyproject_save_files lxml
%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 -f %{pyproject_files}
%license doc/licenses/BSD.txt doc/licenses/elementtree.txt
%doc README.rst
%changelog
## START: Generated by rpmautospec
* Fri Feb 20 2026 Charalampos Stratakis <cstratak@redhat.com> - 6.0.2-5
- Fix memory leak when initDocDict() fails
* Mon Feb 16 2026 Charalampos Stratakis <cstratak@redhat.com> - 6.0.2-4
- Fix another memory leak
* Thu Jan 22 2026 Charalampos Stratakis <cstratak@redhat.com> - 6.0.2-3
- Fix a memory leak
* Wed Nov 19 2025 Lumir Balhar <lbalhar@redhat.com> - 6.0.2-2
- Update of sources file while reuploading to centos lookaside cache
* Wed Nov 19 2025 Tomáš Hrnčiar <thrnciar@redhat.com> - 6.0.2-1
- Update to 6.0.2 - taken from Fedora 11da0f3
* Wed Nov 19 2025 Lukáš Zachar <lzachar@redhat.com> - 6.0.1-3
- Change gating
* Wed Nov 19 2025 Tomáš Hrnčiar <thrnciar@redhat.com> - 6.0.1-2
- Convert from Fedora for the Python 3.14 stack in RHEL
* Wed Nov 19 2025 Tomáš Hrnčiar <thrnciar@redhat.com> - 6.0.1-1
- RHEL: Rename SPEC to python3.14-lxml.spec
## END: Generated by rpmautospec