1 |
commit: 1d7713cdc9b273e52d8a0b14e84d0fdb63c9966e |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Sep 10 07:32:38 2020 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Sep 10 08:48:51 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1d7713cd |
7 |
|
8 |
dev-python/astroid: Enable py3.9 |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
dev-python/astroid/astroid-2.4.2-r1.ebuild | 68 +++++++++++++++++++++++ |
13 |
dev-python/astroid/files/astroid-2.4.2-py39.patch | 42 ++++++++++++++ |
14 |
2 files changed, 110 insertions(+) |
15 |
|
16 |
diff --git a/dev-python/astroid/astroid-2.4.2-r1.ebuild b/dev-python/astroid/astroid-2.4.2-r1.ebuild |
17 |
new file mode 100644 |
18 |
index 00000000000..60e1cbbb76d |
19 |
--- /dev/null |
20 |
+++ b/dev-python/astroid/astroid-2.4.2-r1.ebuild |
21 |
@@ -0,0 +1,68 @@ |
22 |
+# Copyright 1999-2020 Gentoo Authors |
23 |
+# Distributed under the terms of the GNU General Public License v2 |
24 |
+ |
25 |
+EAPI=7 |
26 |
+ |
27 |
+PYTHON_COMPAT=( python3_{6..9} ) |
28 |
+ |
29 |
+inherit distutils-r1 |
30 |
+ |
31 |
+DESCRIPTION="Abstract Syntax Tree for logilab packages" |
32 |
+HOMEPAGE="https://github.com/PyCQA/astroid https://pypi.org/project/astroid/" |
33 |
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" |
34 |
+ |
35 |
+LICENSE="LGPL-2.1" |
36 |
+SLOT="0" |
37 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~sparc ~x86" |
38 |
+IUSE="test" |
39 |
+RESTRICT="!test? ( test )" |
40 |
+ |
41 |
+# Version specified in __pkginfo__.py. |
42 |
+RDEPEND=" |
43 |
+ dev-python/lazy-object-proxy[${PYTHON_USEDEP}] |
44 |
+ dev-python/six[${PYTHON_USEDEP}] |
45 |
+ >=dev-python/wrapt-1.11.2[${PYTHON_USEDEP}] |
46 |
+ >=dev-python/typed-ast-1.4.0[${PYTHON_USEDEP}]" |
47 |
+DEPEND=" |
48 |
+ dev-python/setuptools[${PYTHON_USEDEP}] |
49 |
+ test? ( |
50 |
+ ${RDEPEND} |
51 |
+ dev-python/nose[${PYTHON_USEDEP}] |
52 |
+ dev-python/numpy[${PYTHON_USEDEP}] |
53 |
+ dev-python/pytest[${PYTHON_USEDEP}] |
54 |
+ dev-python/python-dateutil[${PYTHON_USEDEP}] |
55 |
+ )" |
56 |
+ |
57 |
+PATCHES=( |
58 |
+ "${FILESDIR}"/astroid-2.4.2-no-pytest-runner.patch |
59 |
+ "${FILESDIR}"/astroid-2.4.2-py39.patch |
60 |
+) |
61 |
+ |
62 |
+distutils_enable_tests pytest |
63 |
+ |
64 |
+python_prepare_all() { |
65 |
+ sed -r -e 's:"(wrapt|six|lazy_object_proxy)(~|=)=.+":"\1":' \ |
66 |
+ -i astroid/__pkginfo__.py || die |
67 |
+ |
68 |
+ distutils-r1_python_prepare_all |
69 |
+} |
70 |
+ |
71 |
+python_test() { |
72 |
+ local deselect=( |
73 |
+ # no clue why it's broken |
74 |
+ --deselect |
75 |
+ tests/unittest_modutils.py::GetModulePartTest::test_knownValues_get_builtin_module_part |
76 |
+ ) |
77 |
+ [[ ${EPYTHON} == python3.9 ]] && deselect+=( |
78 |
+ --deselect |
79 |
+ tests/unittest_brain.py::TypingBrain::test_namedtuple_few_args |
80 |
+ --deselect |
81 |
+ tests/unittest_brain.py::TypingBrain::test_namedtuple_few_fields |
82 |
+ --deselect |
83 |
+ tests/unittest_brain.py::TypingBrain::test_namedtuple_inference_nonliteral |
84 |
+ --deselect |
85 |
+ tests/unittest_inference.py::test_dataclasses_subscript_inference_recursion_error |
86 |
+ ) |
87 |
+ |
88 |
+ pytest -vv "${deselect[@]}" || die "Tests failed with ${EPYTHON}" |
89 |
+} |
90 |
|
91 |
diff --git a/dev-python/astroid/files/astroid-2.4.2-py39.patch b/dev-python/astroid/files/astroid-2.4.2-py39.patch |
92 |
new file mode 100644 |
93 |
index 00000000000..0f838b7214a |
94 |
--- /dev/null |
95 |
+++ b/dev-python/astroid/files/astroid-2.4.2-py39.patch |
96 |
@@ -0,0 +1,42 @@ |
97 |
+From 3ffe25f8e3cdb30f0dcfb68f4373370828894727 Mon Sep 17 00:00:00 2001 |
98 |
+From: Karthikeyan Singaravelan <tir.karthi@×××××.com> |
99 |
+Date: Tue, 4 Aug 2020 10:11:44 +0000 |
100 |
+Subject: [PATCH] Skip test for | in dictionaries due to PEP-584 in Python 3.9+ |
101 |
+ |
102 |
+--- |
103 |
+ tests/unittest_inference.py | 8 ++++++-- |
104 |
+ 1 file changed, 6 insertions(+), 2 deletions(-) |
105 |
+ |
106 |
+diff --git a/tests/unittest_inference.py b/tests/unittest_inference.py |
107 |
+index 76c7e879..b7bc732d 100644 |
108 |
+--- a/tests/unittest_inference.py |
109 |
++++ b/tests/unittest_inference.py |
110 |
+@@ -2455,7 +2455,6 @@ def test_binary_op_type_errors(self): |
111 |
+ 1 ** (lambda x: x) #@ |
112 |
+ {} * {} #@ |
113 |
+ {} - {} #@ |
114 |
+- {} | {} #@ |
115 |
+ {} >> {} #@ |
116 |
+ [] + () #@ |
117 |
+ () + [] #@ |
118 |
+@@ -2500,7 +2499,6 @@ def __radd__(self, other): |
119 |
+ msg.format(op="**", lhs="int", rhs="function"), |
120 |
+ msg.format(op="*", lhs="dict", rhs="dict"), |
121 |
+ msg.format(op="-", lhs="dict", rhs="dict"), |
122 |
+- msg.format(op="|", lhs="dict", rhs="dict"), |
123 |
+ msg.format(op=">>", lhs="dict", rhs="dict"), |
124 |
+ msg.format(op="+", lhs="list", rhs="tuple"), |
125 |
+ msg.format(op="+", lhs="tuple", rhs="list"), |
126 |
+@@ -2515,6 +2513,12 @@ def __radd__(self, other): |
127 |
+ msg.format(op="+=", lhs="int", rhs="A"), |
128 |
+ msg.format(op="+=", lhs="int", rhs="list"), |
129 |
+ ] |
130 |
++ |
131 |
++ # PEP-584 supports | for dictionary union |
132 |
++ if sys.version_info < (3, 9): |
133 |
++ ast_nodes.append(extract_node("{} | {} #@")) |
134 |
++ expected.append(msg.format(op="|", lhs="dict", rhs="dict")) |
135 |
++ |
136 |
+ for node, expected_value in zip(ast_nodes, expected): |
137 |
+ errors = node.type_errors() |
138 |
+ self.assertEqual(len(errors), 1) |