From 6534d2187fa6a17dd86d9b1ce5432dff55095098acc1b9535b5ebc2d8df1930e Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Mon, 4 Mar 2024 02:07:24 +0000 Subject: [PATCH] - Switch to pyproject and autosetup macros. - Add patch support-python-312.patch, support Python 3.12. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-redmine?expand=0&rev=16 --- python-python-redmine.changes | 6 +++++ python-python-redmine.spec | 16 +++++++------ support-python-312.patch | 45 +++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 support-python-312.patch diff --git a/python-python-redmine.changes b/python-python-redmine.changes index d2d9daa..2dec3ac 100644 --- a/python-python-redmine.changes +++ b/python-python-redmine.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Mar 4 02:06:37 UTC 2024 - Steve Kowalik + +- Switch to pyproject and autosetup macros. +- Add patch support-python-312.patch, support Python 3.12. + ------------------------------------------------------------------- Tue Sep 26 18:54:59 UTC 2023 - Martin Hauke diff --git a/python-python-redmine.spec b/python-python-redmine.spec index be552b2..dce8470 100644 --- a/python-python-redmine.spec +++ b/python-python-redmine.spec @@ -1,7 +1,7 @@ # # spec file for package python-python-redmine # -# 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 @@ -21,14 +21,17 @@ Version: 2.4.0 Release: 0 Summary: Python library for the Redmine RESTful API License: Apache-2.0 -Group: Development/Languages/Python URL: https://python-redmine.com Source: https://files.pythonhosted.org/packages/source/p/python-redmine/python-redmine-%{version}.tar.gz Patch0: https://github.com/maxtepkeev/python-redmine/pull/328.patch +# PATCH-FIX-UPSTREAM gh#maxtepkeev/python-redmine#332 +Patch1: support-python-312.patch +BuildRequires: %{python_module pip} BuildRequires: %{python_module pytest-cov} BuildRequires: %{python_module pytest} BuildRequires: %{python_module requests >= 2.28.2} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-requests >= 2.28.2 @@ -42,14 +45,13 @@ via REST API for which Python Redmine provides a simple but powerful Pythonic API inspired by a well-known Django ORM. %prep -%setup -q -n python-redmine-%{version} -%patch0 -p1 +%autosetup -p1 -n python-redmine-%{version} %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %check @@ -59,6 +61,6 @@ powerful Pythonic API inspired by a well-known Django ORM. %license LICENSE %doc CHANGELOG.rst README.rst %{python_sitelib}/redminelib -%{python_sitelib}/python_redmine-* +%{python_sitelib}/python_redmine-%{version}.dist-info %changelog diff --git a/support-python-312.patch b/support-python-312.patch new file mode 100644 index 0000000..6412896 --- /dev/null +++ b/support-python-312.patch @@ -0,0 +1,45 @@ +From b28beb9f0c1516d35037bb54adcb54dd803694e6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Sat, 2 Mar 2024 14:45:08 +0100 +Subject: [PATCH] Replace `assertEquals()` to fix tests with Python 3.12 (#332) + +--- + tests/test_managers.py | 4 ++-- + tests/test_redmine.py | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tests/test_managers.py b/tests/test_managers.py +index dfacab2..44c2e8b 100644 +--- a/tests/test_managers.py ++++ b/tests/test_managers.py +@@ -125,7 +125,7 @@ def test_create_resource_with_stream_uploads(self): + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter('always') + issue = self.redmine.issue.create(project_id=1, subject='Foo', uploads=[{'path': stream}]) +- self.assertEquals(len(w), 1) ++ self.assertEqual(len(w), 1) + self.assertIs(w[0].category, exceptions.PerformanceWarning) + self.assertEqual(issue.project_id, 1) + self.assertEqual(issue.subject, 'Foo') +@@ -166,7 +166,7 @@ def test_update_resource_with_stream_uploads(self): + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter('always') + self.assertEqual(self.redmine.issue.update(1, subject='Bar', uploads=[{'path': stream}]), True) +- self.assertEquals(len(w), 1) ++ self.assertEqual(len(w), 1) + self.assertIs(w[0].category, exceptions.PerformanceWarning) + + def test_update_resource_returns_none(self): +diff --git a/tests/test_redmine.py b/tests/test_redmine.py +index 46e456b..9384c18 100644 +--- a/tests/test_redmine.py ++++ b/tests/test_redmine.py +@@ -77,7 +77,7 @@ def test_successful_filestream_upload(self): + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter('always') + self.assertEqual(self.redmine.upload(StringIO(b'\xcf\x86oo'.decode('utf-8')))['token'], '456789') +- self.assertEquals(len(w), 1) ++ self.assertEqual(len(w), 1) + self.assertIs(w[0].category, exceptions.PerformanceWarning) + + @mock.patch('redminelib.open', mock.mock_open(), create=True)