Gentoo Archives: gentoo-commits

From: Patrick McLean <chutzpah@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pyflakes/files/, dev-python/pyflakes/
Date: Fri, 29 Nov 2019 19:56:29
Message-Id: 1575057378.3bad779f43274c480b0433cb8514c01a471370eb.chutzpah@gentoo
1 commit: 3bad779f43274c480b0433cb8514c01a471370eb
2 Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
3 AuthorDate: Fri Nov 29 01:02:17 2019 +0000
4 Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
5 CommitDate: Fri Nov 29 19:56:18 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3bad779f
7
8 dev-python/pyflakes-2.1.1: bump, add py38
9
10 Package-Manager: Portage-2.3.80, Repoman-2.3.19
11 Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
12
13 dev-python/pyflakes/Manifest | 1 +
14 .../pyflakes/files/pyflakes-2.1.1-py38.patch | 42 +++++
15 .../pyflakes/files/pyflakes-2.1.1-tests.patch | 207 +++++++++++++++++++++
16 dev-python/pyflakes/pyflakes-2.1.1.ebuild | 25 +++
17 4 files changed, 275 insertions(+)
18
19 diff --git a/dev-python/pyflakes/Manifest b/dev-python/pyflakes/Manifest
20 index 71ef0fbef3a..36f7f86dfd0 100644
21 --- a/dev-python/pyflakes/Manifest
22 +++ b/dev-python/pyflakes/Manifest
23 @@ -3,3 +3,4 @@ DIST pyflakes-1.0.0.tar.gz 35365 BLAKE2B 7b0f676fcb1f77f85a4fa85f02dd26f181f7d80
24 DIST pyflakes-1.2.3.tar.gz 44776 BLAKE2B 9effec80b58ebac140a6a8b2f5f31a32c4fdf9e842d3fbd2858a3e74f33920925f10b6377300d962d1e2b1931efe8bb5318b97ef51c99aeb003a3434d08810db SHA512 e0b49b4cd388b39c4f4f5ab836520cfc2ee940ce24de084fbeca0a2f13beca23b3ca89741e297a6f450d211ec27ebd91a7d23a80105e50d14960a3888d7693f2
25 DIST pyflakes-1.6.0.tar.gz 48184 BLAKE2B a5762c23521aa68ea92537fbc2903bb7af64faf8d1fafc97e48e003f529f8c16ae8dca444c9122fc5c50618fec7120b2f2b2e6682e1d86e502ab49096cb42bfc SHA512 7e9c2aad6ebed638a1354cef51c7e1f68b25e59f8caf4694997a9afecd7cd8baa629a9363297ac0d961430f007fd22dcae7dae1bcbd7838a3b5d4285063bc7c5
26 DIST pyflakes-2.0.0.tar.gz 49002 BLAKE2B 146d1108b7cf9aca3316d33ad2ac3a0d1627af525b5def8c6140787fb4d1f47bb45c3c9ec9cb755e51e7ca4e947346e5e9de9b4a1b461389ff1bc4521371a684 SHA512 4961ebb8372f51783416681e79342d6be94318ecd007190e5c27f46c48f8f163c7a5f49cbe3025789ff1d9cd37c465b2f3baa219059779163545f9828a766f71
27 +DIST pyflakes-2.1.1.tar.gz 58072 BLAKE2B 68dccddae2a9dc77f2d1f1251c80e2552935281b6b79e55fd2a0805cb30bf5e1c227b60a7e1f55f5f92ac42dfd18a69eb0b76ce06f43ac1c48dde3921817a271 SHA512 7ebf5843b38146305c1063e070480fea8ec3b47fa1be546b1fafaeb242a688a5a001f978e7257fd71d5905b9a338b466ef17c7330725191587e9c40ba632c3f8
28
29 diff --git a/dev-python/pyflakes/files/pyflakes-2.1.1-py38.patch b/dev-python/pyflakes/files/pyflakes-2.1.1-py38.patch
30 new file mode 100644
31 index 00000000000..f9f00b895f5
32 --- /dev/null
33 +++ b/dev-python/pyflakes/files/pyflakes-2.1.1-py38.patch
34 @@ -0,0 +1,42 @@
35 +commit 1911c203a13826d2eb03d582d60874b91e36f4fc
36 +Author: Batuhan Taşkaya <47358913+isidentical@××××××××××××××××××××.com>
37 +Date: Sun Nov 3 22:51:27 2019 +0300
38 +
39 + Allow continue inside finally in 3.8+ (#476)
40 +
41 +diff --git a/pyflakes/checker.py b/pyflakes/checker.py
42 +index eca2002..c8ccf56 100644
43 +--- a/pyflakes/checker.py
44 ++++ b/pyflakes/checker.py
45 +@@ -1738,7 +1738,7 @@ class Checker(object):
46 + break
47 + # Handle Try/TryFinally difference in Python < and >= 3.3
48 + if hasattr(n, 'finalbody') and isinstance(node, ast.Continue):
49 +- if n_child in n.finalbody:
50 ++ if n_child in n.finalbody and not PY38_PLUS:
51 + self.report(messages.ContinueInFinally, node)
52 + return
53 + if isinstance(node, ast.Continue):
54 +diff --git a/pyflakes/test/test_other.py b/pyflakes/test/test_other.py
55 +index df2f790..282accb 100644
56 +--- a/pyflakes/test/test_other.py
57 ++++ b/pyflakes/test/test_other.py
58 +@@ -493,8 +493,10 @@ class Test(TestCase):
59 + continue
60 + ''')
61 +
62 ++ @skipIf(version_info > (3, 8), "Python <= 3.8 only")
63 + def test_continueInFinally(self):
64 + # 'continue' inside 'finally' is a special syntax error
65 ++ # that is removed in 3.8
66 + self.flakes('''
67 + while True:
68 + try:
69 +@@ -2003,6 +2005,7 @@ class TestAsyncStatements(TestCase):
70 + ''', m.BreakOutsideLoop)
71 +
72 + @skipIf(version_info < (3, 5), 'new in Python 3.5')
73 ++ @skipIf(version_info > (3, 8), "Python <= 3.8 only")
74 + def test_continueInAsyncForFinally(self):
75 + self.flakes('''
76 + async def read_data(db):
77
78 diff --git a/dev-python/pyflakes/files/pyflakes-2.1.1-tests.patch b/dev-python/pyflakes/files/pyflakes-2.1.1-tests.patch
79 new file mode 100644
80 index 00000000000..5e1a445e161
81 --- /dev/null
82 +++ b/dev-python/pyflakes/files/pyflakes-2.1.1-tests.patch
83 @@ -0,0 +1,207 @@
84 +diff --git a/pyflakes/test/test_api.py b/pyflakes/test/test_api.py
85 +index ee205f9..e295bd9 100644
86 +--- a/pyflakes/test/test_api.py
87 ++++ b/pyflakes/test/test_api.py
88 +@@ -9,7 +9,6 @@ import shutil
89 + import subprocess
90 + import tempfile
91 +
92 +-from pyflakes.checker import PY2
93 + from pyflakes.messages import UnusedImport
94 + from pyflakes.reporter import Reporter
95 + from pyflakes.api import (
96 +@@ -423,7 +422,7 @@ def baz():
97 +
98 + with self.makeTempFile(source) as sourcePath:
99 + if PYPY:
100 +- message = 'EOF while scanning triple-quoted string literal'
101 ++ message = 'end of file (EOF) while scanning triple-quoted string literal'
102 + else:
103 + message = 'invalid syntax'
104 +
105 +@@ -465,8 +464,8 @@ def foo(
106 + syntax error reflects the cause for the syntax error.
107 + """
108 + with self.makeTempFile("if True:\n\tfoo =") as sourcePath:
109 +- column = 5 if PYPY else 7
110 +- last_line = '\t ^' if PYPY else '\t ^'
111 ++ column = 6 if PYPY else 7
112 ++ last_line = '\t ^' if PYPY else '\t ^'
113 +
114 + self.assertHasErrors(
115 + sourcePath,
116 +@@ -476,6 +475,7 @@ def foo(
117 + %s
118 + """ % (sourcePath, column, last_line)])
119 +
120 ++ @skipIf(PYPY, "Broken on pypy")
121 + def test_nonDefaultFollowsDefaultSyntaxError(self):
122 + """
123 + Source which has a non-default argument following a default argument
124 +@@ -488,7 +488,12 @@ def foo(bar=baz, bax):
125 + """
126 + with self.makeTempFile(source) as sourcePath:
127 + if ERROR_HAS_LAST_LINE:
128 +- column = 9 if sys.version_info >= (3, 8) else 8
129 ++ if PYPY and sys.version_info >= (3,):
130 ++ column = 7
131 ++ elif sys.version_info >= (3, 8):
132 ++ column = 9
133 ++ else:
134 ++ column = 8
135 + last_line = ' ' * (column - 1) + '^\n'
136 + columnstr = '%d:' % column
137 + else:
138 +@@ -500,6 +505,7 @@ def foo(bar=baz, bax):
139 + def foo(bar=baz, bax):
140 + %s""" % (sourcePath, columnstr, last_line)])
141 +
142 ++ @skipIf(PYPY, "Broken on pypy")
143 + def test_nonKeywordAfterKeywordSyntaxError(self):
144 + """
145 + Source which has a non-keyword argument after a keyword argument should
146 +@@ -511,7 +517,12 @@ foo(bar=baz, bax)
147 + """
148 + with self.makeTempFile(source) as sourcePath:
149 + if ERROR_HAS_LAST_LINE:
150 +- column = 14 if sys.version_info >= (3, 8) else 13
151 ++ if PYPY and sys.version_info >= (3,):
152 ++ column = 12
153 ++ elif sys.version_info >= (3, 8):
154 ++ column = 14
155 ++ else:
156 ++ column = 13
157 + last_line = ' ' * (column - 1) + '^\n'
158 + columnstr = '%d:' % column
159 + else:
160 +@@ -529,6 +540,7 @@ foo(bar=baz, bax)
161 + foo(bar=baz, bax)
162 + %s""" % (sourcePath, columnstr, message, last_line)])
163 +
164 ++ @skipIf(PYPY and sys.hexversion < 0x3080000, "broken on pypy3")
165 + def test_invalidEscape(self):
166 + """
167 + The invalid escape syntax raises ValueError in Python 2
168 +@@ -681,6 +693,12 @@ class IntegrationTests(TestCase):
169 + Tests of the pyflakes script that actually spawn the script.
170 + """
171 +
172 ++ # https://bitbucket.org/pypy/pypy/issues/3069/pypy36-on-windows-incorrect-line-separator
173 ++ if PYPY and sys.version_info >= (3,) and WIN:
174 ++ LINESEP = '\n'
175 ++ else:
176 ++ LINESEP = os.linesep
177 ++
178 + def setUp(self):
179 + self.tempdir = tempfile.mkdtemp()
180 + self.tempfilepath = os.path.join(self.tempdir, 'temp')
181 +@@ -721,9 +739,6 @@ class IntegrationTests(TestCase):
182 + if sys.version_info >= (3,):
183 + stdout = stdout.decode('utf-8')
184 + stderr = stderr.decode('utf-8')
185 +- # Workaround https://bitbucket.org/pypy/pypy/issues/2350
186 +- if PYPY and PY2 and WIN:
187 +- stderr = stderr.replace('\r\r\n', '\r\n')
188 + return (stdout, stderr, rv)
189 +
190 + def test_goodFile(self):
191 +@@ -744,7 +759,7 @@ class IntegrationTests(TestCase):
192 + fd.write("import contraband\n".encode('ascii'))
193 + d = self.runPyflakes([self.tempfilepath])
194 + expected = UnusedImport(self.tempfilepath, Node(1), 'contraband')
195 +- self.assertEqual(d, ("%s%s" % (expected, os.linesep), '', 1))
196 ++ self.assertEqual(d, ("%s%s" % (expected, self.LINESEP), '', 1))
197 +
198 + def test_errors_io(self):
199 + """
200 +@@ -754,7 +769,7 @@ class IntegrationTests(TestCase):
201 + """
202 + d = self.runPyflakes([self.tempfilepath])
203 + error_msg = '%s: No such file or directory%s' % (self.tempfilepath,
204 +- os.linesep)
205 ++ self.LINESEP)
206 + self.assertEqual(d, ('', error_msg, 1))
207 +
208 + def test_errors_syntax(self):
209 +@@ -766,8 +781,8 @@ class IntegrationTests(TestCase):
210 + with open(self.tempfilepath, 'wb') as fd:
211 + fd.write("import".encode('ascii'))
212 + d = self.runPyflakes([self.tempfilepath])
213 +- error_msg = '{0}:1:{2}: invalid syntax{1}import{1} {3}^{1}'.format(
214 +- self.tempfilepath, os.linesep, 5 if PYPY else 7, '' if PYPY else ' ')
215 ++ error_msg = '{0}:1:{2}: invalid syntax{1}import{1} {3}^{1}'.format(
216 ++ self.tempfilepath, self.LINESEP, 6 if PYPY else 7, '' if PYPY else ' ')
217 + self.assertEqual(d, ('', error_msg, 1))
218 +
219 + def test_readFromStdin(self):
220 +@@ -776,13 +791,14 @@ class IntegrationTests(TestCase):
221 + """
222 + d = self.runPyflakes([], stdin='import contraband')
223 + expected = UnusedImport('<stdin>', Node(1), 'contraband')
224 +- self.assertEqual(d, ("%s%s" % (expected, os.linesep), '', 1))
225 ++ self.assertEqual(d, ("%s%s" % (expected, self.LINESEP), '', 1))
226 +
227 +
228 + class TestMain(IntegrationTests):
229 + """
230 + Tests of the pyflakes main function.
231 + """
232 ++ LINESEP = os.linesep
233 +
234 + def runPyflakes(self, paths, stdin=None):
235 + try:
236 +diff --git a/pyflakes/test/test_doctests.py b/pyflakes/test/test_doctests.py
237 +index 0825ffe..a474bb1 100644
238 +--- a/pyflakes/test/test_doctests.py
239 ++++ b/pyflakes/test/test_doctests.py
240 +@@ -328,7 +328,9 @@ class Test(TestCase):
241 + m.DoctestSyntaxError).messages
242 + exc = exceptions[0]
243 + self.assertEqual(exc.lineno, 4)
244 +- if sys.version_info >= (3, 8):
245 ++ if PYPY:
246 ++ self.assertEqual(exc.col, 27)
247 ++ elif sys.version_info >= (3, 8):
248 + self.assertEqual(exc.col, 18)
249 + else:
250 + self.assertEqual(exc.col, 26)
251 +@@ -339,12 +341,14 @@ class Test(TestCase):
252 + exc = exceptions[1]
253 + self.assertEqual(exc.lineno, 5)
254 + if PYPY:
255 +- self.assertEqual(exc.col, 13)
256 ++ self.assertEqual(exc.col, 14)
257 + else:
258 + self.assertEqual(exc.col, 16)
259 + exc = exceptions[2]
260 + self.assertEqual(exc.lineno, 6)
261 +- if PYPY or sys.version_info >= (3, 8):
262 ++ if PYPY:
263 ++ self.assertEqual(exc.col, 14)
264 ++ elif sys.version_info >= (3, 8):
265 + self.assertEqual(exc.col, 13)
266 + else:
267 + self.assertEqual(exc.col, 18)
268 +@@ -358,7 +362,9 @@ class Test(TestCase):
269 + """
270 + ''', m.DoctestSyntaxError).messages[0]
271 + self.assertEqual(exc.lineno, 5)
272 +- if PYPY or sys.version_info >= (3, 8):
273 ++ if PYPY:
274 ++ self.assertEqual(exc.col, 14)
275 ++ elif sys.version_info >= (3, 8):
276 + self.assertEqual(exc.col, 13)
277 + else:
278 + self.assertEqual(exc.col, 16)
279 +@@ -377,7 +383,10 @@ class Test(TestCase):
280 + m.DoctestSyntaxError,
281 + m.UndefinedName).messages
282 + self.assertEqual(exc1.lineno, 6)
283 +- self.assertEqual(exc1.col, 19)
284 ++ if PYPY:
285 ++ self.assertEqual(exc1.col, 20)
286 ++ else:
287 ++ self.assertEqual(exc1.col, 19)
288 + self.assertEqual(exc2.lineno, 7)
289 + self.assertEqual(exc2.col, 12)
290 +
291
292 diff --git a/dev-python/pyflakes/pyflakes-2.1.1.ebuild b/dev-python/pyflakes/pyflakes-2.1.1.ebuild
293 new file mode 100644
294 index 00000000000..f6e2a0f4ae2
295 --- /dev/null
296 +++ b/dev-python/pyflakes/pyflakes-2.1.1.ebuild
297 @@ -0,0 +1,25 @@
298 +# Copyright 1999-2019 Gentoo Authors
299 +# Distributed under the terms of the GNU General Public License v2
300 +
301 +EAPI=7
302 +PYTHON_COMPAT=( python2_7 python3_{5,6,7,8} pypy{,3} )
303 +
304 +inherit distutils-r1
305 +
306 +DESCRIPTION="Passive checker for Python programs"
307 +HOMEPAGE="https://github.com/PyCQA/pyflakes https://pypi.org/project/pyflakes/"
308 +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
309 +
310 +LICENSE="MIT"
311 +SLOT="0"
312 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
313 +
314 +BDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
315 +RDEPEND="${BDEPEND}"
316 +
317 +PATCHES=(
318 + "${FILESDIR}/pyflakes-2.1.1-tests.patch"
319 + "${FILESDIR}/pyflakes-2.1.1-py38.patch"
320 +)
321 +
322 +distutils_enable_tests unittest