- Replace python-deprecation-no-unittest2.patch with a different upstream

patch.
- Switch to autosetup and pyproject macros.
- No more greedy globs in %files.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-deprecation?expand=0&rev=17
This commit is contained in:
Steve Kowalik 2024-02-27 03:50:54 +00:00 committed by Git OBS Bridge
parent 7d7162a268
commit 4441069f97
3 changed files with 42 additions and 47 deletions

View File

@ -1,41 +1,30 @@
Index: deprecation-2.1.0/tests/test_deprecation.py From e13e23068cb8d653a02a434a159e8b0b7226ffd6 Mon Sep 17 00:00:00 2001
=================================================================== From: Jonathan Ringer <jonringer117@gmail.com>
--- deprecation-2.1.0.orig/tests/test_deprecation.py 2020-04-20 16:14:19.000000000 +0200 Date: Tue, 11 Jan 2022 14:23:03 -0800
+++ deprecation-2.1.0/tests/test_deprecation.py 2020-06-01 13:51:55.484939683 +0200 Subject: [PATCH] Make unittest optional for python3.5+
@@ -12,14 +12,16 @@
---
docs-requirements.txt | 2 +-
test-requirements.txt | 2 +-
tests/test_deprecation.py | 7 ++++++-
tox.ini | 2 +-
4 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/tests/test_deprecation.py b/tests/test_deprecation.py
index 0fd29b3..14e9510 100644
--- a/tests/test_deprecation.py
+++ b/tests/test_deprecation.py
@@ -12,7 +12,12 @@
# As we unfortunately support Python 2.7, it lacks TestCase.subTest which # As we unfortunately support Python 2.7, it lacks TestCase.subTest which
# is in 3.4+ or in unittest2 # is in 3.4+ or in unittest2
-import unittest2 -import unittest2
+import unittest +try:
+if not hasattr(unittest.TestCase, "subTest"): + import unittest2
+ import unittest2 as unittest +except ImportError:
+ import unittest
+ unittest2 = unittest
+
import warnings import warnings
import deprecation import deprecation
from datetime import date
-class Test_deprecated(unittest2.TestCase):
+class Test_deprecated(unittest.TestCase):
def test_args_set_on_base_class(self):
args = (1, 2, 3, 4)
@@ -230,7 +232,7 @@ class Test_deprecated(unittest2.TestCase
self.assertEqual(sot.method(), ret_val)
-class Test_fail_if_not_removed(unittest2.TestCase):
+class Test_fail_if_not_removed(unittest.TestCase):
@deprecation.deprecated(deprecated_in="1.0", current_version="2.0")
def _deprecated_method(self):
@@ -259,7 +261,7 @@ class Test_fail_if_not_removed(unittest2
except AssertionError:
self.fail("A DeprecatedWarning shouldn't cause a failure")
- @unittest2.expectedFailure
+ @unittest.expectedFailure
@deprecation.fail_if_not_removed
def test_literal_UnsupportedWarning(self):
self._unsupported_method()

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Feb 27 03:49:53 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Replace python-deprecation-no-unittest2.patch with a different upstream
patch.
- Switch to autosetup and pyproject macros.
- No more greedy globs in %files.
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Nov 10 16:42:46 CET 2023 - marec@detebe.org Fri Nov 10 16:42:46 CET 2023 - marec@detebe.org
- update python build instruction - update python build instruction

View File

@ -1,7 +1,7 @@
# #
# spec file for package python-deprecation # spec file for package python-deprecation
# #
# Copyright (c) 2020 SUSE LLC # Copyright (c) 2024 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -17,26 +17,24 @@
%{?sle15_python_module_pythons} %{?sle15_python_module_pythons}
%bcond_without python2
Name: python-deprecation Name: python-deprecation
Version: 2.1.0 Version: 2.1.0
Release: 0 Release: 0
Summary: A library to handle automated deprecations Summary: A library to handle automated deprecations
License: Apache-2.0 License: Apache-2.0
Group: Development/Languages/Python
URL: https://github.com/briancurtin/deprecation URL: https://github.com/briancurtin/deprecation
Source: https://files.pythonhosted.org/packages/source/d/deprecation/deprecation-%{version}.tar.gz Source: https://files.pythonhosted.org/packages/source/d/deprecation/deprecation-%{version}.tar.gz
# https://github.com/briancurtin/deprecation/pull/50 # PATCH-FIX-UPSTREAM Based on gh#briancurtin/deprecation#57
Patch0: python-deprecation-no-unittest2.patch Patch0: python-deprecation-no-unittest2.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
# SECTION test requirements # SECTION test requirements
BuildRequires: %{python_module pytest} BuildRequires: %{python_module pytest}
%if %{with python2}
BuildRequires: python-unittest2
%endif
# /SECTION # /SECTION
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: python-rpm-macros BuildRequires: python-rpm-macros
Requires: python-packaging
BuildArch: noarch BuildArch: noarch
%python_subpackages %python_subpackages
@ -46,15 +44,13 @@ The `deprecation` library provides a `deprecated` decorator and a
enable the automation of several things: enable the automation of several things:
%prep %prep
%setup -q -n deprecation-%{version} %autosetup -p1 -n deprecation-%{version}
%patch0 -p1
%build %build
%pyproject_wheel
%python_build
%install %install
%python_install %pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib} %python_expand %fdupes %{buildroot}%{$python_sitelib}
%check %check
@ -63,6 +59,8 @@ enable the automation of several things:
%files %{python_files} %files %{python_files}
%license LICENSE %license LICENSE
%doc README.rst %doc README.rst
%{python_sitelib}/* %{python_sitelib}/deprecation.py
%pycache_only %{python_sitelib}/__pycache__/deprecation.*.py*
%{python_sitelib}/deprecation-%{version}.dist-info
%changelog %changelog