diff options
author | Sam James <sam@gentoo.org> | 2021-02-26 16:46:36 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2021-02-26 16:48:17 +0000 |
commit | 18ccda1e517a9a9237dbeebdfe8ae5a2eb4d4d9a (patch) | |
tree | 2ca450111ce6c2a6ebab264e5009e387557b5f10 /dev-python | |
parent | dev-python/mypy: not suitable for ALLARCHES (diff) | |
download | gentoo-18ccda1e517a9a9237dbeebdfe8ae5a2eb4d4d9a.tar.gz gentoo-18ccda1e517a9a9237dbeebdfe8ae5a2eb4d4d9a.tar.bz2 gentoo-18ccda1e517a9a9237dbeebdfe8ae5a2eb4d4d9a.zip |
dev-python/mypy: "Remove old"
This reverts commit 2d14e70d597d62cdf758f83ed19fc5126179350a.
Bug: https://bugs.gentoo.org/772491
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-python')
-rw-r--r-- | dev-python/mypy/Manifest | 2 | ||||
-rw-r--r-- | dev-python/mypy/files/mypy-0.790-py39-fixes.patch | 161 | ||||
-rw-r--r-- | dev-python/mypy/mypy-0.790.ebuild | 76 |
3 files changed, 239 insertions, 0 deletions
diff --git a/dev-python/mypy/Manifest b/dev-python/mypy/Manifest index 161f8763256d..aa88d3040cac 100644 --- a/dev-python/mypy/Manifest +++ b/dev-python/mypy/Manifest @@ -1,4 +1,6 @@ +DIST mypy-0.790.tar.gz 2082487 BLAKE2B f8efcb701b4b7533306948721968c9a01ab6c6e56ec99fe6c36e35aca50b52f29f518aee2268a628539a372b8024094ef2d4d87da580b4dd667f41133351596e SHA512 be670456bb64cd197bb6a73832b7e0fd6439ae4af128212328a41cd93d9f644a82e79ffb05bf4695e99bd9788244a24916bf765cf30a6f162cf3b471f45c25b8 DIST mypy-0.800.tar.gz 2119165 BLAKE2B 48ead6c893f7055f4b1c0167f61e07b647a15f3a13688e1a93f11ebfdfe70ec3ccba3678bb5cf0e61af8dacfa64c241e5b79f28af55e8bfc5ce0a81c409deca9 SHA512 e267fa288f9c538e5c1d0a115b353aabbfbbd46a372dbaefbf43abeae1e6b88cc1b3e0bb301881f20e20b4e69eeeff4be22cf330bf58eaad09b4ea152ab02c12 DIST mypy-0.812.tar.gz 2122474 BLAKE2B 3bfbfe3010798d49bcf00aa1d926ffa8a54be50fb2e88f4ffc3cde3edba80a9b74853de17126394dc1806c07b740b5f8e7775f2fe4b2312e0a85134b446a690b SHA512 ee89f56a7a01214540f9b727f153a075a097b161b7f654d926d1080ae540ec68303629a4fe691fcb53d37c3eb08924bf01d22cdf1c3761b414a3bc40af3363e6 +DIST mypy-typeshed-5be9c91.tar.gz 583006 BLAKE2B 08ab2b6d479ccc66493524482051e825c65c0a94ea5cac8e56a8ea1dca85eda6104e4ed3188b7d5ce1ea99058019d66a21a7e270e3ad9df694be67ea1e6a7ce9 SHA512 2912bcf66e0f550941eb9c1f34979644857448a4bec478cfc0d662e9a401ade93ccfb2f57b5348504b4d6f0f23e576da609167f1ec3a0861414fc9c7dea80243 DIST typeshed-8cad322a8ccf4b104cafbac2c798413edaa4f327.tar.gz 600618 BLAKE2B acc4397fba21db1bcc7b3ca0922fb561d19161579062e1ee506cadfbbb1de952e36fab6ce552bdca932757274c882a90a948e9dfc257905d7f2e90de9f22bf55 SHA512 728808a568074310bd700a6fe3d667ced01a36f4a6ed2fa6df9d7a784e3167e2c96f7b91dcca1f99d50e325165f3ddea6bbafeab2469a9105c1cb217f16beded DIST typeshed-add4d92f050fb11d3901c6f0ee579a122d4a7a98.tar.gz 600241 BLAKE2B 2bf91ba7bfa2ed3e2369d70ab76ce152e00f321e79f36ef7c264d477e350579eaade222e8347b4105fb93b847d944ce0aa182466ce636649098a2df69c09ee5d SHA512 8497ee9719e162f84556407296d383e0b7e695cf6cd60bbf7f34c1d7aada3926fd5516ce7ea3863e11b3bcb87f12617733082f020718610e467877872f0b4487 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/mypy-0.790.ebuild b/dev-python/mypy/mypy-0.790.ebuild new file mode 100644 index 000000000000..35743fc52044 --- /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_{7..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="~alpha amd64 arm arm64 ~ia64 ppc ppc64 sparc 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}" +} |