From dd73e476cb747d0a4e344e4ebaacca1371cf134d6c9e3f743ec31681a00040f7 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Mon, 25 Mar 2024 01:44:10 +0000 Subject: [PATCH] - Don't use rm -f in %prep, it hides failures. - Switch to autosetup and pyproject macros. - Correct path used for running the testsuite. - Add patch support-python-312.patch: * Do not a monkey patch for assertRaisesRegexp, it is not required. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-ZConfig?expand=0&rev=21 --- python-ZConfig.changes | 9 +++++++++ python-ZConfig.spec | 25 +++++++++++++------------ support-python-312.patch | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 12 deletions(-) create mode 100644 support-python-312.patch diff --git a/python-ZConfig.changes b/python-ZConfig.changes index cdac36d..151c958 100644 --- a/python-ZConfig.changes +++ b/python-ZConfig.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Mon Mar 25 01:42:28 UTC 2024 - Steve Kowalik + +- Don't use rm -f in %prep, it hides failures. +- Switch to autosetup and pyproject macros. +- Correct path used for running the testsuite. +- Add patch support-python-312.patch: + * Do not a monkey patch for assertRaisesRegexp, it is not required. + ------------------------------------------------------------------- Sun Jan 21 10:36:47 UTC 2024 - Dirk Müller diff --git a/python-ZConfig.spec b/python-ZConfig.spec index a4e742d..a186a91 100644 --- a/python-ZConfig.spec +++ b/python-ZConfig.spec @@ -22,19 +22,21 @@ Version: 4.0 Release: 0 Summary: Structured Configuration Library License: ZPL-2.1 -Group: Development/Libraries/Python URL: https://github.com/zopefoundation/ZConfig Source: https://files.pythonhosted.org/packages/source/Z/ZConfig/ZConfig-%{version}.tar.gz -# Testing requirements: +# PATCH-FIX-UPSTREAM gh#zopefoundation/ZConfig#91 +Patch0: support-python-312.patch +BuildRequires: %{python_module base >= 3.7} BuildRequires: %{python_module docutils} BuildRequires: %{python_module manuel} +BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: %{python_module zope.testrunner} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-setuptools Requires(post): update-alternatives -Requires(postun):update-alternatives +Requires(postun): update-alternatives BuildArch: noarch %python_subpackages @@ -56,36 +58,35 @@ packages. %package doc Summary: Structured Configuration Library -Group: Development/Libraries/Python Requires: %{name} = %{version} %description doc This package contains documentation files for %{name}. %prep -%setup -q -n ZConfig-%{version} +%autosetup -p1 -n ZConfig-%{version} rm -rf ZConfig.egg-info rm docs/make.bat # test works only in git repo -rm -f ZConfig/tests/test_readme.py +rm src/ZConfig/tests/test_readme.py %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %python_clone -a %{buildroot}%{_bindir}/zconfig %python_clone -a %{buildroot}%{_bindir}/zconfig_schema2html %check export LANG=en_US.UTF8 -%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} zope-testrunner-%{$python_bin_suffix} -v --test-path=. +%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} zope-testrunner-%{$python_bin_suffix} -v --test-path=src %post %python_install_alternative zconfig zconfig_schema2html -%preun +%postun %python_uninstall_alternative zconfig %files %{python_files} @@ -94,7 +95,7 @@ export LANG=en_US.UTF8 %python_alternative %{_bindir}/zconfig %python_alternative %{_bindir}/zconfig_schema2html %{python_sitelib}/ZConfig -%{python_sitelib}/ZConfig-%{version}*-info +%{python_sitelib}/ZConfig-%{version}.dist-info %files %{python_files doc} %doc docs/ diff --git a/support-python-312.patch b/support-python-312.patch new file mode 100644 index 0000000..e192bb9 --- /dev/null +++ b/support-python-312.patch @@ -0,0 +1,37 @@ +From f5af2333db607f612f21ab0d4efd35b5cc72199b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20Van=C4=9Bk?= +Date: Tue, 6 Jun 2023 08:52:08 +0200 +Subject: [PATCH] Fix tests for Python 3.12 + +In the tests, remove the assertRaisesRegexp method, deprecated since +Python 3.2, to prevent test failures following the method's removal in +Python 3.12. +--- + src/ZConfig/tests/support.py | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/src/ZConfig/tests/support.py b/src/ZConfig/tests/support.py +index 959f2b9..559c015 100644 +--- a/src/ZConfig/tests/support.py ++++ b/src/ZConfig/tests/support.py +@@ -17,7 +17,6 @@ + import contextlib + import os + import sys +-import unittest + from io import StringIO + from urllib.request import pathname2url + +@@ -79,12 +78,6 @@ def f2(self): + class TestHelper: + """Utility methods which can be used with the schema support.""" + +- # Not derived from unittest.TestCase; some test runners seem to +- # think that means this class contains tests. +- +- assertRaisesRegex = getattr(unittest.TestCase, 'assertRaisesRegex', +- unittest.TestCase.assertRaisesRegexp) +- + def load_both(self, schema_url, conf_url): + schema = self.load_schema(schema_url) + conf = self.load_config(schema, conf_url)