%global python3_pkgversion 3.11 %global pypi_name defusedxml %global base_version 0.7.1 #global prerel ... %global upstream_version %{base_version}%{?prerel} Name: python-%{pypi_name} Version: %{base_version}%{?prerel:~%{prerel}} Release: 2.ac14.py3.11%{?dist} Summary: XML bomb protection for Python stdlib modules License: Python URL: https://github.com/tiran/defusedxml Source0: %{pypi_source %{pypi_name} %{upstream_version}} # Drop deprecated unittest.makeSuite() # From https://github.com/tiran/defusedxml/commit/4e6cea5f5b # (This no longer skips lxml tests when lxml is not installed.) Patch: drop-makeSuite.patch BuildArch: noarch BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: python%{python3_pkgversion}-lxml %description The defusedxml package contains several Python-only workarounds and fixes for denial of service and other vulnerabilities in Python's XML libraries. In order to benefit from the protection you just have to import and use the listed functions / classes from the right defusedxml module instead of the original module. %package -n python%{python3_pkgversion}-%{pypi_name} Summary: %{summary} %{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}} %description -n python%{python3_pkgversion}-%{pypi_name} The defusedxml package contains several Python-only workarounds and fixes for denial of service and other vulnerabilities in Python's XML libraries. In order to benefit from the protection you just have to import and use the listed functions / classes from the right defusedxml module instead of the original module. This is the python%{python3_pkgversion} build. %prep %autosetup -p1 -n %{pypi_name}-%{upstream_version} %build %py3_build %install %py3_install %check %{python3} tests.py for b in $(find %{buildroot}%{_bindir}/ -type f) ; do mv "$b" $(sed -re "s|(.*)$|\1-%{python3_pkgversion}|"<<<"$b"); done for m in $(find %{buildroot}%{_mandir}/ -type f) ; do mv "$m" $(sed -re "s|(.*).([1-8])(.*)$|\1-%{python3_pkgversion}.\2\3|"<<<"$m"); done for m in $(find %{buildroot}%{_datadir}/locale/* -type f) ; do mv "$m" $(sed -re "s|(.*).mo$|\1-%{python3_pkgversion}.mo|"<<<"$m"); done for l in $(find %{buildroot}/usr/lib64/lib* -type f -o -type l) ; do mv "$l" $(sed -re "s|(.*).so(.*)$|\1-py%{python3_pkgversion}.so\2|"<<<"$l"); done for p in $(find %{buildroot}/usr/lib64/pkgconfig/* -type f) ; do mv "$p" $(sed -re "s|(.*).pc$|\1-py%{python3_pkgversion}.pc|"<<<"$p"); done %files -n python%{python3_pkgversion}-%{pypi_name} %doc README.txt README.html CHANGES.txt %license LICENSE %{python3_sitelib}/%{pypi_name}/ %{python3_sitelib}/%{pypi_name}-%{upstream_version}-py%{python3_version}.egg-info/ %changelog * Wed Apr 24 2024 Ding-Yi Chen - %{base_version}%{?prerel:~%{prerel}}-2.ac14.py3.11 - Cut corner packaging