17
0

1 Commits

Author SHA256 Message Date
1dfe34a6c6 Convert to libalternatives, bsc#1245883 2025-11-03 15:05:56 +01:00
6 changed files with 118 additions and 48 deletions

99
fix-312.patch Normal file
View File

@@ -0,0 +1,99 @@
Index: smartypants.py-2.0.1/tests/test_cli.py
===================================================================
--- smartypants.py-2.0.1.orig/tests/test_cli.py
+++ smartypants.py-2.0.1/tests/test_cli.py
@@ -35,7 +35,7 @@ class TestCLI(unittest.TestCase):
E = '“foobar”'
output = self._p([sys.executable, CLI_SCRIPT], T)
- self.assertEquals(output, E)
+ self.assertEqual(output, E)
def test_pipe_attr(self):
@@ -43,11 +43,11 @@ class TestCLI(unittest.TestCase):
E = T
output = self._p([sys.executable, CLI_SCRIPT, '--attr', '0'], T)
- self.assertEquals(output, E)
+ self.assertEqual(output, E)
E = """"foo" “bar”"""
output = self._p([sys.executable, CLI_SCRIPT, '--attr', 'b'], T)
- self.assertEquals(output, E)
+ self.assertEqual(output, E)
def test_skipped_elements(self):
@@ -55,19 +55,19 @@ class TestCLI(unittest.TestCase):
E = '<a>&#8220;foo&#8221;</a> <b>&#8220;bar&#8221;</b>'
output = self._p([sys.executable, CLI_SCRIPT], T)
- self.assertEquals(output, E)
+ self.assertEqual(output, E)
E = '<a>"foo"</a> <b>&#8220;bar&#8221;</b>'
output = self._p([sys.executable, CLI_SCRIPT, '--skip', 'a'], T)
- self.assertEquals(output, E)
+ self.assertEqual(output, E)
E = '<a>&#8220;foo&#8221;</a> <b>"bar"</b>'
output = self._p([sys.executable, CLI_SCRIPT, '--skip', 'b'], T)
- self.assertEquals(output, E)
+ self.assertEqual(output, E)
E = T
output = self._p([sys.executable, CLI_SCRIPT, '--skip', 'a,b'], T)
- self.assertEquals(output, E)
+ self.assertEqual(output, E)
def test_file(self):
@@ -82,4 +82,4 @@ class TestCLI(unittest.TestCase):
output = self._p([sys.executable, CLI_SCRIPT, F])
finally:
os.remove(F)
- self.assertEquals(output, E)
+ self.assertEqual(output, E)
Index: smartypants.py-2.0.1/smartypants.py
===================================================================
--- smartypants.py-2.0.1.orig/smartypants.py
+++ smartypants.py-2.0.1/smartypants.py
@@ -268,13 +268,13 @@ def smartypants(text, attr=None):
if do_quotes:
if t == "'":
# Special case: single-character ' token
- if re.match("\S", prev_token_last_char):
+ if re.match(r"\S", prev_token_last_char):
t = "&#8217;"
else:
t = "&#8216;"
elif t == '"':
# Special case: single-character " token
- if re.match("\S", prev_token_last_char):
+ if re.match(r"\S", prev_token_last_char):
t = "&#8221;"
else:
t = "&#8220;"
Index: smartypants.py-2.0.1/tests/test.py
===================================================================
--- smartypants.py-2.0.1.orig/tests/test.py
+++ smartypants.py-2.0.1/tests/test.py
@@ -24,7 +24,7 @@ class SmartyPantsTestCase(unittest.TestC
T = sp(TEXT)
E = '&#8220;foo&#8221; -- bar'
- self.assertEquals(T, E)
+ self.assertEqual(T, E)
attr = Attr.q | Attr.d
Attr.default = attr
@@ -32,7 +32,7 @@ class SmartyPantsTestCase(unittest.TestC
T = sp(TEXT)
E = '&#8220;foo&#8221; &#8212; bar'
- self.assertEquals(T, E)
+ self.assertEqual(T, E)
def test_dates(self):

View File

@@ -1,18 +1,3 @@
-------------------------------------------------------------------
Mon Aug 25 12:30:18 UTC 2025 - Markéta Machová <mmachova@suse.com>
- Convert to libalternatives on SLE-16-based and newer systems only
-------------------------------------------------------------------
Tue Jun 17 16:46:42 UTC 2025 - Benoît Monin <benoit.monin@gmx.fr>
- update to version 2.0.2:
* Fix double closing quotes after an HTML block
* Fix regular expressions and tests for Python 3.12+
* Move documentation to ReadTheDocs
- drop fix-312.patch: merged upstream
- refresh use-sys-executable.patch
-------------------------------------------------------------------
Thu Jun 12 12:07:46 UTC 2025 - Markéta Machová <mmachova@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-smartypants
#
# Copyright (c) 2025 SUSE LLC and contributors
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,14 +16,10 @@
#
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
%{?sle15_python_module_pythons}
Name: python-smartypants
Version: 2.0.2
Version: 2.0.1
Release: 0
Summary: Python fork of perl SmartyPants
License: BSD-3-Clause
@@ -31,21 +27,17 @@ Group: Development/Languages/Python
URL: https://github.com/leohemsted/smartypants.py
Source: https://github.com/leohemsted/smartypants.py/archive/v%{version}.tar.gz#/smartypants-%{version}.tar.gz
Patch0: use-sys-executable.patch
Patch1: fix-312.patch
BuildRequires: %{python_module docutils}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pygments}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: alts
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildArch: noarch
%if %{with libalternatives}
BuildRequires: alts
Requires: alts
%else
Requires(post): update-alternatives
Requires(postun): update-alternatives
%endif
BuildArch: noarch
%python_subpackages
%description
@@ -66,12 +58,6 @@ typographic punctuation HTML entities.
}
%python_clone -a %{buildroot}%{_bindir}/smartypants
%post
%python_install_alternative smartypants
%postun
%python_uninstall_alternative smartypants
%pre
%python_libalternatives_reset_alternative smartypants

