diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2020-11-25 22:39:15 +0000 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2020-11-25 22:39:15 +0000 |
commit | d934827bf44b7cfcf6711964418148fa60877668 (patch) | |
tree | 0625f358789b5e015e49db139cc1dbc9be00428f /dev-python/mypy | |
parent | 2e34d110f164bf74d55fced27fe0000201b3eec5 (diff) |
gentoo resync : 25.11.2020
Diffstat (limited to 'dev-python/mypy')
-rw-r--r-- | dev-python/mypy/Manifest | 14 | ||||
-rw-r--r-- | dev-python/mypy/files/mypy-0.782-conftest.patch | 24 | ||||
-rw-r--r-- | dev-python/mypy/files/mypy-0.782-py39-fixes.patch | 138 | ||||
-rw-r--r-- | dev-python/mypy/files/mypy-0.782-pytest-6.patch | 210 | ||||
-rw-r--r-- | dev-python/mypy/files/mypy-0.790-py39-fixes.patch | 161 | ||||
-rw-r--r-- | dev-python/mypy/metadata.xml | 7 | ||||
-rw-r--r-- | dev-python/mypy/mypy-0.781.ebuild | 80 | ||||
-rw-r--r-- | dev-python/mypy/mypy-0.782.ebuild | 58 | ||||
-rw-r--r-- | dev-python/mypy/mypy-0.790.ebuild | 76 |
9 files changed, 684 insertions, 84 deletions
diff --git a/dev-python/mypy/Manifest b/dev-python/mypy/Manifest index f51e4ac22b0c..0b1fed72bbd6 100644 --- a/dev-python/mypy/Manifest +++ b/dev-python/mypy/Manifest @@ -1,4 +1,10 @@ -DIST mypy-0.781.tar.gz 2056785 BLAKE2B aa95d71400d5d46223a141adae5a8d797d2f076d3b6b48a7c09db6f7f3f2193d571368759f0ca307331d8e8c241b0322e758716a10fabccca3aaa6b733a63347 SHA512 dd3173115720510b278d15f5083a57fdb41582dfcaaf16e587116e41e87d608f4e226b61a978f4b41ef6b5ec6d3d9279facd65c0a74888b367171dcbe25550f2 -DIST mypy-typeshed-0.781-e199c2e.tar.gz 541588 BLAKE2B f663d0feccffb315efd1b6e3ebc54bbe3cf4c7873c240ed54c7be1042807e2213326db8756b5a540fd9bf5ae95a2c0850e8cb35ae2e849ec3e9a628367fabe72 SHA512 57f3159d909799838779c04ccc6541322c27c01efb026c26a145676fa75076f64b8cd3e99f7488501582c743e1102cad59320512d52d4a058d8731c54c0705cd -EBUILD mypy-0.781.ebuild 2058 BLAKE2B 25577cc5be2937e8de56bf3f10ef5eb401b0991668e60845908c512baadd20a94f2ae0f954981252d5caa9d07fe1d00824ae0593587aa95b826eb9153d4539bc SHA512 531171f543db569f97a9643165f4794286903fcc5cd5e14004efffa4806c16b24a4b5c8de14398e98e07ba9f76416b4d2e86b1f483f2a3016d494a0fe45f57c7 -MISC metadata.xml 342 BLAKE2B 5004da46f2571d8e3c8ac09beb7e680802ef3ff73b8a2904f79f95f290a5c20aaf72f1008f3c90df08c0cba02257b1629062d58912e6d97b2229f387d7e86229 SHA512 f815bc60369f60a8204fa3aa455cebc961fb3dae4eb013a13314a0dc57e2f7b43426ddc009a05441232e0e0b978da6e97071900ede1239d89ce0301344e5bb27 +AUX mypy-0.782-conftest.patch 707 BLAKE2B dfdda76ca4f73566684d6d5c0bf164237a5d514066a8486877cd1c587175d7f68b5b71c97022d53497e709ad33139f9a2816223f5e871e42af84b51a4fec114b SHA512 556196753551d60270605d98a7d7217f67ebeefc5aa837649150472cfb8fa4f5fb74d697153b76d44a327620e06d687e1838063e741811ac671102e3f6e9da21 +AUX mypy-0.782-py39-fixes.patch 5247 BLAKE2B f4bc4e7c9260618123e4af3069bda9d367f2a5c6fe952502379dd6a35a1c44da8625c087a44cc63bad392545f79ca2d3720962ed73cfcbe97316bc15b2f4eb46 SHA512 d034a32a44c7313174bc5a89797f906b12eb5a3abd8d2839e50a4574a94a9f7574ea5c33a18f333c5566cd899ba066cbf513d2ebf054a8455f035ac61ef08e41 +AUX mypy-0.782-pytest-6.patch 7406 BLAKE2B 7a80f335bc945839f7da33594af7f551dc8127217f1258c020ca290c30f67f819afc51c79748a8f43ad5e0688aa0503df77cd8e7b06d669ab3d536aed8ef4cc9 SHA512 d1d5b62545b06c8ae1137f9781cbfafff1f6464f96b1cde0489125936d0647c3ee1884924501b0cda29018b6ead2c2346dbe713abbb252d122dded5a30a80460 +AUX mypy-0.790-py39-fixes.patch 6631 BLAKE2B 97f2960e231d70c7fcdd3439806ed60c9b81348e920385e7c4c0ed458877bd295199cac75cf2f5a428acefed292af57416423ce7f689667c61d0f822487c1fd1 SHA512 17e353e019064321c62fa3820a7e934a43d03bd179e0a5fc9514d55478d81ab2c851c028703478e5f9dabe2e8d8414335f27ab764bc7fded1afedb794cc09b1e +DIST mypy-0.782.tar.gz 2529814 BLAKE2B c75771fb40524c2c8675236eaaddd6e39d13b4fd4f6f15f279b2e0be75eb0630987cb90f31bd7c65c4a322de4915d3a260e8f6f375b49157fea4b6362316f333 SHA512 f94433f79ea76b53ebb70589ca04ba3f39847050f73cf6deac00a3db13d742613a8ecb1a11fb84a878458025c6776b236b074e93e577c1b597e31d1300974767 +DIST mypy-0.790.tar.gz 2082487 BLAKE2B f8efcb701b4b7533306948721968c9a01ab6c6e56ec99fe6c36e35aca50b52f29f518aee2268a628539a372b8024094ef2d4d87da580b4dd667f41133351596e SHA512 be670456bb64cd197bb6a73832b7e0fd6439ae4af128212328a41cd93d9f644a82e79ffb05bf4695e99bd9788244a24916bf765cf30a6f162cf3b471f45c25b8 +DIST mypy-typeshed-5be9c91.tar.gz 583006 BLAKE2B 08ab2b6d479ccc66493524482051e825c65c0a94ea5cac8e56a8ea1dca85eda6104e4ed3188b7d5ce1ea99058019d66a21a7e270e3ad9df694be67ea1e6a7ce9 SHA512 2912bcf66e0f550941eb9c1f34979644857448a4bec478cfc0d662e9a401ade93ccfb2f57b5348504b4d6f0f23e576da609167f1ec3a0861414fc9c7dea80243 +EBUILD mypy-0.782.ebuild 1732 BLAKE2B 421a685a5fb0be2387eee68c456deec4f5192758005d50692a1dcf0eb99a07aefed0a042edc7c8463de571b72031f87773b3531c9a1a9033655acee54bffdbf1 SHA512 b56841be9080cdce87d8bd8b8ccac677dc0bf67a50e6390d6ea894ef2c528563f692d4cf278d78c6d7a1eec0daa198d7f3a05486d3067942009555302d6732d5 +EBUILD mypy-0.790.ebuild 2384 BLAKE2B 63a59328bf11f2f86c25361c4359ffa330d4a540a255e9bc3ea10ba58e21426de2fd82fedae1713d8963468315cd72251bcaba59ee3a49ac5bd5e06cfb997c76 SHA512 513c8d2ef8533084fa81adb656f729fb4921958c5b39035b0027bb1c899e496ba7f3c419f9542c5adfe871f13f191de62253d02ca727adc29b90fb2920faffbd +MISC metadata.xml 586 BLAKE2B a75692d2b46a9bac5362c4a5111de861297ae5829654d14fa7eaeaaad8eee2ab784017e073423a0e4c8dc845f035884de80c72c73921c01d5fec5b05c3a71c2c SHA512 79916a4aa04010ce67ad08386f0b7e03dfdc6fc0a6195b376c4cd1207ccc408b275efbb3338313db467e3b8fef7abaf93445dc92defa8b9043e497216e0f1045 diff --git a/dev-python/mypy/files/mypy-0.782-conftest.patch b/dev-python/mypy/files/mypy-0.782-conftest.patch new file mode 100644 index 000000000000..08da1b1b690a --- /dev/null +++ b/dev-python/mypy/files/mypy-0.782-conftest.patch @@ -0,0 +1,24 @@ +diff --git a/conftest.py b/conftest.py +new file mode 100644 +index 00000000..83a6689f +--- /dev/null ++++ b/conftest.py +@@ -0,0 +1,18 @@ ++import os.path ++ ++pytest_plugins = [ ++ 'mypy.test.data', ++] ++ ++ ++def pytest_configure(config): ++ mypy_source_root = os.path.dirname(os.path.abspath(__file__)) ++ if os.getcwd() != mypy_source_root: ++ os.chdir(mypy_source_root) ++ ++ ++# This function name is special to pytest. See ++# http://doc.pytest.org/en/latest/writing_plugins.html#initialization-command-line-and-configuration-hooks ++def pytest_addoption(parser) -> None: ++ parser.addoption('--bench', action='store_true', default=False, ++ help='Enable the benchmark test runs') diff --git a/dev-python/mypy/files/mypy-0.782-py39-fixes.patch b/dev-python/mypy/files/mypy-0.782-py39-fixes.patch new file mode 100644 index 000000000000..16c12daecae5 --- /dev/null +++ b/dev-python/mypy/files/mypy-0.782-py39-fixes.patch @@ -0,0 +1,138 @@ +From 13ae58ffe8bedb7da9f4c657297f0d61e681d671 Mon Sep 17 00:00:00 2001 +From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> +Date: Sun, 30 Aug 2020 18:11:57 -0700 +Subject: [PATCH] mypy: get CI green for py39 (#9376) + +Due to Python 3.9's new parser, this has a different (and better) error +message on Python 3.9. + +This is effectively a test of typed_ast / ast, so I don't think it +matters too much. I'm happy to alternatively just get rid of the test +altogether, or if people feel strongly, come up with a way to run the +test when run with older Pythons. + +Co-authored-by: hauntsaninja <> +--- + .travis.yml | 3 --- + mypy/test/testcheck.py | 2 ++ + test-data/unit/check-kwargs.test | 7 ------- + test-data/unit/check-python39.test | 9 +++++++++ + 4 files changed, 11 insertions(+), 10 deletions(-) + create mode 100644 test-data/unit/check-python39.test + +diff --git a/mypy/test/testcheck.py b/mypy/test/testcheck.py +index 49a85861b6..39a35c7280 100644 +--- a/mypy/test/testcheck.py ++++ b/mypy/test/testcheck.py +@@ -94,6 +94,8 @@ + # Tests that use Python 3.8-only AST features (like expression-scoped ignores): + if sys.version_info >= (3, 8): + typecheck_files.append('check-python38.test') ++if sys.version_info >= (3, 9): ++ typecheck_files.append('check-python39.test') + + # Special tests for platforms with case-insensitive filesystems. + if sys.platform in ('darwin', 'win32'): +diff --git a/test-data/unit/check-kwargs.test b/test-data/unit/check-kwargs.test +index 1dd450caae..a587be3e06 100644 +--- a/test-data/unit/check-kwargs.test ++++ b/test-data/unit/check-kwargs.test +@@ -53,13 +53,6 @@ f(b=[], a=A()) + class A: pass + [builtins fixtures/list.pyi] + +-[case testGivingSameKeywordArgumentTwice] +-import typing +-def f(a: 'A', b: 'B') -> None: pass +-f(a=A(), b=B(), a=A()) # E: keyword argument repeated +-class A: pass +-class B: pass +- + [case testGivingArgumentAsPositionalAndKeywordArg] + import typing + def f(a: 'A', b: 'B' = None) -> None: pass +diff --git a/test-data/unit/check-python39.test b/test-data/unit/check-python39.test +new file mode 100644 +index 0000000000..0e9ec683ae +--- /dev/null ++++ b/test-data/unit/check-python39.test +@@ -0,0 +1,9 @@ ++[case testGivingSameKeywordArgumentTwice] ++# This test was originally in check-kwargs.test ++# Python 3.9's new parser started producing a different error message here. Since this isn't the ++# most important test, to deal with this we'll only run this test with Python 3.9 and later. ++import typing ++def f(a: 'A', b: 'B') -> None: pass ++f(a=A(), b=B(), a=A()) # E: "f" gets multiple values for keyword argument "a" ++class A: pass ++class B: pass +From da4430119255ac9205c96d54deb2e2ebed0ce8ce Mon Sep 17 00:00:00 2001 +From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> +Date: Fri, 31 Jul 2020 09:58:15 -0700 +Subject: [PATCH] mypyc: ignore deprecation (#9107) + +PyUnicode_AsUnicodeAndSize has been deprecated since 3.3 + +Python 3.9 has compiler warnings for this deprecated function, and we +compile with Werror, causing Python 3.9 builds to fail. + +I've just copied over the relevant deprecation ignoring code from the +original getargs.c (including the TODO, but I can remove that) + +Co-authored-by: hauntsaninja <> +--- + mypyc/lib-rt/getargs.c | 27 +++++++++++++++++++++++++++ + 1 file changed, 27 insertions(+) + +diff --git a/mypyc/lib-rt/getargs.c b/mypyc/lib-rt/getargs.c +index 32b387c8ab..e6b1a0c937 100644 +--- a/mypyc/lib-rt/getargs.c ++++ b/mypyc/lib-rt/getargs.c +@@ -18,6 +18,29 @@ + * and is responsible for decrefing them. + */ + ++// These macro definitions are copied from pyport.h in Python 3.9 and later ++// https://bugs.python.org/issue19569 ++#if defined(__clang__) ++#define _Py_COMP_DIAG_PUSH _Pragma("clang diagnostic push") ++#define _Py_COMP_DIAG_IGNORE_DEPR_DECLS \ ++ _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") ++#define _Py_COMP_DIAG_POP _Pragma("clang diagnostic pop") ++#elif defined(__GNUC__) \ ++ && ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) ++#define _Py_COMP_DIAG_PUSH _Pragma("GCC diagnostic push") ++#define _Py_COMP_DIAG_IGNORE_DEPR_DECLS \ ++ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") ++#define _Py_COMP_DIAG_POP _Pragma("GCC diagnostic pop") ++#elif defined(_MSC_VER) ++#define _Py_COMP_DIAG_PUSH __pragma(warning(push)) ++#define _Py_COMP_DIAG_IGNORE_DEPR_DECLS __pragma(warning(disable: 4996)) ++#define _Py_COMP_DIAG_POP __pragma(warning(pop)) ++#else ++#define _Py_COMP_DIAG_PUSH ++#define _Py_COMP_DIAG_IGNORE_DEPR_DECLS ++#define _Py_COMP_DIAG_POP ++#endif ++ + #include "Python.h" + #include "pythonsupport.h" + +@@ -756,6 +779,9 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, + case 'u': /* raw unicode buffer (Py_UNICODE *) */ + case 'Z': /* raw unicode buffer or None */ + { ++ // TODO: Raise DeprecationWarning ++_Py_COMP_DIAG_PUSH ++_Py_COMP_DIAG_IGNORE_DEPR_DECLS + Py_UNICODE **p = va_arg(*p_va, Py_UNICODE **); + + if (*format == '#') { +@@ -795,6 +821,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, + arg, msgbuf, bufsize); + } + break; ++_Py_COMP_DIAG_POP + } + + case 'e': {/* encoded string */ diff --git a/dev-python/mypy/files/mypy-0.782-pytest-6.patch b/dev-python/mypy/files/mypy-0.782-pytest-6.patch new file mode 100644 index 000000000000..0252d1138807 --- /dev/null +++ b/dev-python/mypy/files/mypy-0.782-pytest-6.patch @@ -0,0 +1,210 @@ +From 3e77959eacf3d445a0cb4db5a4bc6dcf606fc040 Mon Sep 17 00:00:00 2001 +From: Lawrence Chan <llchan@users.noreply.github.com> +Date: Tue, 4 Aug 2020 18:14:55 -0500 +Subject: [PATCH] Use pytest Node.from_parent if available (#9263) + +* Use pytest Node.from_parent if available + +* Use pytest Node.from_parent unconditionally (requires pytest 5.4+) + +* Bump pytest test requirements + +* Require pytest 6.0 and remove unused type ignores + +* Make flake8 happy +--- + mypy/test/data.py | 37 ++++++++++++++++++++++-------------- + mypy/test/helpers.py | 2 +- + mypy/test/testfinegrained.py | 2 +- + mypy/test/testipc.py | 2 +- + mypy/test/testparse.py | 2 +- + mypy/test/testpep561.py | 2 +- + mypy/test/testpythoneval.py | 2 +- + mypyc/test/testutil.py | 2 +- + pytest.ini | 3 +-- + test-requirements.txt | 9 ++++----- + 10 files changed, 35 insertions(+), 28 deletions(-) + +diff --git a/mypy/test/data.py b/mypy/test/data.py +index 5484fd99e9..a4f2d798b1 100644 +--- a/mypy/test/data.py ++++ b/mypy/test/data.py +@@ -9,7 +9,7 @@ + from abc import abstractmethod + import sys + +-import pytest # type: ignore # no pytest in typeshed ++import pytest + from typing import List, Tuple, Set, Optional, Iterator, Any, Dict, NamedTuple, Union + + from mypy.test.config import test_data_prefix, test_temp_dir, PREFIX +@@ -160,9 +160,12 @@ def parse_test_case(case: 'DataDrivenTestCase') -> None: + case.expected_fine_grained_targets = targets + + +-class DataDrivenTestCase(pytest.Item): # type: ignore # inheriting from Any ++class DataDrivenTestCase(pytest.Item): + """Holds parsed data-driven test cases, and handles directory setup and teardown.""" + ++ # Override parent member type ++ parent = None # type: DataSuiteCollector ++ + input = None # type: List[str] + output = None # type: List[str] # Output for the first pass + output2 = None # type: Dict[int, List[str]] # Output for runs 2+, indexed by run number +@@ -266,7 +269,7 @@ def repr_failure(self, excinfo: Any, style: Optional[Any] = None) -> str: + # call exit() and they already print out a stack trace. + excrepr = excinfo.exconly() + else: +- self.parent._prunetraceback(excinfo) ++ self.parent._prunetraceback(excinfo) # type: ignore[no-untyped-call] + excrepr = excinfo.getrepr(style='short') + + return "data: {}:{}:\n{}".format(self.file, self.line, excrepr) +@@ -510,7 +513,9 @@ def pytest_pycollect_makeitem(collector: Any, name: str, + # Non-None result means this obj is a test case. + # The collect method of the returned DataSuiteCollector instance will be called later, + # with self.obj being obj. +- return DataSuiteCollector(name, parent=collector) ++ return DataSuiteCollector.from_parent( # type: ignore[no-untyped-call] ++ parent=collector, name=name ++ ) + return None + + +@@ -535,19 +540,23 @@ def split_test_cases(parent: 'DataSuiteCollector', suite: 'DataSuite', + for i in range(1, len(cases), 6): + name, writescache, only_when, platform_flag, skip, data = cases[i:i + 6] + platform = platform_flag[1:] if platform_flag else None +- yield DataDrivenTestCase(parent, suite, file, +- name=add_test_name_suffix(name, suite.test_name_suffix), +- writescache=bool(writescache), +- only_when=only_when, +- platform=platform, +- skip=bool(skip), +- data=data, +- line=line_no) ++ yield DataDrivenTestCase.from_parent( ++ parent=parent, ++ suite=suite, ++ file=file, ++ name=add_test_name_suffix(name, suite.test_name_suffix), ++ writescache=bool(writescache), ++ only_when=only_when, ++ platform=platform, ++ skip=bool(skip), ++ data=data, ++ line=line_no, ++ ) + line_no += data.count('\n') + 1 + + +-class DataSuiteCollector(pytest.Class): # type: ignore # inheriting from Any +- def collect(self) -> Iterator[pytest.Item]: # type: ignore ++class DataSuiteCollector(pytest.Class): ++ def collect(self) -> Iterator[pytest.Item]: + """Called by pytest on each of the object returned from pytest_pycollect_makeitem""" + + # obj is the object for which pytest_pycollect_makeitem returned self. +diff --git a/mypy/test/helpers.py b/mypy/test/helpers.py +index 46c01114c4..91c5ff6ab2 100644 +--- a/mypy/test/helpers.py ++++ b/mypy/test/helpers.py +@@ -10,7 +10,7 @@ + from mypy import defaults + import mypy.api as api + +-import pytest # type: ignore # no pytest in typeshed ++import pytest + + # Exporting Suite as alias to TestCase for backwards compatibility + # TODO: avoid aliasing - import and subclass TestCase directly +diff --git a/mypy/test/testfinegrained.py b/mypy/test/testfinegrained.py +index 596391da44..d4ed18cab0 100644 +--- a/mypy/test/testfinegrained.py ++++ b/mypy/test/testfinegrained.py +@@ -35,7 +35,7 @@ + from mypy.config_parser import parse_config_file + from mypy.find_sources import create_source_list + +-import pytest # type: ignore # no pytest in typeshed ++import pytest + + # Set to True to perform (somewhat expensive) checks for duplicate AST nodes after merge + CHECK_CONSISTENCY = False +diff --git a/mypy/test/testipc.py b/mypy/test/testipc.py +index 1d4829d561..7dd829a590 100644 +--- a/mypy/test/testipc.py ++++ b/mypy/test/testipc.py +@@ -3,7 +3,7 @@ + + from mypy.ipc import IPCClient, IPCServer + +-import pytest # type: ignore ++import pytest + import sys + import time + +diff --git a/mypy/test/testparse.py b/mypy/test/testparse.py +index e990a403a5..e9ff6839bc 100644 +--- a/mypy/test/testparse.py ++++ b/mypy/test/testparse.py +@@ -2,7 +2,7 @@ + + import sys + +-from pytest import skip # type: ignore[import] ++from pytest import skip + + from mypy import defaults + from mypy.test.helpers import assert_string_arrays_equal, parse_options +diff --git a/mypy/test/testpep561.py b/mypy/test/testpep561.py +index a8eabd7702..aadf01ae5f 100644 +--- a/mypy/test/testpep561.py ++++ b/mypy/test/testpep561.py +@@ -1,6 +1,6 @@ + from contextlib import contextmanager + import os +-import pytest # type: ignore ++import pytest + import re + import subprocess + from subprocess import PIPE +diff --git a/mypy/test/testpythoneval.py b/mypy/test/testpythoneval.py +index 7586a3854e..e7e9f16183 100644 +--- a/mypy/test/testpythoneval.py ++++ b/mypy/test/testpythoneval.py +@@ -18,7 +18,7 @@ + import sys + from tempfile import TemporaryDirectory + +-import pytest # type: ignore # no pytest in typeshed ++import pytest + + from typing import List + +diff --git a/mypyc/test/testutil.py b/mypyc/test/testutil.py +index 18ab39a103..c1ce8626ba 100644 +--- a/mypyc/test/testutil.py ++++ b/mypyc/test/testutil.py +@@ -7,7 +7,7 @@ + import shutil + from typing import List, Callable, Iterator, Optional, Tuple + +-import pytest # type: ignore[import] ++import pytest + + from mypy import build + from mypy.errors import CompileError +diff --git a/pytest.ini b/pytest.ini +index 81586a2370..ed76809091 100644 +--- a/pytest.ini ++++ b/pytest.ini +@@ -1,6 +1,5 @@ + [pytest] +-# testpaths is new in 2.8 +-minversion = 2.8 ++minversion = 6.0.0 + + testpaths = mypy/test mypyc/test + diff --git a/dev-python/mypy/files/mypy-0.790-py39-fixes.patch b/dev-python/mypy/files/mypy-0.790-py39-fixes.patch new file mode 100644 index 000000000000..a7a581ea8969 --- /dev/null +++ b/dev-python/mypy/files/mypy-0.790-py39-fixes.patch @@ -0,0 +1,161 @@ +From 13ae58ffe8bedb7da9f4c657297f0d61e681d671 Mon Sep 17 00:00:00 2001 +From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> +Date: Sun, 30 Aug 2020 18:11:57 -0700 +Subject: [PATCH] mypy: get CI green for py39 (#9376) + +Due to Python 3.9's new parser, this has a different (and better) error +message on Python 3.9. + +This is effectively a test of typed_ast / ast, so I don't think it +matters too much. I'm happy to alternatively just get rid of the test +altogether, or if people feel strongly, come up with a way to run the +test when run with older Pythons. + +Co-authored-by: hauntsaninja <> +--- + .travis.yml | 3 --- + mypy/test/testcheck.py | 2 ++ + test-data/unit/check-kwargs.test | 7 ------- + test-data/unit/check-python39.test | 9 +++++++++ + 4 files changed, 11 insertions(+), 10 deletions(-) + create mode 100644 test-data/unit/check-python39.test + +diff --git a/mypy/test/testcheck.py b/mypy/test/testcheck.py +index 49a85861b6..39a35c7280 100644 +--- a/mypy/test/testcheck.py ++++ b/mypy/test/testcheck.py +@@ -94,6 +94,8 @@ + # Tests that use Python 3.8-only AST features (like expression-scoped ignores): + if sys.version_info >= (3, 8): + typecheck_files.append('check-python38.test') ++if sys.version_info >= (3, 9): ++ typecheck_files.append('check-python39.test') + + # Special tests for platforms with case-insensitive filesystems. + if sys.platform in ('darwin', 'win32'): +diff --git a/test-data/unit/check-kwargs.test b/test-data/unit/check-kwargs.test +index 1dd450caae..a587be3e06 100644 +--- a/test-data/unit/check-kwargs.test ++++ b/test-data/unit/check-kwargs.test +@@ -53,13 +53,6 @@ f(b=[], a=A()) + class A: pass + [builtins fixtures/list.pyi] + +-[case testGivingSameKeywordArgumentTwice] +-import typing +-def f(a: 'A', b: 'B') -> None: pass +-f(a=A(), b=B(), a=A()) # E: keyword argument repeated +-class A: pass +-class B: pass +- + [case testGivingArgumentAsPositionalAndKeywordArg] + import typing + def f(a: 'A', b: 'B' = None) -> None: pass +diff --git a/test-data/unit/check-python39.test b/test-data/unit/check-python39.test +new file mode 100644 +index 0000000000..0e9ec683ae +--- /dev/null ++++ b/test-data/unit/check-python39.test +@@ -0,0 +1,9 @@ ++[case testGivingSameKeywordArgumentTwice] ++# This test was originally in check-kwargs.test ++# Python 3.9's new parser started producing a different error message here. Since this isn't the ++# most important test, to deal with this we'll only run this test with Python 3.9 and later. ++import typing ++def f(a: 'A', b: 'B') -> None: pass ++f(a=A(), b=B(), a=A()) # E: "f" gets multiple values for keyword argument "a" ++class A: pass ++class B: pass +From ab1bd98cc8a6415398121a47c687ede6f4cca4fd Mon Sep 17 00:00:00 2001 +From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> +Date: Thu, 8 Oct 2020 11:18:18 -0700 +Subject: [PATCH] py39: fix mypyc complaint (#9552) + +I was trying to build wheels for Python 3.9 as part of #9536, but ran +into this issue. You'll notice a couple hundred lines up msullivan +points out that mypyc can't handle conditional method definition, so +that's not an option here. + +Co-authored-by: hauntsaninja <> +--- + mypy/fastparse.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/mypy/fastparse.py b/mypy/fastparse.py +index 2dafbf4e14..0b72214100 100644 +--- a/mypy/fastparse.py ++++ b/mypy/fastparse.py +@@ -1257,11 +1257,13 @@ def visit_Slice(self, n: ast3.Slice) -> SliceExpr: + + # ExtSlice(slice* dims) + def visit_ExtSlice(self, n: ast3.ExtSlice) -> TupleExpr: +- return TupleExpr(self.translate_expr_list(n.dims)) ++ # cast for mypyc's benefit on Python 3.9 ++ return TupleExpr(self.translate_expr_list(cast(Any, n.dims))) + + # Index(expr value) + def visit_Index(self, n: Index) -> Node: +- return self.visit(n.value) ++ # cast for mypyc's benefit on Python 3.9 ++ return self.visit(cast(Any, n.value)) + + + class TypeConverter: +From ffed88fb95fcbfdd1363f0f719bd3e13f8fe20e9 Mon Sep 17 00:00:00 2001 +From: Shantanu <12621235+hauntsaninja@users.noreply.github.com> +Date: Thu, 8 Oct 2020 15:00:42 -0700 +Subject: [PATCH] py39: fix mypyc complaints part 2 (#9562) + +Necessary because I previously didn't actually fix mypyc's complaint + +mypyc has more complaints. +The sys.version_info aliasing works around us hitting +https://github.com/python/mypy/blob/08f207ef4a09f56d710d63775771ae921c41d4bc/mypyc/irbuild/expression.py#L44 + +Co-authored-by: hauntsaninja <> +--- + mypy/fastparse.py | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/mypy/fastparse.py b/mypy/fastparse.py +index 0b72214100..3319cd6489 100644 +--- a/mypy/fastparse.py ++++ b/mypy/fastparse.py +@@ -169,7 +169,9 @@ def parse(source: Union[str, bytes], + tree.path = fnam + tree.is_stub = is_stub_file + except SyntaxError as e: +- if sys.version_info < (3, 9) and e.filename == "<fstring>": ++ # alias to please mypyc ++ is_py38_or_earlier = sys.version_info < (3, 9) ++ if is_py38_or_earlier and e.filename == "<fstring>": + # In Python 3.8 and earlier, syntax errors in f-strings have lineno relative to the + # start of the f-string. This would be misleading, as mypy will report the error as the + # lineno within the file. +@@ -1210,9 +1212,11 @@ def visit_Attribute(self, n: Attribute) -> Union[MemberExpr, SuperExpr]: + def visit_Subscript(self, n: ast3.Subscript) -> IndexExpr: + e = IndexExpr(self.visit(n.value), self.visit(n.slice)) + self.set_line(e, n) ++ # alias to please mypyc ++ is_py38_or_earlier = sys.version_info < (3, 9) + if ( + isinstance(n.slice, ast3.Slice) or +- (sys.version_info < (3, 9) and isinstance(n.slice, ast3.ExtSlice)) ++ (is_py38_or_earlier and isinstance(n.slice, ast3.ExtSlice)) + ): + # Before Python 3.9, Slice has no line/column in the raw ast. To avoid incompatibility + # visit_Slice doesn't set_line, even in Python 3.9 on. +@@ -1258,12 +1262,12 @@ def visit_Slice(self, n: ast3.Slice) -> SliceExpr: + # ExtSlice(slice* dims) + def visit_ExtSlice(self, n: ast3.ExtSlice) -> TupleExpr: + # cast for mypyc's benefit on Python 3.9 +- return TupleExpr(self.translate_expr_list(cast(Any, n.dims))) ++ return TupleExpr(self.translate_expr_list(cast(Any, n).dims)) + + # Index(expr value) + def visit_Index(self, n: Index) -> Node: + # cast for mypyc's benefit on Python 3.9 +- return self.visit(cast(Any, n.value)) ++ return self.visit(cast(Any, n).value) + + + class TypeConverter: diff --git a/dev-python/mypy/metadata.xml b/dev-python/mypy/metadata.xml index a24960ff0e93..5965190b13e4 100644 --- a/dev-python/mypy/metadata.xml +++ b/dev-python/mypy/metadata.xml @@ -5,8 +5,15 @@ <email>ikelos@gentoo.org</email> <name>Mike Auty</name> </maintainer> + <maintainer type="project"> + <email>python@gentoo.org</email> + <name>Python</name> + </maintainer> <stabilize-allarches/> <upstream> <remote-id type="github">python/mypy</remote-id> + <remote-id type="pypi">mypy</remote-id> + <bugs-to>https://github.com/python/mypy/issues</bugs-to> + <doc>https://mypy.readthedocs.io/</doc> </upstream> </pkgmetadata> diff --git a/dev-python/mypy/mypy-0.781.ebuild b/dev-python/mypy/mypy-0.781.ebuild deleted file mode 100644 index 284bb775c477..000000000000 --- a/dev-python/mypy/mypy-0.781.ebuild +++ /dev/null @@ -1,80 +0,0 @@ -# Copyright 1999-2020 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 -PYTHON_COMPAT=( python3_{6,7,8} ) - -inherit distutils-r1 - -if [ "${PV}" == "9999" ]; then - inherit git-r3 - EGIT_REPO_URI="https://github.com/python/${PN}" - SRC_URI="" -else - TYPESHED_COMMIT="e199c2e" - SRC_URI="https://github.com/python/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz - https://api.github.com/repos/python/typeshed/tarball/${TYPESHED_COMMIT} -> mypy-typeshed-${PV}-${TYPESHED_COMMIT}.tar.gz" -fi - -DESCRIPTION="Optional static typing for Python" -HOMEPAGE="http://www.mypy-lang.org/" - -LICENSE="MIT" -SLOT="0" -KEYWORDS="amd64 ~arm64 x86" -IUSE="doc test" - -DEPEND=" - dev-python/setuptools[${PYTHON_USEDEP}] - test? ( dev-python/flake8[${PYTHON_USEDEP}] - >=dev-python/pytest-3.0[${PYTHON_USEDEP}] - >=dev-python/pytest-xdist-1.18[${PYTHON_USEDEP}] - >=dev-python/pytest-cov-2.4.0[${PYTHON_USEDEP}] - >=dev-python/psutil-5.4.0[${PYTHON_USEDEP}] - >=dev-python/lxml-4.1.1[${PYTHON_USEDEP}] - >=dev-python/py-1.5.2[${PYTHON_USEDEP}] - >=dev-python/virtualenv-16.0.0[${PYTHON_USEDEP}] ) - doc? ( - dev-python/sphinx[${PYTHON_USEDEP}] - dev-python/sphinx_rtd_theme[${PYTHON_USEDEP}] - ) -" -CDEPEND=" - !dev-util/stubgen - >=dev-python/psutil-4[${PYTHON_USEDEP}] - >=dev-python/typed-ast-1.4.0[${PYTHON_USEDEP}] - <dev-python/typed-ast-1.5.0[${PYTHON_USEDEP}] - >=dev-python/typing-extensions-3.7.4[${PYTHON_USEDEP}] - >=dev-python/mypy_extensions-0.4.3[${PYTHON_USEDEP}] - <dev-python/mypy_extensions-0.5.0[${PYTHON_USEDEP}] - " - -RDEPEND="${CDEPEND}" - -RESTRICT="!test? ( test )" - -src_unpack() { - if [ "${PV}" == "9999" ]; then - git-r3_src_unpack - else - unpack ${A} - rmdir "${S}/mypy/typeshed" - mv "${WORKDIR}/python-typeshed-${TYPESHED_COMMIT}" "${S}/mypy/typeshed" - fi -} - -python_compile_all() { - use doc && emake -C docs html -} - -python_test() { - local PYTHONPATH="$(pwd)" - - "${PYTHON}" runtests.py || die "tests failed under ${EPYTHON}" -} - -python_install_all() { - use doc && local HTML_DOCS=( docs/build/html/. ) - - distutils-r1_python_install_all -} diff --git a/dev-python/mypy/mypy-0.782.ebuild b/dev-python/mypy/mypy-0.782.ebuild new file mode 100644 index 000000000000..c5290e4f5d94 --- /dev/null +++ b/dev-python/mypy/mypy-0.782.ebuild @@ -0,0 +1,58 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{6..9} ) +DISTUTILS_USE_SETUPTOOLS=rdepend + +inherit distutils-r1 + +DESCRIPTION="Optional static typing for Python" +HOMEPAGE="http://www.mypy-lang.org/" +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="amd64 arm64 ~ia64 x86" + +# stubgen collides with this package: https://bugs.gentoo.org/585594 +RDEPEND=" + !dev-util/stubgen + >=dev-python/psutil-4[${PYTHON_USEDEP}] + >=dev-python/typed-ast-1.4.0[${PYTHON_USEDEP}] + <dev-python/typed-ast-1.5.0[${PYTHON_USEDEP}] + >=dev-python/typing-extensions-3.7.4[${PYTHON_USEDEP}] + >=dev-python/mypy_extensions-0.4.3[${PYTHON_USEDEP}] + <dev-python/mypy_extensions-0.5.0[${PYTHON_USEDEP}] +" +BDEPEND=" + test? ( + >=dev-python/attrs-18.0[${PYTHON_USEDEP}] + >=dev-python/lxml-4.4.0[${PYTHON_USEDEP}] + >=dev-python/pytest-6.0.0[${PYTHON_USEDEP}] + >=dev-python/pytest-xdist-1.18[${PYTHON_USEDEP}] + >=dev-python/py-1.5.2[${PYTHON_USEDEP}] + >=dev-python/virtualenv-16.0.0[${PYTHON_USEDEP}] + ) +" + +PATCHES=( + # The first two patches are backports from upstream commits + # They should be removed during the next bump + "${FILESDIR}/${P}-py39-fixes.patch" + "${FILESDIR}/${P}-pytest-6.patch" + # Needed to collect all tests + # https://github.com/python/mypy/pull/9543 + "${FILESDIR}/${P}-conftest.patch" +) + +distutils_enable_sphinx docs/source dev-python/sphinx_rtd_theme +distutils_enable_tests pytest + +python_prepare_all() { + # https://github.com/python/mypy/commit/2f291f2e312dd3bf2c05c45da0b032b240bfd7ab + # Avoid a big patch by deleting the file manually + rm test-data/samples/crawl.py || die + distutils-r1_python_prepare_all +} diff --git a/dev-python/mypy/mypy-0.790.ebuild b/dev-python/mypy/mypy-0.790.ebuild new file mode 100644 index 000000000000..f2b26d130ce1 --- /dev/null +++ b/dev-python/mypy/mypy-0.790.ebuild @@ -0,0 +1,76 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{6..9} ) +DISTUTILS_USE_SETUPTOOLS=rdepend + +inherit distutils-r1 + +DESCRIPTION="Optional static typing for Python" +HOMEPAGE="http://www.mypy-lang.org/" +# One module is missing from the PyPI tarball +# https://github.com/python/mypy/pull/9587 +# conftest.py is missing at the moment +# https://github.com/python/mypy/pull/9543 +TYPESHED_COMMIT="5be9c91" +SRC_URI=" + https://github.com/python/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz + https://api.github.com/repos/python/typeshed/tarball/${TYPESHED_COMMIT} -> mypy-typeshed-${TYPESHED_COMMIT}.tar.gz +" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~ia64 ~x86" + +# stubgen collides with this package: https://bugs.gentoo.org/585594 +RDEPEND=" + !dev-util/stubgen + >=dev-python/psutil-4[${PYTHON_USEDEP}] + >=dev-python/typed-ast-1.4.0[${PYTHON_USEDEP}] + <dev-python/typed-ast-1.5.0[${PYTHON_USEDEP}] + >=dev-python/typing-extensions-3.7.4[${PYTHON_USEDEP}] + >=dev-python/mypy_extensions-0.4.3[${PYTHON_USEDEP}] + <dev-python/mypy_extensions-0.5.0[${PYTHON_USEDEP}] +" +BDEPEND=" + test? ( + >=dev-python/attrs-18.0[${PYTHON_USEDEP}] + >=dev-python/lxml-4.4.0[${PYTHON_USEDEP}] + >=dev-python/pytest-6.0.0[${PYTHON_USEDEP}] + >=dev-python/pytest-xdist-1.18[${PYTHON_USEDEP}] + >=dev-python/py-1.5.2[${PYTHON_USEDEP}] + >=dev-python/virtualenv-16.0.0[${PYTHON_USEDEP}] + ) +" + +PATCHES=( + # https://github.com/python/mypy/commit/13ae58ffe8bedb7da9f4c657297f0d61e681d671 + # https://github.com/python/mypy/commit/ab1bd98cc8a6415398121a47c687ede6f4cca4fd + # https://github.com/python/mypy/commit/ffed88fb95fcbfdd1363f0f719bd3e13f8fe20e9 + "${FILESDIR}/${P}-py39-fixes.patch" +) + +distutils_enable_sphinx docs/source dev-python/sphinx_rtd_theme +distutils_enable_tests pytest + +src_unpack() { + unpack ${A} + rmdir "${S}/mypy/typeshed" || die + mv "${WORKDIR}/python-typeshed-${TYPESHED_COMMIT}" "${S}/mypy/typeshed" +} + +python_prepare_all() { + # https://github.com/python/mypy/commit/2f291f2e312dd3bf2c05c45da0b032b240bfd7ab + # Avoid a big patch by deleting the file manually + rm test-data/samples/crawl.py || die + distutils-r1_python_prepare_all +} + +python_test() { + # Some mypy/test/testcmdline.py::PythonCmdlineSuite tests + # fail with high COLUMNS values + local -x COLUMNS=80 + pytest -vv || die "Tests fail with ${EPYTHON}" +} |