Gentoo Archives: gentoo-commits

From: Louis Sautier <sbraz@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pyflakes/, dev-python/pyflakes/files/
Date: Sat, 03 Oct 2020 00:35:31
Message-Id: 1601685069.d4ed1ac8fbba6c8fad4f265ff2c412c57ee9ad98.sbraz@gentoo
1 commit: d4ed1ac8fbba6c8fad4f265ff2c412c57ee9ad98
2 Author: Louis Sautier <sbraz <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 3 00:27:21 2020 +0000
4 Commit: Louis Sautier <sbraz <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 3 00:31:09 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d4ed1ac8
7
8 dev-python/pyflakes: add Python 3.9 support, fix tests
9
10 Also fix setuptools dependency.
11
12 Closes: https://bugs.gentoo.org/746083
13 Closes: https://bugs.gentoo.org/743691
14 Package-Manager: Portage-3.0.8, Repoman-3.0.1
15 Signed-off-by: Louis Sautier <sbraz <AT> gentoo.org>
16
17 .../pyflakes/files/pyflakes-2.2.0-fix-tests.patch | 97 ++++++++++++++++++++++
18 dev-python/pyflakes/pyflakes-2.2.0.ebuild | 8 +-
19 2 files changed, 103 insertions(+), 2 deletions(-)
20
21 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
22 new file mode 100644
23 index 00000000000..00b1130bf34
24 --- /dev/null
25 +++ b/dev-python/pyflakes/files/pyflakes-2.2.0-fix-tests.patch
26 @@ -0,0 +1,97 @@
27 +diff --git a/pyflakes/test/test_api.py b/pyflakes/test/test_api.py
28 +index b579ac8..d379b3b 100644
29 +--- a/pyflakes/test/test_api.py
30 ++++ b/pyflakes/test/test_api.py
31 +@@ -515,8 +513,10 @@ def foo(bar=baz, bax):
32 + """
33 + with self.makeTempFile(source) as sourcePath:
34 + if ERROR_HAS_LAST_LINE:
35 +- if PYPY and sys.version_info >= (3,):
36 ++ if PYPY:
37 + column = 7
38 ++ elif sys.version_info >= (3, 9):
39 ++ column = 21
40 + elif sys.version_info >= (3, 8):
41 + column = 9
42 + else:
43 +@@ -543,8 +543,10 @@ foo(bar=baz, bax)
44 + """
45 + with self.makeTempFile(source) as sourcePath:
46 + if ERROR_HAS_LAST_LINE:
47 +- if PYPY and sys.version_info >= (3,):
48 ++ if PYPY:
49 + column = 12
50 ++ elif sys.version_info >= (3, 9):
51 ++ column = 17
52 + elif sys.version_info >= (3, 8):
53 + column = 14
54 + else:
55 +@@ -578,7 +580,9 @@ foo(bar=baz, bax)
56 + else:
57 + position_end = 1
58 + if PYPY:
59 +- column = 6
60 ++ column = 5
61 ++ elif ver >= (3, 9):
62 ++ column = 13
63 + else:
64 + column = 7
65 + # Column has been "fixed" since 3.2.4 and 3.3.1
66 +@@ -717,13 +721,6 @@ class IntegrationTests(TestCase):
67 + """
68 + Tests of the pyflakes script that actually spawn the script.
69 + """
70 +-
71 +- # https://bitbucket.org/pypy/pypy/issues/3069/pypy36-on-windows-incorrect-line-separator
72 +- if PYPY and sys.version_info >= (3,) and WIN:
73 +- LINESEP = '\n'
74 +- else:
75 +- LINESEP = os.linesep
76 +-
77 + def setUp(self):
78 + self.tempdir = tempfile.mkdtemp()
79 + self.tempfilepath = os.path.join(self.tempdir, 'temp')
80 +@@ -784,7 +781,7 @@ class IntegrationTests(TestCase):
81 + fd.write("import contraband\n".encode('ascii'))
82 + d = self.runPyflakes([self.tempfilepath])
83 + expected = UnusedImport(self.tempfilepath, Node(1), 'contraband')
84 +- self.assertEqual(d, ("%s%s" % (expected, self.LINESEP), '', 1))
85 ++ self.assertEqual(d, ("%s%s" % (expected, os.linesep), '', 1))
86 +
87 + def test_errors_io(self):
88 + """
89 +@@ -794,7 +791,7 @@ class IntegrationTests(TestCase):
90 + """
91 + d = self.runPyflakes([self.tempfilepath])
92 + error_msg = '%s: No such file or directory%s' % (self.tempfilepath,
93 +- self.LINESEP)
94 ++ os.linesep)
95 + self.assertEqual(d, ('', error_msg, 1))
96 +
97 + def test_errors_syntax(self):
98 +@@ -807,7 +804,7 @@ class IntegrationTests(TestCase):
99 + fd.write("import".encode('ascii'))
100 + d = self.runPyflakes([self.tempfilepath])
101 + error_msg = '{0}:1:{2}: invalid syntax{1}import{1} {3}^{1}'.format(
102 +- self.tempfilepath, self.LINESEP, 6 if PYPY else 7, '' if PYPY else ' ')
103 ++ self.tempfilepath, os.linesep, 6 if PYPY else 7, '' if PYPY else ' ')
104 + self.assertEqual(d, ('', error_msg, 1))
105 +
106 + def test_readFromStdin(self):
107 +@@ -816,15 +813,13 @@ class IntegrationTests(TestCase):
108 + """
109 + d = self.runPyflakes([], stdin='import contraband')
110 + expected = UnusedImport('<stdin>', Node(1), 'contraband')
111 +- self.assertEqual(d, ("%s%s" % (expected, self.LINESEP), '', 1))
112 ++ self.assertEqual(d, ("%s%s" % (expected, os.linesep), '', 1))
113 +
114 +
115 + class TestMain(IntegrationTests):
116 + """
117 + Tests of the pyflakes main function.
118 + """
119 +- LINESEP = os.linesep
120 +-
121 + def runPyflakes(self, paths, stdin=None):
122 + try:
123 + with SysStreamCapturing(stdin) as capture:
124
125 diff --git a/dev-python/pyflakes/pyflakes-2.2.0.ebuild b/dev-python/pyflakes/pyflakes-2.2.0.ebuild
126 index c9d537394f5..0ce90928237 100644
127 --- a/dev-python/pyflakes/pyflakes-2.2.0.ebuild
128 +++ b/dev-python/pyflakes/pyflakes-2.2.0.ebuild
129 @@ -2,7 +2,10 @@
130 # Distributed under the terms of the GNU General Public License v2
131
132 EAPI=7
133 -PYTHON_COMPAT=( python3_{6,7,8} pypy3 )
134 +
135 +PYTHON_COMPAT=( pypy3 python3_{6..9} )
136 +# Uses pkg_resources
137 +DISTUTILS_USE_SETUPTOOLS=rdepend
138
139 inherit distutils-r1
140
141 @@ -14,6 +17,7 @@ LICENSE="MIT"
142 SLOT="0"
143 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"
144
145 -RDEPEND="${BDEPEND}"
146 +# Should be included in the next release
147 +PATCHES=( "${FILESDIR}/${P}-fix-tests.patch" )
148
149 distutils_enable_tests unittest