1 |
commit: 3ca6c4f0c9e645c6de2bda436cc898a3f0539c55 |
2 |
Author: Zamarin Arthur <arthurzam <AT> gmail <DOT> com> |
3 |
AuthorDate: Tue May 25 13:49:14 2021 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue May 25 16:04:57 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ca6c4f0 |
7 |
|
8 |
dev-python/pyflakes: bump to python 3.10 |
9 |
|
10 |
passes tests |
11 |
|
12 |
Signed-off-by: Zamarin Arthur <arthurzam <AT> gmail.com> |
13 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
14 |
|
15 |
.../files/pyflakes-2.3.1-fix-py3.10-tests.patch | 91 ++++++++++++++++++++++ |
16 |
dev-python/pyflakes/pyflakes-2.3.1.ebuild | 6 +- |
17 |
2 files changed, 96 insertions(+), 1 deletion(-) |
18 |
|
19 |
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 |
20 |
new file mode 100644 |
21 |
index 00000000000..c96585d20c7 |
22 |
--- /dev/null |
23 |
+++ b/dev-python/pyflakes/files/pyflakes-2.3.1-fix-py3.10-tests.patch |
24 |
@@ -0,0 +1,91 @@ |
25 |
+From f3b1b44bf3d2d5927004fa1c2fcf1ab2def816b9 Mon Sep 17 00:00:00 2001 |
26 |
+From: Anthony Sottile <asottile@×××××.edu> |
27 |
+Date: Thu, 20 May 2021 07:23:19 -0700 |
28 |
+Subject: [PATCH] fix syntax error offsets for python 3.10 (#635) |
29 |
+ |
30 |
+--- |
31 |
+ .github/workflows/test.yml | 2 +- |
32 |
+ pyflakes/test/test_api.py | 43 +++++++++++++++++++++++++------------- |
33 |
+ tox.ini | 2 +- |
34 |
+ 3 files changed, 30 insertions(+), 17 deletions(-) |
35 |
+ |
36 |
+diff --git a/pyflakes/test/test_api.py b/pyflakes/test/test_api.py |
37 |
+index d379b3b7..2c1cf19d 100644 |
38 |
+--- a/pyflakes/test/test_api.py |
39 |
++++ b/pyflakes/test/test_api.py |
40 |
+@@ -441,7 +441,7 @@ def evaluate(source): |
41 |
+ evaluate(source) |
42 |
+ except SyntaxError: |
43 |
+ e = sys.exc_info()[1] |
44 |
+- if not PYPY: |
45 |
++ if not PYPY and sys.version_info < (3, 10): |
46 |
+ self.assertTrue(e.text.count('\n') > 1) |
47 |
+ else: |
48 |
+ self.fail() |
49 |
+@@ -449,10 +449,17 @@ def evaluate(source): |
50 |
+ with self.makeTempFile(source) as sourcePath: |
51 |
+ if PYPY: |
52 |
+ message = 'end of file (EOF) while scanning triple-quoted string literal' |
53 |
++ elif sys.version_info >= (3, 10): |
54 |
++ message = 'unterminated triple-quoted string literal (detected at line 8)' # noqa: E501 |
55 |
+ else: |
56 |
+ message = 'invalid syntax' |
57 |
+ |
58 |
+- column = 8 if sys.version_info >= (3, 8) else 11 |
59 |
++ if sys.version_info >= (3, 10): |
60 |
++ column = 12 |
61 |
++ elif sys.version_info >= (3, 8): |
62 |
++ column = 8 |
63 |
++ else: |
64 |
++ column = 11 |
65 |
+ self.assertHasErrors( |
66 |
+ sourcePath, |
67 |
+ ["""\ |
68 |
+@@ -468,21 +475,25 @@ def test_eofSyntaxError(self): |
69 |
+ """ |
70 |
+ with self.makeTempFile("def foo(") as sourcePath: |
71 |
+ if PYPY: |
72 |
+- result = """\ |
73 |
+-%s:1:7: parenthesis is never closed |
74 |
+-def foo( |
75 |
+- ^ |
76 |
+-""" % (sourcePath,) |
77 |
++ msg = 'parenthesis is never closed' |
78 |
++ elif sys.version_info >= (3, 10): |
79 |
++ msg = "'(' was never closed" |
80 |
+ else: |
81 |
+- result = """\ |
82 |
+-%s:1:9: unexpected EOF while parsing |
83 |
+-def foo( |
84 |
+- ^ |
85 |
+-""" % (sourcePath,) |
86 |
++ msg = 'unexpected EOF while parsing' |
87 |
+ |
88 |
+- self.assertHasErrors( |
89 |
+- sourcePath, |
90 |
+- [result]) |
91 |
++ if PYPY: |
92 |
++ column = 7 |
93 |
++ elif sys.version_info >= (3, 10): |
94 |
++ column = 8 |
95 |
++ else: |
96 |
++ column = 9 |
97 |
++ |
98 |
++ spaces = ' ' * (column - 1) |
99 |
++ expected = '{}:1:{}: {}\ndef foo(\n{}^\n'.format( |
100 |
++ sourcePath, column, msg, spaces |
101 |
++ ) |
102 |
++ |
103 |
++ self.assertHasErrors(sourcePath, [expected]) |
104 |
+ |
105 |
+ def test_eofSyntaxErrorWithTab(self): |
106 |
+ """ |
107 |
+@@ -515,6 +526,8 @@ def foo(bar=baz, bax): |
108 |
+ if ERROR_HAS_LAST_LINE: |
109 |
+ if PYPY: |
110 |
+ column = 7 |
111 |
++ elif sys.version_info >= (3, 10): |
112 |
++ column = 18 |
113 |
+ elif sys.version_info >= (3, 9): |
114 |
+ column = 21 |
115 |
+ elif sys.version_info >= (3, 8): |
116 |
|
117 |
diff --git a/dev-python/pyflakes/pyflakes-2.3.1.ebuild b/dev-python/pyflakes/pyflakes-2.3.1.ebuild |
118 |
index 454409b0717..a556099613d 100644 |
119 |
--- a/dev-python/pyflakes/pyflakes-2.3.1.ebuild |
120 |
+++ b/dev-python/pyflakes/pyflakes-2.3.1.ebuild |
121 |
@@ -3,7 +3,7 @@ |
122 |
|
123 |
EAPI=7 |
124 |
|
125 |
-PYTHON_COMPAT=( pypy3 python3_{7..9} ) |
126 |
+PYTHON_COMPAT=( pypy3 python3_{7..10} ) |
127 |
# Uses pkg_resources |
128 |
DISTUTILS_USE_SETUPTOOLS=rdepend |
129 |
|
130 |
@@ -17,4 +17,8 @@ LICENSE="MIT" |
131 |
SLOT="0" |
132 |
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" |
133 |
|
134 |
+PATCHES=( |
135 |
+ "${FILESDIR}/${P}-fix-py3.10-tests.patch" |
136 |
+) |
137 |
+ |
138 |
distutils_enable_tests unittest |