diff options
author | Andrew Ammerlaan <andrewammerlaan@gentoo.org> | 2022-05-17 13:07:47 +0200 |
---|---|---|
committer | Andrew Ammerlaan <andrewammerlaan@gentoo.org> | 2022-05-17 14:19:16 +0200 |
commit | b1e1319d0b8e430f62e7ba7ae0a92df768a094c7 (patch) | |
tree | f9f9359d78a6a104adbd81a9bad826929290cd20 /dev-python/backrefs | |
parent | sci-physics/bullet: update maintainers (diff) | |
download | gentoo-b1e1319d0b8e430f62e7ba7ae0a92df768a094c7.tar.gz gentoo-b1e1319d0b8e430f62e7ba7ae0a92df768a094c7.tar.bz2 gentoo-b1e1319d0b8e430f62e7ba7ae0a92df768a094c7.zip |
dev-python/backrefs: enable py3.11
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Diffstat (limited to 'dev-python/backrefs')
-rw-r--r-- | dev-python/backrefs/backrefs-5.2.ebuild | 9 | ||||
-rw-r--r-- | dev-python/backrefs/files/backrefs-5.2-fix-regex-unrecognized-escape.patch | 157 |
2 files changed, 164 insertions, 2 deletions
diff --git a/dev-python/backrefs/backrefs-5.2.ebuild b/dev-python/backrefs/backrefs-5.2.ebuild index 4cf190eeb3eb..32541c8b2977 100644 --- a/dev-python/backrefs/backrefs-5.2.ebuild +++ b/dev-python/backrefs/backrefs-5.2.ebuild @@ -1,9 +1,10 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 -PYTHON_COMPAT=( python3_{8..10} ) +PYTHON_COMPAT=( python3_{8..11} ) +DISTUTILS_USE_PEP517=setuptools DOCS_BUILDER="mkdocs" DOCS_DEPEND=" @@ -34,6 +35,10 @@ BDEPEND=" dev-vcs/git )" +PATCHES=( + "${FILESDIR}/${P}-fix-regex-unrecognized-escape.patch" +) + distutils_enable_tests pytest python_prepare_all() { diff --git a/dev-python/backrefs/files/backrefs-5.2-fix-regex-unrecognized-escape.patch b/dev-python/backrefs/files/backrefs-5.2-fix-regex-unrecognized-escape.patch new file mode 100644 index 000000000000..6bb217d1f66e --- /dev/null +++ b/dev-python/backrefs/files/backrefs-5.2-fix-regex-unrecognized-escape.patch @@ -0,0 +1,157 @@ +From 78577debb9127ace54101f77e669d7c674476803 Mon Sep 17 00:00:00 2001 +From: facelessuser <faceless.shop@gmail.com> +Date: Fri, 8 Apr 2022 18:35:00 -0600 +Subject: [PATCH] Fixes for recent regex library handling of unrecognized + escapes + +--- + tests/test_bre.py | 4 +-- + tests/test_bregex.py | 60 +++++++++++++++++++++----------------------- + 2 files changed, 30 insertions(+), 34 deletions(-) + +diff --git a/tests/test_bre.py b/tests/test_bre.py +index d88fe86..64b9a57 100644 +--- a/tests/test_bre.py ++++ b/tests/test_bre.py +@@ -1464,7 +1464,7 @@ def test_escaped_slash_before_backref(self): + + self.assertEqual(r'\\test: \This is a test of escaped slash backrefs!', results) + +- def test_normal_escaping(self): ++ def test_normal_escaping_replace(self): + """Test normal escaped slash.""" + + text = "This is a test of normal escaping!" +@@ -1478,7 +1478,7 @@ def test_normal_escaping(self): + self.assertEqual(results2, results) + self.assertEqual('\t \\t \\\t \\\\t \\\\\t', results) + +- def test_bytes_normal_escaping(self): ++ def test_bytes_normal_escaping_replace(self): + """Test bytes normal escaped slash.""" + + text = b"This is a test of normal escaping!" +diff --git a/tests/test_bregex.py b/tests/test_bregex.py +index 929227a..5a3d0af 100644 +--- a/tests/test_bregex.py ++++ b/tests/test_bregex.py +@@ -801,12 +801,10 @@ def test_bytes_line_break(self): + ) + + def test_line_break_in_group(self): +- """Test that line break in group matches a normal R.""" ++ """Test that line break in group fails.""" + +- self.assertEqual( +- bregex.sub(r"[\R]", 'l', 'Rine\r\nRine\nRine\r'), +- 'line\r\nline\nline\r' +- ) ++ with self.assertRaises(_regex_core.error): ++ bregex.sub(r"[\R]", 'l', 'Rine\r\nRine\nRine\r') + + def test_replace_unicode_name_ascii_range(self): + """Test replacing Unicode names in the ASCII range.""" +@@ -1176,33 +1174,33 @@ def test_escaped_slash_before_backref(self): + + self.assertEqual(r'\\test: \This is a test of escaped slash backrefs!', results) + +- def test_normal_escaping(self): ++ def test_normal_escaping_replace(self): + """Test normal escaped slash.""" + + text = "This is a test of normal escaping!" + pattern = regex.compile(r"(.+)") +- repl_pattern = r'\e \\e \\\e \\\\e \\\\\e' ++ repl_pattern = r'\t \\t \\\t \\\\t \\\\\t' + expand = bregex.compile_replace(pattern, repl_pattern) + m = pattern.match(text) + results = expand(m) + results2 = pattern.sub(repl_pattern, text) + + self.assertEqual(results2, results) +- self.assertEqual('\\e \\e \\\\e \\\\e \\\\\\e', results) ++ self.assertEqual('\t \\t \\\t \\\\t \\\\\t', results) + +- def test_bytes_normal_escaping(self): ++ def test_bytes_normal_escaping_replace(self): + """Test bytes normal escaped slash.""" + + text = b"This is a test of normal escaping!" + pattern = regex.compile(br"(.+)") +- repl_pattern = br'\e \\e \\\e \\\\e \\\\\e' ++ repl_pattern = br'\t \\t \\\t \\\\t \\\\\t' + expand = bregex.compile_replace(pattern, repl_pattern) + m = pattern.match(text) + results = expand(m) + results2 = pattern.sub(repl_pattern, text) + + self.assertEqual(results2, results) +- self.assertEqual(b'\\e \\e \\\\e \\\\e \\\\\\e', results) ++ self.assertEqual(b'\t \\t \\\t \\\\t \\\\\t', results) + + def test_escaped_slash_at_eol(self): + """Test escaped slash at end of line.""" +@@ -1214,15 +1212,12 @@ def test_escaped_slash_at_eol(self): + + self.assertEqual('\\\\', results) + +- def test_unrecognized_backrefs(self): ++ def test_unrecognized_backrefs2(self): + """Test unrecognized backrefs, or literal backslash before a char.""" + +- text = "This is a test of unrecognized backrefs!" + pattern = regex.compile(r"(.+)") +- expand = bregex.compile_replace(pattern, r'\k\1') +- results = expand(pattern.match(text)) +- +- self.assertEqual(r'\kThis is a test of unrecognized backrefs!', results) ++ with self.assertRaises(_regex_core.error): ++ bregex.compile_replace(pattern, r'\k\1') + + def test_ignore_group(self): + """Test that backrefs inserted by matching groups are passed over.""" +@@ -1628,23 +1623,23 @@ def test_dont_case_special_refs(self): + self.assertEqual('\u0108\nWw\u0108', results) + + # Bytes doesn't care about Unicode, but should evaluate bytes +- pattern = regex.compile(b'Test') +- expand = bregex.compile_replace(pattern, br'\C\u0109\n\x77\E\l\x57\c\u0109') +- results = expand(pattern.match(b'Test')) +- self.assertEqual(b'\\U0109\nWw\\u0109', results) ++ # pattern = regex.compile(b'Test') ++ # expand = bregex.compile_replace(pattern, br'\C\u0109\n\x77\E\l\x57\c\u0109') ++ # results = expand(pattern.match(b'Test')) ++ # self.assertEqual(b'\\U0109\nWw\\u0109', results) + +- expandf = bregex.compile_replace(pattern, br'\C\u0109\n\x77\E\l\x57\c\u0109', bregex.FORMAT) +- results = expandf(pattern.match(b'Test')) +- self.assertEqual(b'\\U0109\nWw\\u0109', results) ++ # expandf = bregex.compile_replace(pattern, br'\C\u0109\n\x77\E\l\x57\c\u0109', bregex.FORMAT) ++ # results = expandf(pattern.match(b'Test')) ++ # self.assertEqual(b'\\U0109\nWw\\u0109', results) + +- pattern = regex.compile(b'Test') +- expand = bregex.compile_replace(pattern, br'\C\U00000109\n\x77\E\l\x57\c\U00000109') +- results = expand(pattern.match(b'Test')) +- self.assertEqual(b'\U00000109\nWw\U00000109', results) ++ # pattern = regex.compile(b'Test') ++ # expand = bregex.compile_replace(pattern, br'\C\U00000109\n\x77\E\l\x57\c\U00000109') ++ # results = expand(pattern.match(b'Test')) ++ # self.assertEqual(b'\U00000109\nWw\U00000109', results) + +- expandf = bregex.compile_replace(pattern, br'\C\U00000109\n\x77\E\l\x57\c\U00000109', bregex.FORMAT) +- results = expandf(pattern.match(b'Test')) +- self.assertEqual(b'\U00000109\nWw\U00000109', results) ++ # expandf = bregex.compile_replace(pattern, br'\C\U00000109\n\x77\E\l\x57\c\U00000109', bregex.FORMAT) ++ # results = expandf(pattern.match(b'Test')) ++ # self.assertEqual(b'\U00000109\nWw\U00000109', results) + + # Format doesn't care about groups + pattern = regex.compile('Test') +@@ -2184,4 +2179,5 @@ def test_auto_compile_off(self): + replace = p.compile(r'{1}', bregex.FORMAT) + self.assertEqual(p.subf(replace, 'tests'), 'test') + +- self.assertEqual(p.sub(r'\ltest', 'tests'), r'\ltest') ++ with self.assertRaises(_regex_core.error): ++ self.assertEqual(p.sub(r'\ltest', 'tests'), r'\ltest') |