1 |
commit: 6e1f809fe03d991efebde1c28d2f198ad5c63250 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jun 30 11:24:38 2021 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jun 30 12:21:14 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6e1f809f |
7 |
|
8 |
dev-python/parso: Port to py3.10 |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
dev-python/parso/files/parso-0.8.2-py310.patch | 29 ++++++++++++++++++++++++++ |
13 |
dev-python/parso/parso-0.8.2.ebuild | 18 ++++++++++++++-- |
14 |
2 files changed, 45 insertions(+), 2 deletions(-) |
15 |
|
16 |
diff --git a/dev-python/parso/files/parso-0.8.2-py310.patch b/dev-python/parso/files/parso-0.8.2-py310.patch |
17 |
new file mode 100644 |
18 |
index 00000000000..2f3487dd2f6 |
19 |
--- /dev/null |
20 |
+++ b/dev-python/parso/files/parso-0.8.2-py310.patch |
21 |
@@ -0,0 +1,29 @@ |
22 |
+From cbb61fb81955a8cdbb5cdeedc9bcfffa39a5f270 Mon Sep 17 00:00:00 2001 |
23 |
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@×××××××.cz> |
24 |
+Date: Thu, 22 Apr 2021 21:04:49 +0200 |
25 |
+Subject: [PATCH] Relax a test regex to match new enum repr in Python 3.10.0a7+ |
26 |
+ (#186) |
27 |
+ |
28 |
+bpo-40066: Enum: adjust repr() to show only enum and member name (not value, |
29 |
+nor angle brackets) and str() to show only member name. |
30 |
+https://bugs.python.org/issue40066 |
31 |
+--- |
32 |
+ test/test_pgen2.py | 2 +- |
33 |
+ 1 file changed, 1 insertion(+), 1 deletion(-) |
34 |
+ |
35 |
+diff --git a/test/test_pgen2.py b/test/test_pgen2.py |
36 |
+index 9b0dd34..85ccacf 100644 |
37 |
+--- a/test/test_pgen2.py |
38 |
++++ b/test/test_pgen2.py |
39 |
+@@ -339,7 +339,7 @@ def test_left_recursion(): |
40 |
+ @pytest.mark.parametrize( |
41 |
+ 'grammar, error_match', [ |
42 |
+ ['foo: bar | baz\nbar: NAME\nbaz: NAME\n', |
43 |
+- r"foo is ambiguous.*given a PythonTokenTypes\.NAME.*bar or baz"], |
44 |
++ r"foo is ambiguous.*given a (PythonTokenTypes\.)?NAME.*bar or baz"], |
45 |
+ ['''foo: bar | baz\nbar: 'x'\nbaz: "x"\n''', |
46 |
+ r"foo is ambiguous.*given a ReservedString\(x\).*bar or baz"], |
47 |
+ ['''foo: bar | 'x'\nbar: 'x'\n''', |
48 |
+-- |
49 |
+2.32.0 |
50 |
+ |
51 |
|
52 |
diff --git a/dev-python/parso/parso-0.8.2.ebuild b/dev-python/parso/parso-0.8.2.ebuild |
53 |
index 3ceece3224e..8ab7282e6cf 100644 |
54 |
--- a/dev-python/parso/parso-0.8.2.ebuild |
55 |
+++ b/dev-python/parso/parso-0.8.2.ebuild |
56 |
@@ -1,9 +1,9 @@ |
57 |
# Copyright 1999-2021 Gentoo Authors |
58 |
# Distributed under the terms of the GNU General Public License v2 |
59 |
|
60 |
-EAPI=7 |
61 |
+EAPI=8 |
62 |
|
63 |
-PYTHON_COMPAT=( python3_{7..9} pypy3 ) |
64 |
+PYTHON_COMPAT=( python3_{8..10} pypy3 ) |
65 |
|
66 |
inherit distutils-r1 |
67 |
|
68 |
@@ -17,3 +17,17 @@ KEYWORDS="amd64 ~arm arm64 ~ppc ppc64 ~riscv ~sparc x86" |
69 |
|
70 |
distutils_enable_sphinx docs |
71 |
distutils_enable_tests pytest |
72 |
+ |
73 |
+PATCHES=( |
74 |
+ "${FILESDIR}"/${P}-py310.patch |
75 |
+) |
76 |
+ |
77 |
+python_test() { |
78 |
+ local deselect=() |
79 |
+ [[ ${EPYTHON} == python3.10 ]] && deselect+=( |
80 |
+ # py3.10 changed exception messages |
81 |
+ test/test_python_errors.py::test_python_exception_matches |
82 |
+ test/test_python_errors.py::test_default_except_error_postition |
83 |
+ ) |
84 |
+ epytest ${deselect[@]/#/--deselect } |
85 |
+} |