summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2023-10-20 15:28:49 +0200
committerMichał Górny <mgorny@gentoo.org>2023-10-20 15:28:49 +0200
commitda5fffd26a8aa0874704c19f7c9c72ee9179de87 (patch)
tree0ffdcc88edfadb5386108561cbdbaa7dcb756f38 /dev-python/smartypants
parentdev-python/nnpy: Enable py3.12 (diff)
downloadgentoo-da5fffd26a8aa0874704c19f7c9c72ee9179de87.tar.gz
gentoo-da5fffd26a8aa0874704c19f7c9c72ee9179de87.tar.bz2
gentoo-da5fffd26a8aa0874704c19f7c9c72ee9179de87.zip
dev-python/smartypants: Enable py3.12
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/smartypants')
-rw-r--r--dev-python/smartypants/files/smartypants-2.0.1-py312.patch110
-rw-r--r--dev-python/smartypants/smartypants-2.0.1-r1.ebuild7
2 files changed, 116 insertions, 1 deletions
diff --git a/dev-python/smartypants/files/smartypants-2.0.1-py312.patch b/dev-python/smartypants/files/smartypants-2.0.1-py312.patch
new file mode 100644
index 000000000000..e1e3a1ac6249
--- /dev/null
+++ b/dev-python/smartypants/files/smartypants-2.0.1-py312.patch
@@ -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 = "&#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;"
+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 = '&#8220;foo&#8221; -- 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 = '&#8220;foo&#8221; &#8212; 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 = '&#8220;foobar&#8221;'
+
+ 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" &#8220;bar&#8221;"""
+ 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>&#8220;foo&#8221;</a> <b>&#8220;bar&#8221;</b>'
+ output = self._p([CLI_SCRIPT], T)
+- self.assertEquals(output, E)
++ self.assertEqual(output, E)
+
+ E = '<a>"foo"</a> <b>&#8220;bar&#8221;</b>'
+ output = self._p([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([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)
diff --git a/dev-python/smartypants/smartypants-2.0.1-r1.ebuild b/dev-python/smartypants/smartypants-2.0.1-r1.ebuild
index c05ab9b7a76b..bc1f3f909ebe 100644
--- a/dev-python/smartypants/smartypants-2.0.1-r1.ebuild
+++ b/dev-python/smartypants/smartypants-2.0.1-r1.ebuild
@@ -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