diff options
Diffstat (limited to 'dev-python/astroid')
-rw-r--r-- | dev-python/astroid/astroid-2.4.2-r1.ebuild | 68 | ||||
-rw-r--r-- | dev-python/astroid/files/astroid-2.4.2-py39.patch | 42 |
2 files changed, 110 insertions, 0 deletions
diff --git a/dev-python/astroid/astroid-2.4.2-r1.ebuild b/dev-python/astroid/astroid-2.4.2-r1.ebuild new file mode 100644 index 000000000000..60e1cbbb76db --- /dev/null +++ b/dev-python/astroid/astroid-2.4.2-r1.ebuild @@ -0,0 +1,68 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{6..9} ) + +inherit distutils-r1 + +DESCRIPTION="Abstract Syntax Tree for logilab packages" +HOMEPAGE="https://github.com/PyCQA/astroid https://pypi.org/project/astroid/" +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" + +LICENSE="LGPL-2.1" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~sparc ~x86" +IUSE="test" +RESTRICT="!test? ( test )" + +# Version specified in __pkginfo__.py. +RDEPEND=" + dev-python/lazy-object-proxy[${PYTHON_USEDEP}] + dev-python/six[${PYTHON_USEDEP}] + >=dev-python/wrapt-1.11.2[${PYTHON_USEDEP}] + >=dev-python/typed-ast-1.4.0[${PYTHON_USEDEP}]" +DEPEND=" + dev-python/setuptools[${PYTHON_USEDEP}] + test? ( + ${RDEPEND} + dev-python/nose[${PYTHON_USEDEP}] + dev-python/numpy[${PYTHON_USEDEP}] + dev-python/pytest[${PYTHON_USEDEP}] + dev-python/python-dateutil[${PYTHON_USEDEP}] + )" + +PATCHES=( + "${FILESDIR}"/astroid-2.4.2-no-pytest-runner.patch + "${FILESDIR}"/astroid-2.4.2-py39.patch +) + +distutils_enable_tests pytest + +python_prepare_all() { + sed -r -e 's:"(wrapt|six|lazy_object_proxy)(~|=)=.+":"\1":' \ + -i astroid/__pkginfo__.py || die + + distutils-r1_python_prepare_all +} + +python_test() { + local deselect=( + # no clue why it's broken + --deselect + tests/unittest_modutils.py::GetModulePartTest::test_knownValues_get_builtin_module_part + ) + [[ ${EPYTHON} == python3.9 ]] && deselect+=( + --deselect + tests/unittest_brain.py::TypingBrain::test_namedtuple_few_args + --deselect + tests/unittest_brain.py::TypingBrain::test_namedtuple_few_fields + --deselect + tests/unittest_brain.py::TypingBrain::test_namedtuple_inference_nonliteral + --deselect + tests/unittest_inference.py::test_dataclasses_subscript_inference_recursion_error + ) + + pytest -vv "${deselect[@]}" || die "Tests failed with ${EPYTHON}" +} diff --git a/dev-python/astroid/files/astroid-2.4.2-py39.patch b/dev-python/astroid/files/astroid-2.4.2-py39.patch new file mode 100644 index 000000000000..0f838b7214a4 --- /dev/null +++ b/dev-python/astroid/files/astroid-2.4.2-py39.patch @@ -0,0 +1,42 @@ +From 3ffe25f8e3cdb30f0dcfb68f4373370828894727 Mon Sep 17 00:00:00 2001 +From: Karthikeyan Singaravelan <tir.karthi@gmail.com> +Date: Tue, 4 Aug 2020 10:11:44 +0000 +Subject: [PATCH] Skip test for | in dictionaries due to PEP-584 in Python 3.9+ + +--- + tests/unittest_inference.py | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/tests/unittest_inference.py b/tests/unittest_inference.py +index 76c7e879..b7bc732d 100644 +--- a/tests/unittest_inference.py ++++ b/tests/unittest_inference.py +@@ -2455,7 +2455,6 @@ def test_binary_op_type_errors(self): + 1 ** (lambda x: x) #@ + {} * {} #@ + {} - {} #@ +- {} | {} #@ + {} >> {} #@ + [] + () #@ + () + [] #@ +@@ -2500,7 +2499,6 @@ def __radd__(self, other): + msg.format(op="**", lhs="int", rhs="function"), + msg.format(op="*", lhs="dict", rhs="dict"), + msg.format(op="-", lhs="dict", rhs="dict"), +- msg.format(op="|", lhs="dict", rhs="dict"), + msg.format(op=">>", lhs="dict", rhs="dict"), + msg.format(op="+", lhs="list", rhs="tuple"), + msg.format(op="+", lhs="tuple", rhs="list"), +@@ -2515,6 +2513,12 @@ def __radd__(self, other): + msg.format(op="+=", lhs="int", rhs="A"), + msg.format(op="+=", lhs="int", rhs="list"), + ] ++ ++ # PEP-584 supports | for dictionary union ++ if sys.version_info < (3, 9): ++ ast_nodes.append(extract_node("{} | {} #@")) ++ expected.append(msg.format(op="|", lhs="dict", rhs="dict")) ++ + for node, expected_value in zip(ast_nodes, expected): + errors = node.type_errors() + self.assertEqual(len(errors), 1) |