BIN
smartypants-2.0.1.tar.gz LFS Normal file

Binary file not shown.

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:560ae7485a27c288f5bd63131f5c3c7b8f0745f50e7c3f85f0bbc65d87799d19
size 28770

View File

@@ -1,7 +1,7 @@
Index: smartypants.py-2.0.2/tests/test_cli.py
Index: smartypants.py-2.0.1/tests/test_cli.py
===================================================================
--- smartypants.py-2.0.2.orig/tests/test_cli.py
+++ smartypants.py-2.0.2/tests/test_cli.py
--- smartypants.py-2.0.1.orig/tests/test_cli.py
+++ smartypants.py-2.0.1/tests/test_cli.py
@@ -7,6 +7,7 @@ import os
import tempfile
import unittest
@@ -16,7 +16,7 @@ Index: smartypants.py-2.0.2/tests/test_cli.py
- output = self._p([CLI_SCRIPT], T)
+ output = self._p([sys.executable, CLI_SCRIPT], T)
self.assertEqual(output, E)
self.assertEquals(output, E)
def test_pipe_attr(self):
@@ -41,11 +42,11 @@ class TestCLI(unittest.TestCase):
@@ -25,12 +25,12 @@ Index: smartypants.py-2.0.2/tests/test_cli.py
E = T
- output = self._p([CLI_SCRIPT, '--attr', '0'], T)
+ output = self._p([sys.executable, CLI_SCRIPT, '--attr', '0'], T)
self.assertEqual(output, E)
self.assertEquals(output, E)
E = """"foo" &#8220;bar&#8221;"""
- output = self._p([CLI_SCRIPT, '--attr', 'b'], T)
+ output = self._p([sys.executable, CLI_SCRIPT, '--attr', 'b'], T)
self.assertEqual(output, E)
self.assertEquals(output, E)
def test_skipped_elements(self):
@@ -53,19 +54,19 @@ class TestCLI(unittest.TestCase):
@@ -39,22 +39,22 @@ Index: smartypants.py-2.0.2/tests/test_cli.py
E = '<a>&#8220;foo&#8221;</a> <b>&#8220;bar&#8221;</b>'
- output = self._p([CLI_SCRIPT], T)
+ output = self._p([sys.executable, CLI_SCRIPT], T)
self.assertEqual(output, E)
self.assertEquals(output, E)
E = '<a>"foo"</a> <b>&#8220;bar&#8221;</b>'
- output = self._p([CLI_SCRIPT, '--skip', 'a'], T)
+ output = self._p([sys.executable, CLI_SCRIPT, '--skip', 'a'], T)
self.assertEqual(output, E)
self.assertEquals(output, E)
E = '<a>&#8220;foo&#8221;</a> <b>"bar"</b>'
- output = self._p([CLI_SCRIPT, '--skip', 'b'], T)
+ output = self._p([sys.executable, CLI_SCRIPT, '--skip', 'b'], T)
self.assertEqual(output, E)
self.assertEquals(output, E)
E = T
- output = self._p([CLI_SCRIPT, '--skip', 'a,b'], T)
+ output = self._p([sys.executable, CLI_SCRIPT, '--skip', 'a,b'], T)
self.assertEqual(output, E)
self.assertEquals(output, E)
def test_file(self):
@@ -78,7 +79,7 @@ class TestCLI(unittest.TestCase):
@@ -65,4 +65,4 @@ Index: smartypants.py-2.0.2/tests/test_cli.py
+ output = self._p([sys.executable, CLI_SCRIPT, F])
finally:
os.remove(F)
self.assertEqual(output, E)
self.assertEquals(output, E)