From dde66ecacc117c01fa702848ef25b7ea4f737331 Mon Sep 17 00:00:00 2001 From: sthen Date: Tue, 18 Feb 2025 20:43:33 +0000 Subject: [PATCH] apply upstream patches; fix regexps and tests for python 3.12 removes use of 2to3 (which goes away in 3.13) --- textproc/py-smartypants/Makefile | 4 +- .../patches/patch-smartypants_py | 24 ++++++++ .../patches/patch-tests_test_cli_py | 61 +++++++++++++++++++ .../patches/patch-tests_test_py | 26 ++++++++ 4 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 textproc/py-smartypants/patches/patch-smartypants_py create mode 100644 textproc/py-smartypants/patches/patch-tests_test_cli_py create mode 100644 textproc/py-smartypants/patches/patch-tests_test_py diff --git a/textproc/py-smartypants/Makefile b/textproc/py-smartypants/Makefile index 5eba5ec1806..1f3624a6a16 100644 --- a/textproc/py-smartypants/Makefile +++ b/textproc/py-smartypants/Makefile @@ -5,7 +5,7 @@ GH_ACCOUNT= leohemsted GH_PROJECT= smartypants.py GH_TAGNAME= v${MODPY_DISTV} PKGNAME= py-smartypants-${MODPY_DISTV} -REVISION= 3 +REVISION= 4 CATEGORIES= textproc @@ -14,9 +14,9 @@ PERMIT_PACKAGE= Yes MODULES= lang/python MODPY_PYBUILD= setuptools +TEST_DEPENDS= textproc/py-docutils pre-test: ln -sf ${MODPY_BIN} ${WRKDIR}/bin/python - ${LOCALBASE}/bin/2to3 --write --nobackup ${WRKSRC}/tests/test_cli.py .include diff --git a/textproc/py-smartypants/patches/patch-smartypants_py b/textproc/py-smartypants/patches/patch-smartypants_py new file mode 100644 index 00000000000..dd237100bca --- /dev/null +++ b/textproc/py-smartypants/patches/patch-smartypants_py @@ -0,0 +1,24 @@ +From ea46bf36343044a7a61ba3acce4a7f188d986ec5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ond=C5=99ej=20S=C3=BAkup?= +Date: Mon, 25 Sep 2023 10:31:37 +0200 +Subject: [PATCH] Fix regexps and tests for python3.12 + +Index: smartypants.py +--- smartypants.py.orig ++++ 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/textproc/py-smartypants/patches/patch-tests_test_cli_py b/textproc/py-smartypants/patches/patch-tests_test_cli_py new file mode 100644 index 00000000000..3a2e3921de8 --- /dev/null +++ b/textproc/py-smartypants/patches/patch-tests_test_cli_py @@ -0,0 +1,61 @@ +From ea46bf36343044a7a61ba3acce4a7f188d986ec5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ond=C5=99ej=20S=C3=BAkup?= +Date: Mon, 25 Sep 2023 10:31:37 +0200 +Subject: [PATCH] Fix regexps and tests for python3.12 + +Index: tests/test_cli.py +--- tests/test_cli.py.orig ++++ tests/test_cli.py +@@ -34,7 +34,7 @@ class TestCLI(unittest.TestCase): + 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 @@ class TestCLI(unittest.TestCase): + + 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 @@ class TestCLI(unittest.TestCase): + + E = '“foo” “bar”' + output = self._p([CLI_SCRIPT], T) +- self.assertEquals(output, E) ++ self.assertEqual(output, E) + + E = '"foo" “bar”' + output = self._p([CLI_SCRIPT, '--skip', 'a'], T) +- self.assertEquals(output, E) ++ self.assertEqual(output, E) + + E = '“foo” "bar"' + 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 @@ class TestCLI(unittest.TestCase): + output = self._p([CLI_SCRIPT, F]) + finally: + os.remove(F) +- self.assertEquals(output, E) ++ self.assertEqual(output, E) diff --git a/textproc/py-smartypants/patches/patch-tests_test_py b/textproc/py-smartypants/patches/patch-tests_test_py new file mode 100644 index 00000000000..226fe3d25f0 --- /dev/null +++ b/textproc/py-smartypants/patches/patch-tests_test_py @@ -0,0 +1,26 @@ +From ea46bf36343044a7a61ba3acce4a7f188d986ec5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ond=C5=99ej=20S=C3=BAkup?= +Date: Mon, 25 Sep 2023 10:31:37 +0200 +Subject: [PATCH] Fix regexps and tests for python3.12 + +Index: tests/test.py +--- tests/test.py.orig ++++ tests/test.py +@@ -24,7 +24,7 @@ class SmartyPantsTestCase(unittest.TestCase): + + 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 @@ class SmartyPantsTestCase(unittest.TestCase): + + T = sp(TEXT) + E = '“foo” — bar' +- self.assertEquals(T, E) ++ self.assertEqual(T, E) + + def test_dates(self): +