commit:     d4ed1ac8fbba6c8fad4f265ff2c412c57ee9ad98
Author:     Louis Sautier <sbraz <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  3 00:27:21 2020 +0000
Commit:     Louis Sautier <sbraz <AT> gentoo <DOT> org>
CommitDate: Sat Oct  3 00:31:09 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d4ed1ac8

dev-python/pyflakes: add Python 3.9 support, fix tests

Also fix setuptools dependency.

Closes: https://bugs.gentoo.org/746083
Closes: https://bugs.gentoo.org/743691
Package-Manager: Portage-3.0.8, Repoman-3.0.1
Signed-off-by: Louis Sautier <sbraz <AT> gentoo.org>

 .../pyflakes/files/pyflakes-2.2.0-fix-tests.patch  | 97 ++++++++++++++++++++++
 dev-python/pyflakes/pyflakes-2.2.0.ebuild          |  8 +-
 2 files changed, 103 insertions(+), 2 deletions(-)

diff --git a/dev-python/pyflakes/files/pyflakes-2.2.0-fix-tests.patch 
b/dev-python/pyflakes/files/pyflakes-2.2.0-fix-tests.patch
new file mode 100644
index 00000000000..00b1130bf34
--- /dev/null
+++ b/dev-python/pyflakes/files/pyflakes-2.2.0-fix-tests.patch
@@ -0,0 +1,97 @@
+diff --git a/pyflakes/test/test_api.py b/pyflakes/test/test_api.py
+index b579ac8..d379b3b 100644
+--- a/pyflakes/test/test_api.py
++++ b/pyflakes/test/test_api.py
+@@ -515,8 +513,10 @@ def foo(bar=baz, bax):
+ """
+         with self.makeTempFile(source) as sourcePath:
+             if ERROR_HAS_LAST_LINE:
+-                if PYPY and sys.version_info >= (3,):
++                if PYPY:
+                     column = 7
++                elif sys.version_info >= (3, 9):
++                    column = 21
+                 elif sys.version_info >= (3, 8):
+                     column = 9
+                 else:
+@@ -543,8 +543,10 @@ foo(bar=baz, bax)
+ """
+         with self.makeTempFile(source) as sourcePath:
+             if ERROR_HAS_LAST_LINE:
+-                if PYPY and sys.version_info >= (3,):
++                if PYPY:
+                     column = 12
++                elif sys.version_info >= (3, 9):
++                    column = 17
+                 elif sys.version_info >= (3, 8):
+                     column = 14
+                 else:
+@@ -578,7 +580,9 @@ foo(bar=baz, bax)
+             else:
+                 position_end = 1
+                 if PYPY:
+-                    column = 6
++                    column = 5
++                elif ver >= (3, 9):
++                    column = 13
+                 else:
+                     column = 7
+                     # Column has been "fixed" since 3.2.4 and 3.3.1
+@@ -717,13 +721,6 @@ class IntegrationTests(TestCase):
+     """
+     Tests of the pyflakes script that actually spawn the script.
+     """
+-
+-    # 
https://bitbucket.org/pypy/pypy/issues/3069/pypy36-on-windows-incorrect-line-separator
+-    if PYPY and sys.version_info >= (3,) and WIN:
+-        LINESEP = '\n'
+-    else:
+-        LINESEP = os.linesep
+-
+     def setUp(self):
+         self.tempdir = tempfile.mkdtemp()
+         self.tempfilepath = os.path.join(self.tempdir, 'temp')
+@@ -784,7 +781,7 @@ class IntegrationTests(TestCase):
+             fd.write("import contraband\n".encode('ascii'))
+         d = self.runPyflakes([self.tempfilepath])
+         expected = UnusedImport(self.tempfilepath, Node(1), 'contraband')
+-        self.assertEqual(d, ("%s%s" % (expected, self.LINESEP), '', 1))
++        self.assertEqual(d, ("%s%s" % (expected, os.linesep), '', 1))
+ 
+     def test_errors_io(self):
+         """
+@@ -794,7 +791,7 @@ class IntegrationTests(TestCase):
+         """
+         d = self.runPyflakes([self.tempfilepath])
+         error_msg = '%s: No such file or directory%s' % (self.tempfilepath,
+-                                                         self.LINESEP)
++                                                         os.linesep)
+         self.assertEqual(d, ('', error_msg, 1))
+ 
+     def test_errors_syntax(self):
+@@ -807,7 +804,7 @@ class IntegrationTests(TestCase):
+             fd.write("import".encode('ascii'))
+         d = self.runPyflakes([self.tempfilepath])
+         error_msg = '{0}:1:{2}: invalid syntax{1}import{1}     
{3}^{1}'.format(
+-            self.tempfilepath, self.LINESEP, 6 if PYPY else 7, '' if PYPY 
else ' ')
++            self.tempfilepath, os.linesep, 6 if PYPY else 7, '' if PYPY else 
' ')
+         self.assertEqual(d, ('', error_msg, 1))
+ 
+     def test_readFromStdin(self):
+@@ -816,15 +813,13 @@ class IntegrationTests(TestCase):
+         """
+         d = self.runPyflakes([], stdin='import contraband')
+         expected = UnusedImport('<stdin>', Node(1), 'contraband')
+-        self.assertEqual(d, ("%s%s" % (expected, self.LINESEP), '', 1))
++        self.assertEqual(d, ("%s%s" % (expected, os.linesep), '', 1))
+ 
+ 
+ class TestMain(IntegrationTests):
+     """
+     Tests of the pyflakes main function.
+     """
+-    LINESEP = os.linesep
+-
+     def runPyflakes(self, paths, stdin=None):
+         try:
+             with SysStreamCapturing(stdin) as capture:

diff --git a/dev-python/pyflakes/pyflakes-2.2.0.ebuild 
b/dev-python/pyflakes/pyflakes-2.2.0.ebuild
index c9d537394f5..0ce90928237 100644
--- a/dev-python/pyflakes/pyflakes-2.2.0.ebuild
+++ b/dev-python/pyflakes/pyflakes-2.2.0.ebuild
@@ -2,7 +2,10 @@
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
-PYTHON_COMPAT=( python3_{6,7,8} pypy3 )
+
+PYTHON_COMPAT=( pypy3 python3_{6..9} )
+# Uses pkg_resources
+DISTUTILS_USE_SETUPTOOLS=rdepend
 
 inherit distutils-r1
 
@@ -14,6 +17,7 @@ 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 ~x86-macos ~sparc-solaris 
~sparc64-solaris ~x64-solaris ~x86-solaris"
 
-RDEPEND="${BDEPEND}"
+# Should be included in the next release
+PATCHES=( "${FILESDIR}/${P}-fix-tests.patch" )
 
 distutils_enable_tests unittest

Reply via email to