commit:     3ca6c4f0c9e645c6de2bda436cc898a3f0539c55
Author:     Zamarin Arthur <arthurzam <AT> gmail <DOT> com>
AuthorDate: Tue May 25 13:49:14 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue May 25 16:04:57 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ca6c4f0

dev-python/pyflakes: bump to python 3.10

passes tests

Signed-off-by: Zamarin Arthur <arthurzam <AT> gmail.com>
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../files/pyflakes-2.3.1-fix-py3.10-tests.patch    | 91 ++++++++++++++++++++++
 dev-python/pyflakes/pyflakes-2.3.1.ebuild          |  6 +-
 2 files changed, 96 insertions(+), 1 deletion(-)

diff --git a/dev-python/pyflakes/files/pyflakes-2.3.1-fix-py3.10-tests.patch 
b/dev-python/pyflakes/files/pyflakes-2.3.1-fix-py3.10-tests.patch
new file mode 100644
index 00000000000..c96585d20c7
--- /dev/null
+++ b/dev-python/pyflakes/files/pyflakes-2.3.1-fix-py3.10-tests.patch
@@ -0,0 +1,91 @@
+From f3b1b44bf3d2d5927004fa1c2fcf1ab2def816b9 Mon Sep 17 00:00:00 2001
+From: Anthony Sottile <[email protected]>
+Date: Thu, 20 May 2021 07:23:19 -0700
+Subject: [PATCH] fix syntax error offsets for python 3.10 (#635)
+
+---
+ .github/workflows/test.yml |  2 +-
+ pyflakes/test/test_api.py  | 43 +++++++++++++++++++++++++-------------
+ tox.ini                    |  2 +-
+ 3 files changed, 30 insertions(+), 17 deletions(-)
+
+diff --git a/pyflakes/test/test_api.py b/pyflakes/test/test_api.py
+index d379b3b7..2c1cf19d 100644
+--- a/pyflakes/test/test_api.py
++++ b/pyflakes/test/test_api.py
+@@ -441,7 +441,7 @@ def evaluate(source):
+             evaluate(source)
+         except SyntaxError:
+             e = sys.exc_info()[1]
+-            if not PYPY:
++            if not PYPY and sys.version_info < (3, 10):
+                 self.assertTrue(e.text.count('\n') > 1)
+         else:
+             self.fail()
+@@ -449,10 +449,17 @@ def evaluate(source):
+         with self.makeTempFile(source) as sourcePath:
+             if PYPY:
+                 message = 'end of file (EOF) while scanning triple-quoted 
string literal'
++            elif sys.version_info >= (3, 10):
++                message = 'unterminated triple-quoted string literal 
(detected at line 8)'  # noqa: E501
+             else:
+                 message = 'invalid syntax'
+ 
+-            column = 8 if sys.version_info >= (3, 8) else 11
++            if sys.version_info >= (3, 10):
++                column = 12
++            elif sys.version_info >= (3, 8):
++                column = 8
++            else:
++                column = 11
+             self.assertHasErrors(
+                 sourcePath,
+                 ["""\
+@@ -468,21 +475,25 @@ def test_eofSyntaxError(self):
+         """
+         with self.makeTempFile("def foo(") as sourcePath:
+             if PYPY:
+-                result = """\
+-%s:1:7: parenthesis is never closed
+-def foo(
+-      ^
+-""" % (sourcePath,)
++                msg = 'parenthesis is never closed'
++            elif sys.version_info >= (3, 10):
++                msg = "'(' was never closed"
+             else:
+-                result = """\
+-%s:1:9: unexpected EOF while parsing
+-def foo(
+-        ^
+-""" % (sourcePath,)
++                msg = 'unexpected EOF while parsing'
+ 
+-            self.assertHasErrors(
+-                sourcePath,
+-                [result])
++            if PYPY:
++                column = 7
++            elif sys.version_info >= (3, 10):
++                column = 8
++            else:
++                column = 9
++
++            spaces = ' ' * (column - 1)
++            expected = '{}:1:{}: {}\ndef foo(\n{}^\n'.format(
++                sourcePath, column, msg, spaces
++            )
++
++            self.assertHasErrors(sourcePath, [expected])
+ 
+     def test_eofSyntaxErrorWithTab(self):
+         """
+@@ -515,6 +526,8 @@ def foo(bar=baz, bax):
+             if ERROR_HAS_LAST_LINE:
+                 if PYPY:
+                     column = 7
++                elif sys.version_info >= (3, 10):
++                    column = 18
+                 elif sys.version_info >= (3, 9):
+                     column = 21
+                 elif sys.version_info >= (3, 8):

diff --git a/dev-python/pyflakes/pyflakes-2.3.1.ebuild 
b/dev-python/pyflakes/pyflakes-2.3.1.ebuild
index 454409b0717..a556099613d 100644
--- a/dev-python/pyflakes/pyflakes-2.3.1.ebuild
+++ b/dev-python/pyflakes/pyflakes-2.3.1.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( pypy3 python3_{7..9} )
+PYTHON_COMPAT=( pypy3 python3_{7..10} )
 # Uses pkg_resources
 DISTUTILS_USE_SETUPTOOLS=rdepend
 
@@ -17,4 +17,8 @@ LICENSE="MIT"
 SLOT="0"
 KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~mips ppc ppc64 ~s390 sparc x86 
~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris 
~x64-solaris ~x86-solaris"
 
+PATCHES=(
+       "${FILESDIR}/${P}-fix-py3.10-tests.patch"
+)
+
 distutils_enable_tests unittest

Reply via email to