diff --git a/SOURCES/drop-makeSuite.patch b/SOURCES/drop-makeSuite.patch new file mode 100644 index 0000000..a8793ce --- /dev/null +++ b/SOURCES/drop-makeSuite.patch @@ -0,0 +1,42 @@ +From 4e6cea5f5bb44bf06dd30a723cf13334693c3150 Mon Sep 17 00:00:00 2001 +From: Christian Heimes +Date: Fri, 22 Sep 2023 14:01:50 +0200 +Subject: [PATCH] Improve tests (partial) + +- `makeSuite` is deprecated + +diff --git a/tests.py b/tests.py +index ab52aab..c60335e 100644 +--- a/tests.py ++++ b/tests.py +@@ -542,17 +559,19 @@ def test_defused_gzip_response(self): + + def test_main(): + suite = unittest.TestSuite() +- suite.addTests(unittest.makeSuite(TestDefusedcElementTree)) +- suite.addTests(unittest.makeSuite(TestDefusedElementTree)) +- suite.addTests(unittest.makeSuite(TestDefusedMinidom)) +- suite.addTests(unittest.makeSuite(TestDefusedMinidomWithParser)) +- suite.addTests(unittest.makeSuite(TestDefusedPulldom)) +- suite.addTests(unittest.makeSuite(TestDefusedSax)) +- suite.addTests(unittest.makeSuite(TestXmlRpc)) +- if lxml is not None: +- suite.addTests(unittest.makeSuite(TestDefusedLxml)) +- if gzip is not None: +- suite.addTests(unittest.makeSuite(TestDefusedGzip)) ++ cls = [ ++ TestDefusedElementTree, ++ TestDefusedcElementTree, ++ TestDefusedMinidom, ++ TestDefusedMinidomWithParser, ++ TestDefusedPulldom, ++ TestDefusedSax, ++ TestDefusedLxml, ++ TestXmlRpc, ++ TestDefusedGzip, ++ ] ++ for c in cls: ++ suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(c)) + return suite + + diff --git a/SPECS/python-defusedxml.spec b/SPECS/python-defusedxml.spec index 3dbda44..2aa57a5 100644 --- a/SPECS/python-defusedxml.spec +++ b/SPECS/python-defusedxml.spec @@ -1,63 +1,115 @@ -%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: 3%{?dist} +## START: Set by rpmautospec +## (rpmautospec version 0.7.3) +## RPMAUTOSPEC: autorelease, autochangelog +%define autorelease(e:s:pb:n) %{?-p:0.}%{lua: + release_number = 17; + 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 + +Name: python-defusedxml +Version: 0.7.1 +Release: %autorelease Summary: XML bomb protection for Python stdlib modules -License: Python +License: PSF-2.0 URL: https://github.com/tiran/defusedxml -Source0: %{pypi_source %{pypi_name} %{upstream_version}} +Source: %{pypi_source defusedxml} + +# 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: python3-devel +BuildRequires: python3-lxml -%description +%global _description %{expand: 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. +module.} +%description %_description -%package -n python%{python3_pkgversion}-%{pypi_name} +%package -n python3-defusedxml 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. +%description -n python3-defusedxml %_description %prep -%autosetup -p1 -n %{pypi_name}-%{upstream_version} +%autosetup -p1 -n defusedxml-%{version} + + +%generate_buildrequires +%pyproject_buildrequires + %build -%py3_build +%pyproject_wheel + %install -%py3_install +%pyproject_install +%pyproject_save_files -l defusedxml + %check -%{python3} tests.py +%{py3_test_envvars} %{python3} tests.py -%files -n python%{python3_pkgversion}-%{pypi_name} +%files -n python3-defusedxml -f %{pyproject_files} %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 -* Mon Mar 25 2024 Arkady L. Shane - 0.7.1-3 -- Rebuilt for MSVSphere 9.3 +* Wed Jan 01 2025 Arkady L. Shane - 0.7.1-17 +- Rebuilt for MSVSphere 10 + +## START: Generated by rpmautospec +* Wed Oct 23 2024 Miro Hrončok - 0.7.1-17 +- Simplify and modernize packaging +- Use SPDX identifier for License + +* Wed Sep 04 2024 Miroslav Suchý - 0.7.1-16 +- convert license to SPDX + +* Fri Jul 19 2024 Fedora Release Engineering - 0.7.1-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Fri Jun 07 2024 Python Maint - 0.7.1-14 +- Rebuilt for Python 3.13 + +* Fri Jan 26 2024 Fedora Release Engineering - 0.7.1-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Mon Jan 22 2024 Fedora Release Engineering - 0.7.1-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Tue Oct 24 2023 Miro Hrončok - 0.7.1-10 +- Run lxml tests during build, avoid deprecated unittest.makeSuite() + +* Fri Jul 21 2023 Fedora Release Engineering - 0.7.1-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Tue Jun 13 2023 Python Maint - 0.7.1-8 +- Rebuilt for Python 3.12 + +* Fri Jan 20 2023 Fedora Release Engineering - 0.7.1-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Fri Jul 22 2022 Fedora Release Engineering - 0.7.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Mon Jun 13 2022 Python Maint - 0.7.1-5 +- Rebuilt for Python 3.11 + +* Fri Jan 21 2022 Fedora Release Engineering - 0.7.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild * Tue Jul 27 2021 Fedora Release Engineering - 0.7.1-3 - Second attempt - Rebuilt for @@ -168,3 +220,5 @@ module. This is the python%{python3_pkgversion} build. * Tue Mar 26 2013 Miro Hrončok - 0.4-1 - Initial package. + +## END: Generated by rpmautospec