From a7f3aaa4ee6306fe36d1f8e1d42114d5f8487c903111d3e3fad66abaec172f0e Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Mon, 31 Mar 2025 02:00:41 +0000 Subject: [PATCH] - Add patch support-coverage-7.7.patch: * Support Coverage 7.7.0 and above changes with plugins. - Switch to autosetup and pyproject macros. - No more greedy globs in %files. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-covdefaults?expand=0&rev=12 --- python-covdefaults.changes | 8 ++++++++ python-covdefaults.spec | 16 ++++++++++------ support-coverage-7.7.patch | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 support-coverage-7.7.patch diff --git a/python-covdefaults.changes b/python-covdefaults.changes index d901257..a1773f9 100644 --- a/python-covdefaults.changes +++ b/python-covdefaults.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Mon Mar 31 01:59:41 UTC 2025 - Steve Kowalik + +- Add patch support-coverage-7.7.patch: + * Support Coverage 7.7.0 and above changes with plugins. +- Switch to autosetup and pyproject macros. +- No more greedy globs in %files. + ------------------------------------------------------------------- Sun Jun 11 08:31:24 UTC 2023 - ecsos diff --git a/python-covdefaults.spec b/python-covdefaults.spec index 1289596..fc27c22 100644 --- a/python-covdefaults.spec +++ b/python-covdefaults.spec @@ -1,7 +1,7 @@ # # spec file for package python-covdefaults # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -22,10 +22,12 @@ Version: 2.3.0 Release: 0 Summary: Python coverage plugin to provide default settings License: MIT -Group: Development/Languages/Python URL: https://github.com/asottile/covdefaults Source: https://github.com/asottile/covdefaults/archive/v%{version}.tar.gz#/covdefaults-%{version}.tar.gz +# PATCH-FIX-UPSTREAM gh#asottile/covdefaults#164 +Patch0: support-coverage-7.7.patch BuildRequires: %{python_module coverage} +BuildRequires: %{python_module pip} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} BuildRequires: fdupes @@ -38,13 +40,13 @@ BuildArch: noarch Python coverage plugin to provide default settings. %prep -%setup -q -n covdefaults-%{version} +%autosetup -p1 -n covdefaults-%{version} %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %check @@ -53,6 +55,8 @@ Python coverage plugin to provide default settings. %files %{python_files} %doc README.md %license LICENSE -%{python_sitelib}/* +%{python_sitelib}/covdefaults.py +%pycache_only %{python_sitelib}/__pycache__/covdefaults.*.pyc +%{python_sitelib}/covdefaults-%{version}.dist-info %changelog diff --git a/support-coverage-7.7.patch b/support-coverage-7.7.patch new file mode 100644 index 0000000..ffaf362 --- /dev/null +++ b/support-coverage-7.7.patch @@ -0,0 +1,32 @@ +From 5f8217506f8425d793b04d6379971c7c6245d9e5 Mon Sep 17 00:00:00 2001 +From: Steve Kowalik +Date: Mon, 31 Mar 2025 12:40:43 +1100 +Subject: [PATCH] Support Coverage 7.7.0 and above + +Coverage 7.7.0 refactored the way the Plugins class is used, and as a +consequence, the load_plugins method was renamed, and is no longer a +class method. Check if the new method exists, and fall back to the older +method otherwise. +--- + tests/covdefaults_test.py | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/tests/covdefaults_test.py b/tests/covdefaults_test.py +index 2bf41c2..9f3f129 100644 +--- a/tests/covdefaults_test.py ++++ b/tests/covdefaults_test.py +@@ -228,7 +228,13 @@ def test_configure_keeps_existing_fail_under(): + + def test_coverage_init(): + cfg = CoverageConfig() +- plugin_manager = Plugins.load_plugins(['covdefaults'], cfg) ++ # Coverage 7.7.0 and above ++ if hasattr(Plugins, 'load_from_config'): ++ plugin_manager = Plugins() ++ plugin_manager.load_from_config(['covdefaults'], cfg) ++ # Coverage 7.6.12 and below ++ else: # pragma: no cover ++ plugin_manager = Plugins.load_plugins(['covdefaults'], cfg) + assert plugin_manager.get('covdefaults.CovDefaults') + +