diff --git a/fix-assertion-methods.patch b/fix-assertion-methods.patch new file mode 100644 index 0000000..5b330b4 --- /dev/null +++ b/fix-assertion-methods.patch @@ -0,0 +1,51 @@ +Index: kmatch-0.5.0/kmatch/tests/kmatch_tests.py +=================================================================== +--- kmatch-0.5.0.orig/kmatch/tests/kmatch_tests.py ++++ kmatch-0.5.0/kmatch/tests/kmatch_tests.py +@@ -11,7 +11,7 @@ class KPatternTest(TestCase): + """ + def test_pattern(self): + k = K(['=~', 'hi', 'hi']) +- self.assertEquals(k.pattern, ['=~', 'hi', 'hi']) ++ self.assertEqual(k.pattern, ['=~', 'hi', 'hi']) + + + class KMatchTest(TestCase): +@@ -363,20 +363,20 @@ class KInitTest(TestCase): + @patch('kmatch.kmatch.re.compile', spec_set=True, side_effect=lambda x, flags: '{0}_compiled'.format(x)) + def test_unnested(self, mock_compile): + k = K(['=~', 'field', 'hi']) +- self.assertEquals(mock_compile.call_count, 1) +- self.assertEquals(k._compiled_pattern, ['=~', 'field', 'hi_compiled']) ++ self.assertEqual(mock_compile.call_count, 1) ++ self.assertEqual(k._compiled_pattern, ['=~', 'field', 'hi_compiled']) + + @patch('kmatch.kmatch.re.compile', spec_set=True, side_effect=lambda x, flags: '{0}_compiled'.format(x)) + def test_nested_list_of_single_dict(self, mock_compile): + k = K(['!', ['=~', 'field', 'hi']]) +- self.assertEquals(mock_compile.call_count, 1) +- self.assertEquals(k._compiled_pattern, ['!', ['=~', 'field', 'hi_compiled']]) ++ self.assertEqual(mock_compile.call_count, 1) ++ self.assertEqual(k._compiled_pattern, ['!', ['=~', 'field', 'hi_compiled']]) + + @patch('kmatch.kmatch.re.compile', spec_set=True, side_effect=lambda x, flags: '{0}_compiled'.format(x)) + def test_nested_list_of_lists(self, mock_compile): + k = K(['&', [['=~', 'f', 'hi'], ['=~', 'f', 'hello']]]) +- self.assertEquals(mock_compile.call_count, 2) +- self.assertEquals( ++ self.assertEqual(mock_compile.call_count, 2) ++ self.assertEqual( + k._compiled_pattern, + ['&', [['=~', 'f', 'hi_compiled'], ['=~', 'f', 'hello_compiled']]]) + +@@ -393,8 +393,8 @@ class KInitTest(TestCase): + ]] + ]] + ]]) +- self.assertEquals(mock_compile.call_count, 5) +- self.assertEquals(k._compiled_pattern, ['&', [ ++ self.assertEqual(mock_compile.call_count, 5) ++ self.assertEqual(k._compiled_pattern, ['&', [ + ['=~', 'f', 'hi_compiled'], + ['=~', 'f', 'hello_compiled'], + ['|', [ diff --git a/python-kmatch.changes b/python-kmatch.changes index d9ab8be..513453a 100644 --- a/python-kmatch.changes +++ b/python-kmatch.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Jan 24 01:53:09 UTC 2024 - Steve Kowalik + +- Switch to autosetup and pyproject macros. +- Stop using greedy globs in %files. +- Add patch fix-assertion-methods.patch: + * Use non-deprecated assertion methods. + ------------------------------------------------------------------- Wed Dec 27 14:25:10 UTC 2023 - Dirk Müller diff --git a/python-kmatch.spec b/python-kmatch.spec index 270232f..d7cdb8d 100644 --- a/python-kmatch.spec +++ b/python-kmatch.spec @@ -1,7 +1,7 @@ # # spec file for package python-kmatch # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -26,7 +26,10 @@ URL: https://github.com/ambitioninc/kmatch Source: https://files.pythonhosted.org/packages/source/k/kmatch/kmatch-%{version}.tar.gz # https://github.com/ambitioninc/kmatch/issues/42 Patch0: python-kmatch-no-mock.patch +Patch1: fix-assertion-methods.patch +BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: dos2unix BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -42,8 +45,7 @@ dictionaries. Patterns are specified as lists of filters combined with logical operators. %prep -%setup -q -n kmatch-%{version} -%patch0 -p1 +%autosetup -p1 -n kmatch-%{version} sed -i '/nose/d' setup.py dos2unix README.rst LICENSE chmod a-x README.rst LICENSE @@ -51,10 +53,10 @@ rm -r *.egg-info %build mv kmatch/tests/ .tests -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %check @@ -64,6 +66,7 @@ mv .tests tests %files %{python_files} %doc README.rst %license LICENSE -%{python_sitelib}/* +%{python_sitelib}/kmatch +%{python_sitelib}/kmatch-%{version}.dist-info %changelog