summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dev-python/pyflakes/Manifest3
-rw-r--r--dev-python/pyflakes/files/1.0.0-fix-pypy-tests.patch282
-rw-r--r--dev-python/pyflakes/pyflakes-0.7.3.ebuild26
-rw-r--r--dev-python/pyflakes/pyflakes-1.0.0.ebuild (renamed from dev-python/pyflakes/pyflakes-0.9.2.ebuild)4
4 files changed, 286 insertions, 29 deletions
diff --git a/dev-python/pyflakes/Manifest b/dev-python/pyflakes/Manifest
index 66508b072d73..07ee9f4773e2 100644
--- a/dev-python/pyflakes/Manifest
+++ b/dev-python/pyflakes/Manifest
@@ -1,4 +1,3 @@
DIST pyflakes-0.7.2.tar.gz 30107 SHA256 e971804569e26a120ded70ca94882cbbf360390538fc3b5861f8ccecaf291178 SHA512 9f50c78ae47f55e30ed264b351325321f6c5d889ca6b2c7509d6c5cb029e27c230849cecc729bb18664cc2eb3d003a38a2e7a20f48563b6fa72c621a783bea64 WHIRLPOOL b23d09999a550784769444fdb1f3592dd54b1938b73e1ec40951eab5d3fad3dc80c0c79fbaa31e1544d74b5c8bcd96ca2f01ee83e0e79d8bfb6228308c20ae4c
-DIST pyflakes-0.7.3.tar.gz 30551 SHA256 dbd2c940a1030a4f811afc1a04017a44011c0cb54f8f384b66aa624097d9b5e3 SHA512 a77fc6a1ca1bdb8aaf31e3653389c7c9357433b8b64dbd3104068a4ce900a019d3dbba5bd23c313fc70398f6f2767a3639cf7b915d3edbc1e1d1e1a03932729d WHIRLPOOL 3ff8aa922f14676a530d51c9114cf7751c23cf92e6d3f88da263b1747343b9fba02f0f2a72123046206a4d22c734cc3f4296f70016d6a51b5ac599bc4bd29345
DIST pyflakes-0.8.1.tar.gz 32981 SHA256 3fa80a10b36d51686bf7744f5dc99622cd5c98ce8ed64022e629868aafc17769 SHA512 b9843637891f3e82a8430121395ceb4ec5df48b5ba73b96a307ebcb4a393e8cebee1681e094ee1f71a85b58bd2f32562b78fbd61d3fa85634f3ac448b1244637 WHIRLPOOL 0939b6ded3659e53316e6707ca5bf57a6702073c376df611a6a473c43ada36ee8822c9bbf2e106cc1836b46f04ce90612f4ebc73c6cb2d557aa6edb89d0eb949
-DIST pyflakes-0.9.2.tar.gz 34785 SHA256 02691c23ce699f252874b7c27f14cf26e3d4e82b58e5d584f000b7ab5be36a5f SHA512 f412ab8dfabce8378edc7632f448071fc396bd4d76dc0a091df357ed0283151040be9aa51b59dbf28451b6043388f83d82004f1df1cf761df487df40da0f9294 WHIRLPOOL ba473958555ba513b18bd8947f9bc4d361bc51be3984fb39d11be823bf232e748964406b90eca1d01f01b10f3d0ba99f906f0618531e2c75579994afe10c08cb
+DIST pyflakes-1.0.0.tar.gz 35365 SHA256 f39e33a4c03beead8774f005bd3ecf0c3f2f264fa0201de965fce0aff1d34263 SHA512 89a9ee2e5be87d32d5c259c0cb88bbeadb96d27a3bc5eb3cf6f86afa51907ea01107a5336decbf003679b7de65ed9a16d7fbf55a457e0c9bbb1b53500f719bcb WHIRLPOOL c4700fcb9f9a62ed8e38db5c2fb7376b1d03e85b1e1f9fb7d570eb905249337f204664fd87a94b32701c0c67fa8624749d36b64721cb0425bad36ded5da26cdb
diff --git a/dev-python/pyflakes/files/1.0.0-fix-pypy-tests.patch b/dev-python/pyflakes/files/1.0.0-fix-pypy-tests.patch
new file mode 100644
index 000000000000..41d1fa8ca86d
--- /dev/null
+++ b/dev-python/pyflakes/files/1.0.0-fix-pypy-tests.patch
@@ -0,0 +1,282 @@
+#https://github.com/jayvdb/pyflakes/commit/3088ffbd6256521e0213b361bc2294c1e218e6fb
+diff --git a/pyflakes/api.py b/pyflakes/api.py #index 3bc2330..2a46a0d 100644
+--- a/pyflakes/api.py
++++ b/pyflakes/api.py
+@@ -41,6 +41,18 @@ def check(codeString, filename, reporter=None):
+
+ (lineno, offset, text) = value.lineno, value.offset, value.text
+
++ if checker.PYPY:
++ if text is None:
++ lines = codeString.splitlines()
++ if len(lines) >= lineno:
++ text = lines[lineno - 1]
++ if sys.version_info >= (3, ) and isinstance(text, bytes):
++ try:
++ text = text.decode('ascii')
++ except UnicodeDecodeError:
++ text = None
++ offset -= 1
++
+ # If there's an encoding problem with the file, the text is None.
+ if text is None:
+ # Avoid using msg, since for the only known case, it contains a
+diff --git a/pyflakes/checker.py b/pyflakes/checker.py
+index 753fa9b..f538d3f 100644
+--- a/pyflakes/checker.py
++++ b/pyflakes/checker.py
+@@ -11,6 +11,12 @@
+ PY2 = sys.version_info < (3, 0)
+ PY32 = sys.version_info < (3, 3) # Python 2.5 to 3.2
+ PY33 = sys.version_info < (3, 4) # Python 2.5 to 3.3
++try:
++ sys.pypy_version_info
++ PYPY = True
++except AttributeError:
++ PYPY = False
++
+ builtin_vars = dir(__import__('__builtin__' if PY2 else 'builtins'))
+
+ try:
+@@ -594,8 +600,13 @@ def getDocstring(self, node):
+ node = node.value
+ if not isinstance(node, ast.Str):
+ return (None, None)
+- # Computed incorrectly if the docstring has backslash
+- doctest_lineno = node.lineno - node.s.count('\n') - 1
++
++ if PYPY:
++ doctest_lineno = node.lineno - 1
++ else:
++ # Computed incorrectly if the docstring has backslash
++ doctest_lineno = node.lineno - node.s.count('\n') - 1
++
+ return (node.s, doctest_lineno)
+
+ def handleNode(self, node, parent):
+@@ -642,6 +653,8 @@ def handleDoctests(self, node):
+ tree = compile(example.source, "<doctest>", "exec", ast.PyCF_ONLY_AST)
+ except SyntaxError:
+ e = sys.exc_info()[1]
++ if PYPY:
++ e.offset += 1
+ position = (node_lineno + example.lineno + e.lineno,
+ example.indent + 4 + (e.offset or 0))
+ self.report(messages.DoctestSyntaxError, node, position)
+diff --git a/pyflakes/test/test_api.py b/pyflakes/test/test_api.py
+index 34a59bc..d2a5036 100644
+--- a/pyflakes/test/test_api.py
++++ b/pyflakes/test/test_api.py
+@@ -23,6 +23,14 @@
+ from io import StringIO
+ unichr = chr
+
++try:
++ sys.pypy_version_info
++ PYPY = True
++except AttributeError:
++ PYPY = False
++
++ERROR_HAS_COL_NUM = ERROR_HAS_LAST_LINE = sys.version_info >= (3, 2) or PYPY
++
+
+ def withStderrTo(stderr, f, *args, **kwargs):
+ """
+@@ -312,18 +320,25 @@ def evaluate(source):
+ evaluate(source)
+ except SyntaxError:
+ e = sys.exc_info()[1]
+- self.assertTrue(e.text.count('\n') > 1)
++ if not PYPY:
++ self.assertTrue(e.text.count('\n') > 1)
+ else:
+ self.fail()
+
+ sourcePath = self.makeTempFile(source)
++
++ if PYPY:
++ message = 'EOF while scanning triple-quoted string literal'
++ else:
++ message = 'invalid syntax'
++
+ self.assertHasErrors(
+ sourcePath,
+ ["""\
+-%s:8:11: invalid syntax
++%s:8:11: %s
+ '''quux'''
+ ^
+-""" % (sourcePath,)])
++""" % (sourcePath, message)])
+
+ def test_eofSyntaxError(self):
+ """
+@@ -331,13 +346,22 @@ def test_eofSyntaxError(self):
+ syntax error reflects the cause for the syntax error.
+ """
+ sourcePath = self.makeTempFile("def foo(")
+- self.assertHasErrors(
+- sourcePath,
+- ["""\
++ if PYPY:
++ result = """\
++%s:1:7: parenthesis is never closed
++def foo(
++ ^
++""" % (sourcePath,)
++ else:
++ result = """\
+ %s:1:9: unexpected EOF while parsing
+ def foo(
+ ^
+-""" % (sourcePath,)])
++""" % (sourcePath,)
++
++ self.assertHasErrors(
++ sourcePath,
++ [result])
+
+ def test_eofSyntaxErrorWithTab(self):
+ """
+@@ -345,13 +369,16 @@ def test_eofSyntaxErrorWithTab(self):
+ syntax error reflects the cause for the syntax error.
+ """
+ sourcePath = self.makeTempFile("if True:\n\tfoo =")
++ column = 5 if PYPY else 7
++ last_line = '\t ^' if PYPY else '\t ^'
++
+ self.assertHasErrors(
+ sourcePath,
+ ["""\
+-%s:2:7: invalid syntax
++%s:2:%s: invalid syntax
+ \tfoo =
+-\t ^
+-""" % (sourcePath,)])
++%s
++""" % (sourcePath, column, last_line)])
+
+ def test_nonDefaultFollowsDefaultSyntaxError(self):
+ """
+@@ -364,8 +391,8 @@ def foo(bar=baz, bax):
+ pass
+ """
+ sourcePath = self.makeTempFile(source)
+- last_line = ' ^\n' if sys.version_info >= (3, 2) else ''
+- column = '8:' if sys.version_info >= (3, 2) else ''
++ last_line = ' ^\n' if ERROR_HAS_LAST_LINE else ''
++ column = '8:' if ERROR_HAS_COL_NUM else ''
+ self.assertHasErrors(
+ sourcePath,
+ ["""\
+@@ -383,8 +410,8 @@ def test_nonKeywordAfterKeywordSyntaxError(self):
+ foo(bar=baz, bax)
+ """
+ sourcePath = self.makeTempFile(source)
+- last_line = ' ^\n' if sys.version_info >= (3, 2) else ''
+- column = '13:' if sys.version_info >= (3, 2) else ''
++ last_line = ' ^\n' if ERROR_HAS_LAST_LINE else ''
++ column = '13:' if ERROR_HAS_COL_NUM or PYPY else ''
+
+ if sys.version_info >= (3, 5):
+ message = 'positional argument follows keyword argument'
+@@ -407,8 +434,15 @@ def test_invalidEscape(self):
+ sourcePath = self.makeTempFile(r"foo = '\xyz'")
+ if ver < (3,):
+ decoding_error = "%s: problem decoding source\n" % (sourcePath,)
++ elif PYPY:
++ # pypy3 only
++ decoding_error = """\
++%s:1:6: %s: ('unicodeescape', b'\\\\xyz', 0, 2, 'truncated \\\\xXX escape')
++foo = '\\xyz'
++ ^
++""" % (sourcePath, 'UnicodeDecodeError')
+ else:
+- last_line = ' ^\n' if ver >= (3, 2) else ''
++ last_line = ' ^\n' if ERROR_HAS_LAST_LINE else ''
+ # Column has been "fixed" since 3.2.4 and 3.3.1
+ col = 1 if ver >= (3, 3, 1) or ((3, 2, 4) <= ver < (3, 3)) else 2
+ decoding_error = """\
+@@ -474,8 +508,21 @@ def test_misencodedFileUTF8(self):
+ x = "%s"
+ """ % SNOWMAN).encode('utf-8')
+ sourcePath = self.makeTempFile(source)
++
++ if PYPY and sys.version_info < (3, ):
++ message = ('\'ascii\' codec can\'t decode byte 0xe2 '
++ 'in position 21: ordinal not in range(128)')
++ result = """\
++%s:0:0: %s
++x = "\xe2\x98\x83"
++ ^\n""" % (sourcePath, message)
++
++ else:
++ message = 'problem decoding source'
++ result = "%s: problem decoding source\n" % (sourcePath,)
++
+ self.assertHasErrors(
+- sourcePath, ["%s: problem decoding source\n" % (sourcePath,)])
++ sourcePath, [result])
+
+ def test_misencodedFileUTF16(self):
+ """
+diff --git a/pyflakes/test/test_doctests.py b/pyflakes/test/test_doctests.py
+index f15acb8..6793da9 100644
+--- a/pyflakes/test/test_doctests.py
++++ b/pyflakes/test/test_doctests.py
+@@ -1,3 +1,4 @@
++import sys
+ import textwrap
+
+ from pyflakes import messages as m
+@@ -11,6 +12,12 @@
+ from pyflakes.test.test_undefined_names import Test as TestUndefinedNames
+ from pyflakes.test.harness import TestCase, skip
+
++try:
++ sys.pypy_version_info
++ PYPY = True
++except AttributeError:
++ PYPY = False
++
+
+ class _DoctestMixin(object):
+
+@@ -273,12 +280,22 @@ def doctest_stuff():
+ exc = exceptions[0]
+ self.assertEqual(exc.lineno, 4)
+ self.assertEqual(exc.col, 26)
++
++ # PyPy error column offset is 0,
++ # for the second and third line of the doctest
++ # i.e. at the beginning of the line
+ exc = exceptions[1]
+ self.assertEqual(exc.lineno, 5)
+- self.assertEqual(exc.col, 16)
++ if PYPY:
++ self.assertEqual(exc.col, 13)
++ else:
++ self.assertEqual(exc.col, 16)
+ exc = exceptions[2]
+ self.assertEqual(exc.lineno, 6)
+- self.assertEqual(exc.col, 18)
++ if PYPY:
++ self.assertEqual(exc.col, 13)
++ else:
++ self.assertEqual(exc.col, 18)
+
+ def test_indentationErrorInDoctest(self):
+ exc = self.flakes('''
+@@ -289,7 +306,10 @@ def doctest_stuff():
+ """
+ ''', m.DoctestSyntaxError).messages[0]
+ self.assertEqual(exc.lineno, 5)
+- self.assertEqual(exc.col, 16)
++ if PYPY:
++ self.assertEqual(exc.col, 13)
++ else:
++ self.assertEqual(exc.col, 16)
+
+ def test_offsetWithMultiLineArgs(self):
+ (exc1, exc2) = self.flakes(
+
diff --git a/dev-python/pyflakes/pyflakes-0.7.3.ebuild b/dev-python/pyflakes/pyflakes-0.7.3.ebuild
deleted file mode 100644
index 0924bb917689..000000000000
--- a/dev-python/pyflakes/pyflakes-0.7.3.ebuild
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-PYTHON_COMPAT=(python{2_7,3_3} ) # not 3.4 yet
-
-inherit distutils-r1
-
-DESCRIPTION="Passive checker for Python programs"
-HOMEPAGE="https://launchpad.net/pyflakes https://pypi.python.org/pypi/pyflakes"
-SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
-
-LICENSE="MIT"
-SLOT="0"
-KEYWORDS="amd64 ~ppc ~ppc64 x86 ~amd64-linux ~arm-linux ~x86-linux ~x64-macos ~x86-macos"
-IUSE=""
-
-DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
-RDEPEND="${DEPEND}"
-
-DOCS=(AUTHORS NEWS.txt README.rst)
-
-python_test() {
- esetup.py test --quiet
-}
diff --git a/dev-python/pyflakes/pyflakes-0.9.2.ebuild b/dev-python/pyflakes/pyflakes-1.0.0.ebuild
index c8705149c612..732586cc75d8 100644
--- a/dev-python/pyflakes/pyflakes-0.9.2.ebuild
+++ b/dev-python/pyflakes/pyflakes-1.0.0.ebuild
@@ -3,7 +3,7 @@
# $Id$
EAPI=5
-PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+PYTHON_COMPAT=( python{2_7,3_4,3_5} pypy )
inherit distutils-r1
@@ -19,6 +19,8 @@ IUSE=""
DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
RDEPEND="${DEPEND}"
+PATCHES=( "${FILESDIR}"/fix-pypy-tests.patch )
+
python_test() {
esetup.py test --quiet
}