1 |
commit: 86c0328e98c5f0e0bf8e8db163b03953c6d92467 |
2 |
Author: Louis Sautier <sbraz <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Oct 7 10:42:37 2020 +0000 |
4 |
Commit: Louis Sautier <sbraz <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Oct 7 16:30:04 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=86c0328e |
7 |
|
8 |
dev-python/mypy: bump to 0.782, add Py3.9 support, fix tests |
9 |
|
10 |
Also: |
11 |
* Fetch the package from PyPI, removes the need to get typeshed |
12 |
separately and simplifies pre-build steps. |
13 |
* Run tests directly with pytest, allowing us to remove code checkers from |
14 |
dependencies. |
15 |
* Use distutils_enable_sphinx to build the doc. |
16 |
* Remove live ebuild logic as no such ebuild is present. |
17 |
* Use EAPI 7. |
18 |
|
19 |
Closes: https://bugs.gentoo.org/739694 |
20 |
Package-Manager: Portage-3.0.8, Repoman-3.0.1 |
21 |
Signed-off-by: Louis Sautier <sbraz <AT> gentoo.org> |
22 |
|
23 |
dev-python/mypy/Manifest | 1 + |
24 |
dev-python/mypy/files/mypy-0.782-conftest.patch | 24 +++ |
25 |
dev-python/mypy/files/mypy-0.782-py39-fixes.patch | 138 ++++++++++++++ |
26 |
dev-python/mypy/files/mypy-0.782-pytest-6.patch | 210 ++++++++++++++++++++++ |
27 |
dev-python/mypy/mypy-0.782.ebuild | 58 ++++++ |
28 |
5 files changed, 431 insertions(+) |
29 |
|
30 |
diff --git a/dev-python/mypy/Manifest b/dev-python/mypy/Manifest |
31 |
index 523c9a998a2..767904fcde5 100644 |
32 |
--- a/dev-python/mypy/Manifest |
33 |
+++ b/dev-python/mypy/Manifest |
34 |
@@ -1,2 +1,3 @@ |
35 |
DIST mypy-0.781.tar.gz 2056785 BLAKE2B aa95d71400d5d46223a141adae5a8d797d2f076d3b6b48a7c09db6f7f3f2193d571368759f0ca307331d8e8c241b0322e758716a10fabccca3aaa6b733a63347 SHA512 dd3173115720510b278d15f5083a57fdb41582dfcaaf16e587116e41e87d608f4e226b61a978f4b41ef6b5ec6d3d9279facd65c0a74888b367171dcbe25550f2 |
36 |
+DIST mypy-0.782.tar.gz 2529814 BLAKE2B c75771fb40524c2c8675236eaaddd6e39d13b4fd4f6f15f279b2e0be75eb0630987cb90f31bd7c65c4a322de4915d3a260e8f6f375b49157fea4b6362316f333 SHA512 f94433f79ea76b53ebb70589ca04ba3f39847050f73cf6deac00a3db13d742613a8ecb1a11fb84a878458025c6776b236b074e93e577c1b597e31d1300974767 |
37 |
DIST mypy-typeshed-0.781-e199c2e.tar.gz 541588 BLAKE2B f663d0feccffb315efd1b6e3ebc54bbe3cf4c7873c240ed54c7be1042807e2213326db8756b5a540fd9bf5ae95a2c0850e8cb35ae2e849ec3e9a628367fabe72 SHA512 57f3159d909799838779c04ccc6541322c27c01efb026c26a145676fa75076f64b8cd3e99f7488501582c743e1102cad59320512d52d4a058d8731c54c0705cd |
38 |
|
39 |
diff --git a/dev-python/mypy/files/mypy-0.782-conftest.patch b/dev-python/mypy/files/mypy-0.782-conftest.patch |
40 |
new file mode 100644 |
41 |
index 00000000000..08da1b1b690 |
42 |
--- /dev/null |
43 |
+++ b/dev-python/mypy/files/mypy-0.782-conftest.patch |
44 |
@@ -0,0 +1,24 @@ |
45 |
+diff --git a/conftest.py b/conftest.py |
46 |
+new file mode 100644 |
47 |
+index 00000000..83a6689f |
48 |
+--- /dev/null |
49 |
++++ b/conftest.py |
50 |
+@@ -0,0 +1,18 @@ |
51 |
++import os.path |
52 |
++ |
53 |
++pytest_plugins = [ |
54 |
++ 'mypy.test.data', |
55 |
++] |
56 |
++ |
57 |
++ |
58 |
++def pytest_configure(config): |
59 |
++ mypy_source_root = os.path.dirname(os.path.abspath(__file__)) |
60 |
++ if os.getcwd() != mypy_source_root: |
61 |
++ os.chdir(mypy_source_root) |
62 |
++ |
63 |
++ |
64 |
++# This function name is special to pytest. See |
65 |
++# http://doc.pytest.org/en/latest/writing_plugins.html#initialization-command-line-and-configuration-hooks |
66 |
++def pytest_addoption(parser) -> None: |
67 |
++ parser.addoption('--bench', action='store_true', default=False, |
68 |
++ help='Enable the benchmark test runs') |
69 |
|
70 |
diff --git a/dev-python/mypy/files/mypy-0.782-py39-fixes.patch b/dev-python/mypy/files/mypy-0.782-py39-fixes.patch |
71 |
new file mode 100644 |
72 |
index 00000000000..16c12daecae |
73 |
--- /dev/null |
74 |
+++ b/dev-python/mypy/files/mypy-0.782-py39-fixes.patch |
75 |
@@ -0,0 +1,138 @@ |
76 |
+From 13ae58ffe8bedb7da9f4c657297f0d61e681d671 Mon Sep 17 00:00:00 2001 |
77 |
+From: Shantanu <12621235+hauntsaninja@××××××××××××××××××××.com> |
78 |
+Date: Sun, 30 Aug 2020 18:11:57 -0700 |
79 |
+Subject: [PATCH] mypy: get CI green for py39 (#9376) |
80 |
+ |
81 |
+Due to Python 3.9's new parser, this has a different (and better) error |
82 |
+message on Python 3.9. |
83 |
+ |
84 |
+This is effectively a test of typed_ast / ast, so I don't think it |
85 |
+matters too much. I'm happy to alternatively just get rid of the test |
86 |
+altogether, or if people feel strongly, come up with a way to run the |
87 |
+test when run with older Pythons. |
88 |
+ |
89 |
+Co-authored-by: hauntsaninja <> |
90 |
+--- |
91 |
+ .travis.yml | 3 --- |
92 |
+ mypy/test/testcheck.py | 2 ++ |
93 |
+ test-data/unit/check-kwargs.test | 7 ------- |
94 |
+ test-data/unit/check-python39.test | 9 +++++++++ |
95 |
+ 4 files changed, 11 insertions(+), 10 deletions(-) |
96 |
+ create mode 100644 test-data/unit/check-python39.test |
97 |
+ |
98 |
+diff --git a/mypy/test/testcheck.py b/mypy/test/testcheck.py |
99 |
+index 49a85861b6..39a35c7280 100644 |
100 |
+--- a/mypy/test/testcheck.py |
101 |
++++ b/mypy/test/testcheck.py |
102 |
+@@ -94,6 +94,8 @@ |
103 |
+ # Tests that use Python 3.8-only AST features (like expression-scoped ignores): |
104 |
+ if sys.version_info >= (3, 8): |
105 |
+ typecheck_files.append('check-python38.test') |
106 |
++if sys.version_info >= (3, 9): |
107 |
++ typecheck_files.append('check-python39.test') |
108 |
+ |
109 |
+ # Special tests for platforms with case-insensitive filesystems. |
110 |
+ if sys.platform in ('darwin', 'win32'): |
111 |
+diff --git a/test-data/unit/check-kwargs.test b/test-data/unit/check-kwargs.test |
112 |
+index 1dd450caae..a587be3e06 100644 |
113 |
+--- a/test-data/unit/check-kwargs.test |
114 |
++++ b/test-data/unit/check-kwargs.test |
115 |
+@@ -53,13 +53,6 @@ f(b=[], a=A()) |
116 |
+ class A: pass |
117 |
+ [builtins fixtures/list.pyi] |
118 |
+ |
119 |
+-[case testGivingSameKeywordArgumentTwice] |
120 |
+-import typing |
121 |
+-def f(a: 'A', b: 'B') -> None: pass |
122 |
+-f(a=A(), b=B(), a=A()) # E: keyword argument repeated |
123 |
+-class A: pass |
124 |
+-class B: pass |
125 |
+- |
126 |
+ [case testGivingArgumentAsPositionalAndKeywordArg] |
127 |
+ import typing |
128 |
+ def f(a: 'A', b: 'B' = None) -> None: pass |
129 |
+diff --git a/test-data/unit/check-python39.test b/test-data/unit/check-python39.test |
130 |
+new file mode 100644 |
131 |
+index 0000000000..0e9ec683ae |
132 |
+--- /dev/null |
133 |
++++ b/test-data/unit/check-python39.test |
134 |
+@@ -0,0 +1,9 @@ |
135 |
++[case testGivingSameKeywordArgumentTwice] |
136 |
++# This test was originally in check-kwargs.test |
137 |
++# Python 3.9's new parser started producing a different error message here. Since this isn't the |
138 |
++# most important test, to deal with this we'll only run this test with Python 3.9 and later. |
139 |
++import typing |
140 |
++def f(a: 'A', b: 'B') -> None: pass |
141 |
++f(a=A(), b=B(), a=A()) # E: "f" gets multiple values for keyword argument "a" |
142 |
++class A: pass |
143 |
++class B: pass |
144 |
+From da4430119255ac9205c96d54deb2e2ebed0ce8ce Mon Sep 17 00:00:00 2001 |
145 |
+From: Shantanu <12621235+hauntsaninja@××××××××××××××××××××.com> |
146 |
+Date: Fri, 31 Jul 2020 09:58:15 -0700 |
147 |
+Subject: [PATCH] mypyc: ignore deprecation (#9107) |
148 |
+ |
149 |
+PyUnicode_AsUnicodeAndSize has been deprecated since 3.3 |
150 |
+ |
151 |
+Python 3.9 has compiler warnings for this deprecated function, and we |
152 |
+compile with Werror, causing Python 3.9 builds to fail. |
153 |
+ |
154 |
+I've just copied over the relevant deprecation ignoring code from the |
155 |
+original getargs.c (including the TODO, but I can remove that) |
156 |
+ |
157 |
+Co-authored-by: hauntsaninja <> |
158 |
+--- |
159 |
+ mypyc/lib-rt/getargs.c | 27 +++++++++++++++++++++++++++ |
160 |
+ 1 file changed, 27 insertions(+) |
161 |
+ |
162 |
+diff --git a/mypyc/lib-rt/getargs.c b/mypyc/lib-rt/getargs.c |
163 |
+index 32b387c8ab..e6b1a0c937 100644 |
164 |
+--- a/mypyc/lib-rt/getargs.c |
165 |
++++ b/mypyc/lib-rt/getargs.c |
166 |
+@@ -18,6 +18,29 @@ |
167 |
+ * and is responsible for decrefing them. |
168 |
+ */ |
169 |
+ |
170 |
++// These macro definitions are copied from pyport.h in Python 3.9 and later |
171 |
++// https://bugs.python.org/issue19569 |
172 |
++#if defined(__clang__) |
173 |
++#define _Py_COMP_DIAG_PUSH _Pragma("clang diagnostic push") |
174 |
++#define _Py_COMP_DIAG_IGNORE_DEPR_DECLS \ |
175 |
++ _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") |
176 |
++#define _Py_COMP_DIAG_POP _Pragma("clang diagnostic pop") |
177 |
++#elif defined(__GNUC__) \ |
178 |
++ && ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) |
179 |
++#define _Py_COMP_DIAG_PUSH _Pragma("GCC diagnostic push") |
180 |
++#define _Py_COMP_DIAG_IGNORE_DEPR_DECLS \ |
181 |
++ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") |
182 |
++#define _Py_COMP_DIAG_POP _Pragma("GCC diagnostic pop") |
183 |
++#elif defined(_MSC_VER) |
184 |
++#define _Py_COMP_DIAG_PUSH __pragma(warning(push)) |
185 |
++#define _Py_COMP_DIAG_IGNORE_DEPR_DECLS __pragma(warning(disable: 4996)) |
186 |
++#define _Py_COMP_DIAG_POP __pragma(warning(pop)) |
187 |
++#else |
188 |
++#define _Py_COMP_DIAG_PUSH |
189 |
++#define _Py_COMP_DIAG_IGNORE_DEPR_DECLS |
190 |
++#define _Py_COMP_DIAG_POP |
191 |
++#endif |
192 |
++ |
193 |
+ #include "Python.h" |
194 |
+ #include "pythonsupport.h" |
195 |
+ |
196 |
+@@ -756,6 +779,9 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, |
197 |
+ case 'u': /* raw unicode buffer (Py_UNICODE *) */ |
198 |
+ case 'Z': /* raw unicode buffer or None */ |
199 |
+ { |
200 |
++ // TODO: Raise DeprecationWarning |
201 |
++_Py_COMP_DIAG_PUSH |
202 |
++_Py_COMP_DIAG_IGNORE_DEPR_DECLS |
203 |
+ Py_UNICODE **p = va_arg(*p_va, Py_UNICODE **); |
204 |
+ |
205 |
+ if (*format == '#') { |
206 |
+@@ -795,6 +821,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, |
207 |
+ arg, msgbuf, bufsize); |
208 |
+ } |
209 |
+ break; |
210 |
++_Py_COMP_DIAG_POP |
211 |
+ } |
212 |
+ |
213 |
+ case 'e': {/* encoded string */ |
214 |
|
215 |
diff --git a/dev-python/mypy/files/mypy-0.782-pytest-6.patch b/dev-python/mypy/files/mypy-0.782-pytest-6.patch |
216 |
new file mode 100644 |
217 |
index 00000000000..0252d113880 |
218 |
--- /dev/null |
219 |
+++ b/dev-python/mypy/files/mypy-0.782-pytest-6.patch |
220 |
@@ -0,0 +1,210 @@ |
221 |
+From 3e77959eacf3d445a0cb4db5a4bc6dcf606fc040 Mon Sep 17 00:00:00 2001 |
222 |
+From: Lawrence Chan <llchan@××××××××××××××××××××.com> |
223 |
+Date: Tue, 4 Aug 2020 18:14:55 -0500 |
224 |
+Subject: [PATCH] Use pytest Node.from_parent if available (#9263) |
225 |
+ |
226 |
+* Use pytest Node.from_parent if available |
227 |
+ |
228 |
+* Use pytest Node.from_parent unconditionally (requires pytest 5.4+) |
229 |
+ |
230 |
+* Bump pytest test requirements |
231 |
+ |
232 |
+* Require pytest 6.0 and remove unused type ignores |
233 |
+ |
234 |
+* Make flake8 happy |
235 |
+--- |
236 |
+ mypy/test/data.py | 37 ++++++++++++++++++++++-------------- |
237 |
+ mypy/test/helpers.py | 2 +- |
238 |
+ mypy/test/testfinegrained.py | 2 +- |
239 |
+ mypy/test/testipc.py | 2 +- |
240 |
+ mypy/test/testparse.py | 2 +- |
241 |
+ mypy/test/testpep561.py | 2 +- |
242 |
+ mypy/test/testpythoneval.py | 2 +- |
243 |
+ mypyc/test/testutil.py | 2 +- |
244 |
+ pytest.ini | 3 +-- |
245 |
+ test-requirements.txt | 9 ++++----- |
246 |
+ 10 files changed, 35 insertions(+), 28 deletions(-) |
247 |
+ |
248 |
+diff --git a/mypy/test/data.py b/mypy/test/data.py |
249 |
+index 5484fd99e9..a4f2d798b1 100644 |
250 |
+--- a/mypy/test/data.py |
251 |
++++ b/mypy/test/data.py |
252 |
+@@ -9,7 +9,7 @@ |
253 |
+ from abc import abstractmethod |
254 |
+ import sys |
255 |
+ |
256 |
+-import pytest # type: ignore # no pytest in typeshed |
257 |
++import pytest |
258 |
+ from typing import List, Tuple, Set, Optional, Iterator, Any, Dict, NamedTuple, Union |
259 |
+ |
260 |
+ from mypy.test.config import test_data_prefix, test_temp_dir, PREFIX |
261 |
+@@ -160,9 +160,12 @@ def parse_test_case(case: 'DataDrivenTestCase') -> None: |
262 |
+ case.expected_fine_grained_targets = targets |
263 |
+ |
264 |
+ |
265 |
+-class DataDrivenTestCase(pytest.Item): # type: ignore # inheriting from Any |
266 |
++class DataDrivenTestCase(pytest.Item): |
267 |
+ """Holds parsed data-driven test cases, and handles directory setup and teardown.""" |
268 |
+ |
269 |
++ # Override parent member type |
270 |
++ parent = None # type: DataSuiteCollector |
271 |
++ |
272 |
+ input = None # type: List[str] |
273 |
+ output = None # type: List[str] # Output for the first pass |
274 |
+ output2 = None # type: Dict[int, List[str]] # Output for runs 2+, indexed by run number |
275 |
+@@ -266,7 +269,7 @@ def repr_failure(self, excinfo: Any, style: Optional[Any] = None) -> str: |
276 |
+ # call exit() and they already print out a stack trace. |
277 |
+ excrepr = excinfo.exconly() |
278 |
+ else: |
279 |
+- self.parent._prunetraceback(excinfo) |
280 |
++ self.parent._prunetraceback(excinfo) # type: ignore[no-untyped-call] |
281 |
+ excrepr = excinfo.getrepr(style='short') |
282 |
+ |
283 |
+ return "data: {}:{}:\n{}".format(self.file, self.line, excrepr) |
284 |
+@@ -510,7 +513,9 @@ def pytest_pycollect_makeitem(collector: Any, name: str, |
285 |
+ # Non-None result means this obj is a test case. |
286 |
+ # The collect method of the returned DataSuiteCollector instance will be called later, |
287 |
+ # with self.obj being obj. |
288 |
+- return DataSuiteCollector(name, parent=collector) |
289 |
++ return DataSuiteCollector.from_parent( # type: ignore[no-untyped-call] |
290 |
++ parent=collector, name=name |
291 |
++ ) |
292 |
+ return None |
293 |
+ |
294 |
+ |
295 |
+@@ -535,19 +540,23 @@ def split_test_cases(parent: 'DataSuiteCollector', suite: 'DataSuite', |
296 |
+ for i in range(1, len(cases), 6): |
297 |
+ name, writescache, only_when, platform_flag, skip, data = cases[i:i + 6] |
298 |
+ platform = platform_flag[1:] if platform_flag else None |
299 |
+- yield DataDrivenTestCase(parent, suite, file, |
300 |
+- name=add_test_name_suffix(name, suite.test_name_suffix), |
301 |
+- writescache=bool(writescache), |
302 |
+- only_when=only_when, |
303 |
+- platform=platform, |
304 |
+- skip=bool(skip), |
305 |
+- data=data, |
306 |
+- line=line_no) |
307 |
++ yield DataDrivenTestCase.from_parent( |
308 |
++ parent=parent, |
309 |
++ suite=suite, |
310 |
++ file=file, |
311 |
++ name=add_test_name_suffix(name, suite.test_name_suffix), |
312 |
++ writescache=bool(writescache), |
313 |
++ only_when=only_when, |
314 |
++ platform=platform, |
315 |
++ skip=bool(skip), |
316 |
++ data=data, |
317 |
++ line=line_no, |
318 |
++ ) |
319 |
+ line_no += data.count('\n') + 1 |
320 |
+ |
321 |
+ |
322 |
+-class DataSuiteCollector(pytest.Class): # type: ignore # inheriting from Any |
323 |
+- def collect(self) -> Iterator[pytest.Item]: # type: ignore |
324 |
++class DataSuiteCollector(pytest.Class): |
325 |
++ def collect(self) -> Iterator[pytest.Item]: |
326 |
+ """Called by pytest on each of the object returned from pytest_pycollect_makeitem""" |
327 |
+ |
328 |
+ # obj is the object for which pytest_pycollect_makeitem returned self. |
329 |
+diff --git a/mypy/test/helpers.py b/mypy/test/helpers.py |
330 |
+index 46c01114c4..91c5ff6ab2 100644 |
331 |
+--- a/mypy/test/helpers.py |
332 |
++++ b/mypy/test/helpers.py |
333 |
+@@ -10,7 +10,7 @@ |
334 |
+ from mypy import defaults |
335 |
+ import mypy.api as api |
336 |
+ |
337 |
+-import pytest # type: ignore # no pytest in typeshed |
338 |
++import pytest |
339 |
+ |
340 |
+ # Exporting Suite as alias to TestCase for backwards compatibility |
341 |
+ # TODO: avoid aliasing - import and subclass TestCase directly |
342 |
+diff --git a/mypy/test/testfinegrained.py b/mypy/test/testfinegrained.py |
343 |
+index 596391da44..d4ed18cab0 100644 |
344 |
+--- a/mypy/test/testfinegrained.py |
345 |
++++ b/mypy/test/testfinegrained.py |
346 |
+@@ -35,7 +35,7 @@ |
347 |
+ from mypy.config_parser import parse_config_file |
348 |
+ from mypy.find_sources import create_source_list |
349 |
+ |
350 |
+-import pytest # type: ignore # no pytest in typeshed |
351 |
++import pytest |
352 |
+ |
353 |
+ # Set to True to perform (somewhat expensive) checks for duplicate AST nodes after merge |
354 |
+ CHECK_CONSISTENCY = False |
355 |
+diff --git a/mypy/test/testipc.py b/mypy/test/testipc.py |
356 |
+index 1d4829d561..7dd829a590 100644 |
357 |
+--- a/mypy/test/testipc.py |
358 |
++++ b/mypy/test/testipc.py |
359 |
+@@ -3,7 +3,7 @@ |
360 |
+ |
361 |
+ from mypy.ipc import IPCClient, IPCServer |
362 |
+ |
363 |
+-import pytest # type: ignore |
364 |
++import pytest |
365 |
+ import sys |
366 |
+ import time |
367 |
+ |
368 |
+diff --git a/mypy/test/testparse.py b/mypy/test/testparse.py |
369 |
+index e990a403a5..e9ff6839bc 100644 |
370 |
+--- a/mypy/test/testparse.py |
371 |
++++ b/mypy/test/testparse.py |
372 |
+@@ -2,7 +2,7 @@ |
373 |
+ |
374 |
+ import sys |
375 |
+ |
376 |
+-from pytest import skip # type: ignore[import] |
377 |
++from pytest import skip |
378 |
+ |
379 |
+ from mypy import defaults |
380 |
+ from mypy.test.helpers import assert_string_arrays_equal, parse_options |
381 |
+diff --git a/mypy/test/testpep561.py b/mypy/test/testpep561.py |
382 |
+index a8eabd7702..aadf01ae5f 100644 |
383 |
+--- a/mypy/test/testpep561.py |
384 |
++++ b/mypy/test/testpep561.py |
385 |
+@@ -1,6 +1,6 @@ |
386 |
+ from contextlib import contextmanager |
387 |
+ import os |
388 |
+-import pytest # type: ignore |
389 |
++import pytest |
390 |
+ import re |
391 |
+ import subprocess |
392 |
+ from subprocess import PIPE |
393 |
+diff --git a/mypy/test/testpythoneval.py b/mypy/test/testpythoneval.py |
394 |
+index 7586a3854e..e7e9f16183 100644 |
395 |
+--- a/mypy/test/testpythoneval.py |
396 |
++++ b/mypy/test/testpythoneval.py |
397 |
+@@ -18,7 +18,7 @@ |
398 |
+ import sys |
399 |
+ from tempfile import TemporaryDirectory |
400 |
+ |
401 |
+-import pytest # type: ignore # no pytest in typeshed |
402 |
++import pytest |
403 |
+ |
404 |
+ from typing import List |
405 |
+ |
406 |
+diff --git a/mypyc/test/testutil.py b/mypyc/test/testutil.py |
407 |
+index 18ab39a103..c1ce8626ba 100644 |
408 |
+--- a/mypyc/test/testutil.py |
409 |
++++ b/mypyc/test/testutil.py |
410 |
+@@ -7,7 +7,7 @@ |
411 |
+ import shutil |
412 |
+ from typing import List, Callable, Iterator, Optional, Tuple |
413 |
+ |
414 |
+-import pytest # type: ignore[import] |
415 |
++import pytest |
416 |
+ |
417 |
+ from mypy import build |
418 |
+ from mypy.errors import CompileError |
419 |
+diff --git a/pytest.ini b/pytest.ini |
420 |
+index 81586a2370..ed76809091 100644 |
421 |
+--- a/pytest.ini |
422 |
++++ b/pytest.ini |
423 |
+@@ -1,6 +1,5 @@ |
424 |
+ [pytest] |
425 |
+-# testpaths is new in 2.8 |
426 |
+-minversion = 2.8 |
427 |
++minversion = 6.0.0 |
428 |
+ |
429 |
+ testpaths = mypy/test mypyc/test |
430 |
+ |
431 |
|
432 |
diff --git a/dev-python/mypy/mypy-0.782.ebuild b/dev-python/mypy/mypy-0.782.ebuild |
433 |
new file mode 100644 |
434 |
index 00000000000..f6931385e1e |
435 |
--- /dev/null |
436 |
+++ b/dev-python/mypy/mypy-0.782.ebuild |
437 |
@@ -0,0 +1,58 @@ |
438 |
+# Copyright 1999-2020 Gentoo Authors |
439 |
+# Distributed under the terms of the GNU General Public License v2 |
440 |
+ |
441 |
+EAPI=7 |
442 |
+ |
443 |
+PYTHON_COMPAT=( python3_{6..9} ) |
444 |
+DISTUTILS_USE_SETUPTOOLS=rdepend |
445 |
+ |
446 |
+inherit distutils-r1 |
447 |
+ |
448 |
+DESCRIPTION="Optional static typing for Python" |
449 |
+HOMEPAGE="http://www.mypy-lang.org/" |
450 |
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" |
451 |
+ |
452 |
+LICENSE="MIT" |
453 |
+SLOT="0" |
454 |
+KEYWORDS="~amd64 ~arm64 ~x86" |
455 |
+ |
456 |
+# stubgen collides with this package: https://bugs.gentoo.org/585594 |
457 |
+RDEPEND=" |
458 |
+ !dev-util/stubgen |
459 |
+ >=dev-python/psutil-4[${PYTHON_USEDEP}] |
460 |
+ >=dev-python/typed-ast-1.4.0[${PYTHON_USEDEP}] |
461 |
+ <dev-python/typed-ast-1.5.0[${PYTHON_USEDEP}] |
462 |
+ >=dev-python/typing-extensions-3.7.4[${PYTHON_USEDEP}] |
463 |
+ >=dev-python/mypy_extensions-0.4.3[${PYTHON_USEDEP}] |
464 |
+ <dev-python/mypy_extensions-0.5.0[${PYTHON_USEDEP}] |
465 |
+" |
466 |
+BDEPEND=" |
467 |
+ test? ( |
468 |
+ >=dev-python/attrs-18.0[${PYTHON_USEDEP}] |
469 |
+ >=dev-python/lxml-4.4.0[${PYTHON_USEDEP}] |
470 |
+ >=dev-python/pytest-6.0.0[${PYTHON_USEDEP}] |
471 |
+ >=dev-python/pytest-xdist-1.18[${PYTHON_USEDEP}] |
472 |
+ >=dev-python/py-1.5.2[${PYTHON_USEDEP}] |
473 |
+ >=dev-python/virtualenv-16.0.0[${PYTHON_USEDEP}] |
474 |
+ ) |
475 |
+" |
476 |
+ |
477 |
+PATCHES=( |
478 |
+ # The first two patches are backports from upstream commits |
479 |
+ # They should be removed during the next bump |
480 |
+ "${FILESDIR}/${P}-py39-fixes.patch" |
481 |
+ "${FILESDIR}/${P}-pytest-6.patch" |
482 |
+ # Needed to collect all tests |
483 |
+ # https://github.com/python/mypy/pull/9543 |
484 |
+ "${FILESDIR}/${P}-conftest.patch" |
485 |
+) |
486 |
+ |
487 |
+distutils_enable_sphinx docs/source dev-python/sphinx_rtd_theme |
488 |
+distutils_enable_tests pytest |
489 |
+ |
490 |
+python_prepare_all() { |
491 |
+ # https://github.com/python/mypy/commit/2f291f2e312dd3bf2c05c45da0b032b240bfd7ab |
492 |
+ # Avoid a big patch by deleting the file manually |
493 |
+ rm test-data/samples/crawl.py || die |
494 |
+ distutils-r1_python_prepare_all |
495 |
+} |