15
0
forked from pool/python-calmjs

- Add patch support-python-313.patch:

* Support Python 3.13+ argparse output changes.
- Switch to pyrpoject macros.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-calmjs?expand=0&rev=20
This commit is contained in:
2024-12-09 03:35:27 +00:00
committed by Git OBS Bridge
parent 8eedb662ee
commit a6164d1db0
3 changed files with 57 additions and 5 deletions

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Dec 9 03:34:48 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch support-python-313.patch:
* Support Python 3.13+ argparse output changes.
- Switch to pyrpoject macros.
-------------------------------------------------------------------
Sun Jun 18 16:34:42 UTC 2023 - Andreas Schneider <asn@cryptomilk.org>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-calmjs
#
# 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
@@ -24,6 +24,8 @@ Summary: A Python framework for working with the Node.js ecosystem
License: GPL-2.0-or-later
URL: https://github.com/calmjs/calmjs/
Source: https://github.com/calmjs/calmjs/archive/%{version}.tar.gz
# PATCH-FIX-OPENSUSE Support Python 3.13 argparse output changes
Patch0: support-python-313.patch
BuildRequires: %{python_module calmjs.parse >= 1.0.0}
BuildRequires: %{python_module calmjs.types}
BuildRequires: %{python_module pip}
@@ -33,8 +35,9 @@ BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-calmjs.parse >= 1.0.0
Requires: python-calmjs.types
Requires: python-setuptools
Requires(post): update-alternatives
Requires(postun):update-alternatives
Requires(postun): update-alternatives
BuildArch: noarch
# SECTION test requirements
BuildRequires: nodejs-common
@@ -54,11 +57,11 @@ rm src/calmjs/tests/test_yarn.py
%build
export LANG=en_US.UTF-8
%python_build
%pyproject_wheel
%install
export LANG=en_US.UTF-8
%python_install
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/calmjs
# see https://github.com/calmjs/calmjs/issues/65 for maintainer feedback
# regarding these two subpackages.
@@ -83,6 +86,6 @@ export LANG=en_US.UTF-8
%python_alternative %{_bindir}/calmjs
%{python_sitelib}/calmjs
%{python_sitelib}/calmjs-%{version}*-nspkg.pth
%{python_sitelib}/calmjs-%{version}*-info
%{python_sitelib}/calmjs-%{version}.dist-info
%changelog

42
support-python-313.patch Normal file
View File

@@ -0,0 +1,42 @@
Index: calmjs-3.4.4/src/calmjs/tests/test_argparse.py
===================================================================
--- calmjs-3.4.4.orig/src/calmjs/tests/test_argparse.py
+++ calmjs-3.4.4/src/calmjs/tests/test_argparse.py
@@ -112,7 +112,10 @@ class HelpFormatterTestCase(unittest.Tes
for line in stream.getvalue().splitlines() if
'--' in line
]
- self.assertEqual(options, ['-a', '-g', '-s', '-z'])
+ expected = ['-a', '-g', '-s', '-z']
+ if sys.version_info >= (3, 13):
+ expected = [f"{x}," for x in expected]
+ self.assertEqual(options, expected)
def test_sorted_case_insensitivity(self):
parser = argparse.ArgumentParser(
@@ -131,7 +134,10 @@ class HelpFormatterTestCase(unittest.Tes
'--' in line
]
# the case is unspecified due to in-place sorting
- self.assertEqual(options, ['-a', '-A', '-g', '-S', '-s', '-z'])
+ expected = ['-a', '-A', '-g', '-S', '-s', '-z']
+ if sys.version_info >= (3, 13):
+ expected = [f"{x}," for x in expected]
+ self.assertEqual(options, expected)
def test_sorted_simple_first(self):
parser = argparse.ArgumentParser(
@@ -150,8 +156,11 @@ class HelpFormatterTestCase(unittest.Tes
'--' in line and '[' not in line
]
# the case is unspecified due to in-place sorting
- self.assertEqual(options, [
- '-a', '-A', '-z', '--goat', '--sheep', '--SNAKE'])
+ long_options = ['--goat', '--sheep', '--SNAKE']
+ expected = ['-a', '-A', '-z']
+ if sys.version_info >= (3, 13):
+ expected = [f"{x}," for x in expected]
+ self.assertEqual(options, expected + long_options)
class ArgumentParserTestCase(unittest.TestCase):