mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-08-01 23:28:08 -07:00
dev-python/smartypants: Enable py3.12
Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
110
dev-python/smartypants/files/smartypants-2.0.1-py312.patch
Normal file
110
dev-python/smartypants/files/smartypants-2.0.1-py312.patch
Normal file
@@ -0,0 +1,110 @@
|
||||
From ea46bf36343044a7a61ba3acce4a7f188d986ec5 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ond=C5=99ej=20S=C3=BAkup?= <mimi.vx@gmail.com>
|
||||
Date: Mon, 25 Sep 2023 10:31:37 +0200
|
||||
Subject: [PATCH] Fix regexps and tests for python3.12
|
||||
|
||||
---
|
||||
smartypants.py | 4 ++--
|
||||
tests/test.py | 4 ++--
|
||||
tests/test_cli.py | 16 ++++++++--------
|
||||
3 files changed, 12 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/smartypants.py b/smartypants.py
|
||||
index c39f409..37368fb 100755
|
||||
--- a/smartypants.py
|
||||
+++ b/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 = "’"
|
||||
else:
|
||||
t = "‘"
|
||||
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 = "”"
|
||||
else:
|
||||
t = "“"
|
||||
diff --git a/tests/test.py b/tests/test.py
|
||||
index 2c1a0ea..ac5075a 100644
|
||||
--- a/tests/test.py
|
||||
+++ b/tests/test.py
|
||||
@@ -24,7 +24,7 @@ def test_change_default_attr(self):
|
||||
|
||||
T = sp(TEXT)
|
||||
E = '“foo” -- bar'
|
||||
- self.assertEquals(T, E)
|
||||
+ self.assertEqual(T, E)
|
||||
|
||||
attr = Attr.q | Attr.d
|
||||
Attr.default = attr
|
||||
@@ -32,7 +32,7 @@ def test_change_default_attr(self):
|
||||
|
||||
T = sp(TEXT)
|
||||
E = '“foo” — bar'
|
||||
- self.assertEquals(T, E)
|
||||
+ self.assertEqual(T, E)
|
||||
|
||||
def test_dates(self):
|
||||
|
||||
diff --git a/tests/test_cli.py b/tests/test_cli.py
|
||||
index e85545a..6b5e136 100644
|
||||
--- a/tests/test_cli.py
|
||||
+++ b/tests/test_cli.py
|
||||
@@ -34,7 +34,7 @@ def test_pipe(self):
|
||||
E = '“foobar”'
|
||||
|
||||
output = self._p([CLI_SCRIPT], T)
|
||||
- self.assertEquals(output, E)
|
||||
+ self.assertEqual(output, E)
|
||||
|
||||
def test_pipe_attr(self):
|
||||
|
||||
@@ -42,11 +42,11 @@ def test_pipe_attr(self):
|
||||
|
||||
E = T
|
||||
output = self._p([CLI_SCRIPT, '--attr', '0'], T)
|
||||
- self.assertEquals(output, E)
|
||||
+ self.assertEqual(output, E)
|
||||
|
||||
E = """"foo" “bar”"""
|
||||
output = self._p([CLI_SCRIPT, '--attr', 'b'], T)
|
||||
- self.assertEquals(output, E)
|
||||
+ self.assertEqual(output, E)
|
||||
|
||||
def test_skipped_elements(self):
|
||||
|
||||
@@ -54,19 +54,19 @@ def test_skipped_elements(self):
|
||||
|
||||
E = '<a>“foo”</a> <b>“bar”</b>'
|
||||
output = self._p([CLI_SCRIPT], T)
|
||||
- self.assertEquals(output, E)
|
||||
+ self.assertEqual(output, E)
|
||||
|
||||
E = '<a>"foo"</a> <b>“bar”</b>'
|
||||
output = self._p([CLI_SCRIPT, '--skip', 'a'], T)
|
||||
- self.assertEquals(output, E)
|
||||
+ self.assertEqual(output, E)
|
||||
|
||||
E = '<a>“foo”</a> <b>"bar"</b>'
|
||||
output = self._p([CLI_SCRIPT, '--skip', 'b'], T)
|
||||
- self.assertEquals(output, E)
|
||||
+ self.assertEqual(output, E)
|
||||
|
||||
E = T
|
||||
output = self._p([CLI_SCRIPT, '--skip', 'a,b'], T)
|
||||
- self.assertEquals(output, E)
|
||||
+ self.assertEqual(output, E)
|
||||
|
||||
def test_file(self):
|
||||
|
||||
@@ -81,4 +81,4 @@ def test_file(self):
|
||||
output = self._p([CLI_SCRIPT, F])
|
||||
finally:
|
||||
os.remove(F)
|
||||
- self.assertEquals(output, E)
|
||||
+ self.assertEqual(output, E)
|
||||
@@ -4,7 +4,7 @@
|
||||
EAPI=8
|
||||
|
||||
DISTUTILS_USE_PEP517=setuptools
|
||||
PYTHON_COMPAT=( python3_{9..11} )
|
||||
PYTHON_COMPAT=( python3_{10..12} )
|
||||
|
||||
inherit distutils-r1
|
||||
|
||||
@@ -28,6 +28,11 @@ distutils_enable_sphinx docs
|
||||
distutils_enable_tests unittest
|
||||
|
||||
src_prepare() {
|
||||
local PATCHES=(
|
||||
# https://github.com/leohemsted/smartypants.py/pull/21
|
||||
"${FILESDIR}/${P}-py312.patch"
|
||||
)
|
||||
|
||||
# relevant only to upstream packaging, requires docutils
|
||||
rm tests/test_setup.py || die
|
||||
distutils-r1_src_prepare
|
||||
|
||||
Reference in New Issue
Block a user