summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2021-06-30 13:24:38 +0200
committerMichał Górny <mgorny@gentoo.org>2021-06-30 14:21:14 +0200
commit6e1f809fe03d991efebde1c28d2f198ad5c63250 (patch)
treeb1ca8311b411c21e98b02cf030085d16ffb13c34 /dev-python/parso
parentnet-analyzer/zabbix: bump to 4.0.32 (diff)
downloadgentoo-6e1f809fe03d991efebde1c28d2f198ad5c63250.tar.gz
gentoo-6e1f809fe03d991efebde1c28d2f198ad5c63250.tar.bz2
gentoo-6e1f809fe03d991efebde1c28d2f198ad5c63250.zip
dev-python/parso: Port to py3.10
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/parso')
-rw-r--r--dev-python/parso/files/parso-0.8.2-py310.patch29
-rw-r--r--dev-python/parso/parso-0.8.2.ebuild18
2 files changed, 45 insertions, 2 deletions
diff --git a/dev-python/parso/files/parso-0.8.2-py310.patch b/dev-python/parso/files/parso-0.8.2-py310.patch
new file mode 100644
index 000000000000..2f3487dd2f61
--- /dev/null
+++ b/dev-python/parso/files/parso-0.8.2-py310.patch
@@ -0,0 +1,29 @@
+From cbb61fb81955a8cdbb5cdeedc9bcfffa39a5f270 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
+Date: Thu, 22 Apr 2021 21:04:49 +0200
+Subject: [PATCH] Relax a test regex to match new enum repr in Python 3.10.0a7+
+ (#186)
+
+bpo-40066: Enum: adjust repr() to show only enum and member name (not value,
+nor angle brackets) and str() to show only member name.
+https://bugs.python.org/issue40066
+---
+ test/test_pgen2.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/test/test_pgen2.py b/test/test_pgen2.py
+index 9b0dd34..85ccacf 100644
+--- a/test/test_pgen2.py
++++ b/test/test_pgen2.py
+@@ -339,7 +339,7 @@ def test_left_recursion():
+ @pytest.mark.parametrize(
+ 'grammar, error_match', [
+ ['foo: bar | baz\nbar: NAME\nbaz: NAME\n',
+- r"foo is ambiguous.*given a PythonTokenTypes\.NAME.*bar or baz"],
++ r"foo is ambiguous.*given a (PythonTokenTypes\.)?NAME.*bar or baz"],
+ ['''foo: bar | baz\nbar: 'x'\nbaz: "x"\n''',
+ r"foo is ambiguous.*given a ReservedString\(x\).*bar or baz"],
+ ['''foo: bar | 'x'\nbar: 'x'\n''',
+--
+2.32.0
+
diff --git a/dev-python/parso/parso-0.8.2.ebuild b/dev-python/parso/parso-0.8.2.ebuild
index 3ceece3224e7..8ab7282e6cfc 100644
--- a/dev-python/parso/parso-0.8.2.ebuild
+++ b/dev-python/parso/parso-0.8.2.ebuild
@@ -1,9 +1,9 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI=7
+EAPI=8
-PYTHON_COMPAT=( python3_{7..9} pypy3 )
+PYTHON_COMPAT=( python3_{8..10} pypy3 )
inherit distutils-r1
@@ -17,3 +17,17 @@ KEYWORDS="amd64 ~arm arm64 ~ppc ppc64 ~riscv ~sparc x86"
distutils_enable_sphinx docs
distutils_enable_tests pytest
+
+PATCHES=(
+ "${FILESDIR}"/${P}-py310.patch
+)
+
+python_test() {
+ local deselect=()
+ [[ ${EPYTHON} == python3.10 ]] && deselect+=(
+ # py3.10 changed exception messages
+ test/test_python_errors.py::test_python_exception_matches
+ test/test_python_errors.py::test_default_except_error_postition
+ )
+ epytest ${deselect[@]/#/--deselect }
+}