diff --git a/python-pysrt.changes b/python-pysrt.changes index 9724c1c..3dec52b 100644 --- a/python-pysrt.changes +++ b/python-pysrt.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Feb 14 04:41:27 UTC 2024 - Steve Kowalik + +- Add patch use-assertequal.patch: + * Support Python 3.12 by using TestCase.assertEqual(). +- Switch to autosetup and pyproject macros. + ------------------------------------------------------------------- Tue May 5 22:18:14 UTC 2020 - Matej Cepl diff --git a/python-pysrt.spec b/python-pysrt.spec index f050275..2e9d3fd 100644 --- a/python-pysrt.spec +++ b/python-pysrt.spec @@ -1,7 +1,7 @@ # # spec file for package python-pysrt # -# Copyright (c) 2020 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 @@ -16,7 +16,6 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pysrt Version: 1.1.2 Release: 0 @@ -24,15 +23,18 @@ Summary: SubRip (.srt) subtitle parser and writer License: GPL-3.0-only URL: https://github.com/byroot/pysrt Source0: https://files.pythonhosted.org/packages/source/p/pysrt/pysrt-%{version}.tar.gz -BuildRequires: %{python_module base} +# PATCH-FIX-UPSTREAM gh#byroot/pysrt#74946098ce136a5b4b1d5766ca573e999c785686 +Patch0: use-assertequal.patch BuildRequires: %{python_module chardet} +BuildRequires: %{python_module pip} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-chardet -Requires(post): update-alternatives -Requires(postun): update-alternatives +Requires(post): update-alternatives +Requires(postun): update-alternatives BuildArch: noarch %python_subpackages @@ -41,15 +43,15 @@ pysrt is a python library to search and download subtitles. It comes with an easy to use CLI suitable for direct use or cron jobs. %prep -%setup -q -n pysrt-%{version} +%autosetup -p1 -n pysrt-%{version} # Remove shebang from non-executable file sed -e '1d' -i pysrt/commands.py %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_clone -a %{buildroot}%{_bindir}/srt %python_expand %fdupes %{buildroot}%{$python_sitelib} @@ -66,6 +68,6 @@ sed -e '1d' -i pysrt/commands.py %doc README.rst %python_alternative %{_bindir}/srt %{python_sitelib}/pysrt -%{python_sitelib}/pysrt-%{version}-py%{python_version}.egg-info +%{python_sitelib}/pysrt-%{version}.dist-info %changelog diff --git a/use-assertequal.patch b/use-assertequal.patch new file mode 100644 index 0000000..15ae20e --- /dev/null +++ b/use-assertequal.patch @@ -0,0 +1,79 @@ +From 74946098ce136a5b4b1d5766ca573e999c785686 Mon Sep 17 00:00:00 2001 +From: Karthikeyan Singaravelan +Date: Sat, 15 Jan 2022 05:05:40 +0000 +Subject: [PATCH] Use assertEqual instead of assertEquals for Python 3.11 + compatibility. + +--- + tests/test_srtfile.py | 10 +++++----- + tests/test_srtitem.py | 10 +++++----- + 2 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/tests/test_srtfile.py b/tests/test_srtfile.py +index 819aa4d..b24e8ac 100644 +--- a/tests/test_srtfile.py ++++ b/tests/test_srtfile.py +@@ -117,8 +117,8 @@ def test_slice(self): + 459) + + def test_at(self): +- self.assertEquals(len(self.file.at((0, 0, 31, 0))), 1) +- self.assertEquals(len(self.file.at(seconds=31)), 1) ++ self.assertEqual(len(self.file.at((0, 0, 31, 0))), 1) ++ self.assertEqual(len(self.file.at(seconds=31)), 1) + + + class TestShifting(unittest.TestCase): +@@ -137,14 +137,14 @@ def test_single_item(self): + srt_file = SubRipFile([ + SubRipItem(1, {'seconds': 1}, {'seconds': 2}, 'Hello') + ]) +- self.assertEquals(srt_file.text, 'Hello') ++ self.assertEqual(srt_file.text, 'Hello') + + def test_multiple_item(self): + srt_file = SubRipFile([ + SubRipItem(1, {'seconds': 0}, {'seconds': 3}, 'Hello'), + SubRipItem(1, {'seconds': 1}, {'seconds': 2}, 'World !') + ]) +- self.assertEquals(srt_file.text, 'Hello\nWorld !') ++ self.assertEqual(srt_file.text, 'Hello\nWorld !') + + + class TestDuckTyping(unittest.TestCase): +@@ -251,7 +251,7 @@ def test_blank_lines(self): + + def test_missing_indexes(self): + items = pysrt.open(os.path.join(self.base_path, 'no-indexes.srt')) +- self.assertEquals(len(items), 7) ++ self.assertEqual(len(items), 7) + + if __name__ == '__main__': + unittest.main() +diff --git a/tests/test_srtitem.py b/tests/test_srtitem.py +index f4a6f2f..9d29538 100644 +--- a/tests/test_srtitem.py ++++ b/tests/test_srtitem.py +@@ -197,17 +197,17 @@ def test_paring_error(self): + + def test_string_index(self): + item = SubRipItem.from_string(self.string_index) +- self.assertEquals(item.index, 'foo') +- self.assertEquals(item.text, 'Hello !') ++ self.assertEqual(item.index, 'foo') ++ self.assertEqual(item.text, 'Hello !') + + def test_no_index(self): + item = SubRipItem.from_string(self.no_index) +- self.assertEquals(item.index, None) +- self.assertEquals(item.text, 'Hello world !') ++ self.assertEqual(item.index, None) ++ self.assertEqual(item.text, 'Hello world !') + + def test_junk_after_timestamp(self): + item = SubRipItem.from_string(self.junk_after_timestamp) +- self.assertEquals(item, self.item) ++ self.assertEqual(item, self.item) + + if __name__ == '__main__': + unittest.main()