diff options
Diffstat (limited to 'dev-python/rope')
-rw-r--r-- | dev-python/rope/Manifest | 4 | ||||
-rw-r--r-- | dev-python/rope/files/rope-0.18.0-add-python-3.9-support.patch | 155 | ||||
-rw-r--r-- | dev-python/rope/rope-0.18.0-r1.ebuild | 45 | ||||
-rw-r--r-- | dev-python/rope/rope-0.19.0.ebuild | 40 |
4 files changed, 244 insertions, 0 deletions
diff --git a/dev-python/rope/Manifest b/dev-python/rope/Manifest index 15506473a0f4..8dc143b2a3cb 100644 --- a/dev-python/rope/Manifest +++ b/dev-python/rope/Manifest @@ -1,3 +1,7 @@ +AUX rope-0.18.0-add-python-3.9-support.patch 6673 BLAKE2B 165431552a7973e65c7c4711f5aa350c747989c5f66b00c2f1ae1fb2f71215aa5f483749d93a5807b72c6f4591d9bfe54b30a172bf36719687c0336a7d8200cf SHA512 2f2248374b6b01307b05f478d5ff7df39e1aea470b0255fa8b3e0d58ba87274d24f362c7fbb3f8fd308feeea69f6d8d36c59fdac8c11fa7c814d76c7b86588f0 DIST rope-0.18.0.tar.gz 249828 BLAKE2B 2aac0541936c671f9b70528da28b2c016f14c7a3e5f368aecb6a3f2a39d2b447d70943bf00b7a49702f5d341504da7398ca5b1240d625275f749de1e530fb178 SHA512 9f706da345866447ff7e4027e6f9f0719d4b823253155881efcdd3a9e9a6f42fa9e194cd9547df4a6f752ae0cec739045e52bb7edd5cfa04ad4079fe06808298 +DIST rope-0.19.0.tar.gz 252902 BLAKE2B 41760dc29d26558bdf5f296238b7d59ca949530826953fe5592b763b8d24fb49a90a56b9c7d0e3475daf145185987116a7dd0cbfba74829abfa4bf6a57c79937 SHA512 fd41777d76861837479bf0777ea42cc052eed7ba396bc4531a0c7f101b05b1c5a57c300950b7a3c8a2902e28ff049d146646f83f8a8a447ab9ccd7cd8aa48110 +EBUILD rope-0.18.0-r1.ebuild 996 BLAKE2B 5e68cc3bfd2871d297cdd8e44ecd18f2237b67cebfef7fceb2e640f98c3d69b57ce851c11f7951304ba5b36cd6d2a6a1aa7e600036f177ae6a9d2c4c04974933 SHA512 79b51bea5ec6c99b5dc1aecedc6d2e27872f0f5c5382250cd250be289ea449d029b2a579521eabffc2cda0d17867dbeb616ff09ce53b4dc8043f1aaa76e9549a EBUILD rope-0.18.0.ebuild 1005 BLAKE2B 4fe93b94cddb40f608a5332b4399c00dab4271b3dfa149c7ef6bba520a01b9b96d4d2c9ed05f407e9ece9b2bdf1530c91fdc23b1e7447b142416884ca0f84095 SHA512 b1d514250693320ee18a2fa4fe140ea85587c99056dab720f5d49cd58dd89849944ad472e1b10e39cd2bb02810f21da9b6be01fee693ef924f6fbb67998acc82 +EBUILD rope-0.19.0.ebuild 934 BLAKE2B 10b6f5d2f42695d00aad43a04e34fbb2ccca1766aa19130ebf8ca0f2e78f41ec404ed47b0ed95ed90ab14b7222fefce0c7d87949a2a85c69e8eb6eaf2f73d483 SHA512 5787c9ac2612b1707d561f60ab638ffff5434493749d6d1ae3c1bf426964d148df7ccd419cefcbb250a30635817129518c76b514a6035166c704232195f65f03 MISC metadata.xml 451 BLAKE2B 37ad17660eb9247a5de5ff2974c8ec1a312c87f6bbf79375f0a4bb272277f3fb9af63de230c608f7353209868eb4e4882778fecf7ea3d51ba465d14768470ccb SHA512 756ea4e98b36abd8730139115b84d6779c910fe1e671a40b6bc00ef1a484bfcf54baa40f16f03e7375bd044307ebad51dbfce3fe3d90ed9e87d1568a4ef5a198 diff --git a/dev-python/rope/files/rope-0.18.0-add-python-3.9-support.patch b/dev-python/rope/files/rope-0.18.0-add-python-3.9-support.patch new file mode 100644 index 000000000000..edb5304841db --- /dev/null +++ b/dev-python/rope/files/rope-0.18.0-add-python-3.9-support.patch @@ -0,0 +1,155 @@ +https://github.com/python-rope/rope/pull/333 + +From a63ae26035c5493dc8b7c3bf6a70fc05dba2be98 Mon Sep 17 00:00:00 2001 +From: Matt Turner <mattst88@gmail.com> +Date: Sun, 14 Mar 2021 10:17:47 -0400 +Subject: [PATCH 1/3] Fix test expectations for Python 3.9 AST changes + +Fixes the following two tests under Python 3.9: + +FAILED ropetest/refactor/patchedasttest.py::PatchedASTTest::test_ext_slice_node - AssertionError: Node <ExtSlice> cannot be found +FAILED ropetest/refactor/patchedasttest.py::PatchedASTTest::test_simple_subscript - AssertionError: False is not true : Expected <Index> but was <Constant> + +The ast module in Python 3.9 has some API changes. Quoting [1]: + + Simplified AST for subscription. Simple indices will be represented + by their value, extended slices will be represented as tuples. + Index(value) will return a value itself, ExtSlice(slices) will + return Tuple(slices, Load()). (Contributed by Serhiy Storchaka in + bpo-34822.) + +[1] https://docs.python.org/3/whatsnew/3.9.html#changes-in-the-python-api +--- + ropetest/refactor/patchedasttest.py | 18 +++++++++++++----- + 1 file changed, 13 insertions(+), 5 deletions(-) + +diff --git a/ropetest/refactor/patchedasttest.py b/ropetest/refactor/patchedasttest.py +index 04df3752..74a9d9a6 100644 +--- a/ropetest/refactor/patchedasttest.py ++++ b/ropetest/refactor/patchedasttest.py +@@ -838,8 +838,12 @@ class PatchedASTTest(unittest.TestCase): + source = 'x = xs[0,:]\n' + ast_frag = patchedast.get_patched_ast(source, True) + checker = _ResultChecker(self, ast_frag) +- checker.check_region('ExtSlice', 7, len(source) - 2) +- checker.check_children('ExtSlice', ['Index', '', ',', '', 'Slice']) ++ if sys.version_info >= (3, 9): ++ checker.check_region('Tuple', 7, len(source) - 2) ++ checker.check_children('Tuple', ['Num', '', ',', '', 'Slice']) ++ else: ++ checker.check_region('ExtSlice', 7, len(source) - 2) ++ checker.check_children('ExtSlice', ['Index', '', ',', '', 'Slice']) + + def test_simple_module_node(self): + source = 'pass\n' +@@ -933,9 +937,13 @@ class PatchedASTTest(unittest.TestCase): + source = 'a[1]\n' + ast_frag = patchedast.get_patched_ast(source, True) + checker = _ResultChecker(self, ast_frag) +- checker.check_children( +- 'Subscript', ['Name', '', '[', '', 'Index', '', ']']) +- checker.check_children('Index', ['Num']) ++ if sys.version_info >= (3, 9): ++ checker.check_children( ++ 'Subscript', ['Name', '', '[', '', 'Num', '', ']']) ++ else: ++ checker.check_children( ++ 'Subscript', ['Name', '', '[', '', 'Index', '', ']']) ++ checker.check_children('Index', ['Num']) + + def test_tuple_node(self): + source = '(1, 2)\n' +-- +2.26.2 + +From 02284e4151c2b1d549a64175ef0e3212b7737c56 Mon Sep 17 00:00:00 2001 +From: Matt Turner <mattst88@gmail.com> +Date: Sun, 14 Mar 2021 10:54:48 -0400 +Subject: [PATCH 2/3] Handle AST.expr in _Subscript() + +The ast module in Python 3.9 has some API changes. Quoting [1]: + + Simplified AST for subscription. Simple indices will be represented + by their value, extended slices will be represented as tuples. + Index(value) will return a value itself, ExtSlice(slices) will + return Tuple(slices, Load()). (Contributed by Serhiy Storchaka in + bpo-34822.) + +[1] https://docs.python.org/3/whatsnew/3.9.html#changes-in-the-python-api + +isinstance(thing, ast.Index) always return false in Python >= 3.9, so we +need to handle... whatever the value is now. ast.expr catches 20 of the +remaining 24 failures. The remaining 4 are resolved in the next patch. + +Fixes: #299 +--- + rope/base/evaluate.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/rope/base/evaluate.py b/rope/base/evaluate.py +index 610d34e0..4634981a 100644 +--- a/rope/base/evaluate.py ++++ b/rope/base/evaluate.py +@@ -307,6 +307,9 @@ class StatementEvaluator(object): + elif isinstance(node.slice, ast.Slice): + self._call_function(node.value, '__getitem__', + [node.slice]) ++ elif isinstance(node.slice, ast.expr): ++ self._call_function(node.value, '__getitem__', ++ [node.value]) + + def _Slice(self, node): + self.result = self._get_builtin_name('slice') +-- +2.26.2 + +From 46a3403a06aaadf9d17f87b38300c4e3febe47c5 Mon Sep 17 00:00:00 2001 +From: Matt Turner <mattst88@gmail.com> +Date: Fri, 19 Mar 2021 18:41:53 -0400 +Subject: [PATCH 3/3] Handle AST.expr in static object analysis + +The ast module in Python 3.9 has some API changes. Quoting [1]: + + Simplified AST for subscription. Simple indices will be represented + by their value, extended slices will be represented as tuples. + Index(value) will return a value itself, ExtSlice(slices) will + return Tuple(slices, Load()). (Contributed by Serhiy Storchaka in + bpo-34822.) + +[1] https://docs.python.org/3/whatsnew/3.9.html#changes-in-the-python-api + +This fixes the remaining 4 failures under Python 3.9. + +FAILED ropetest/advanced_oi_test.py::NewStaticOITest::test_static_oi_for_dicts_depending_on_append_function +FAILED ropetest/advanced_oi_test.py::NewStaticOITest::test_static_oi_for_dicts_depending_on_for_loops +FAILED ropetest/advanced_oi_test.py::NewStaticOITest::test_static_oi_for_dicts_depending_on_update +FAILED ropetest/advanced_oi_test.py::NewStaticOITest::test_static_oi_for_lists_per_object_for_set_item + +Fixes: #299 +--- + rope/base/oi/soa.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/rope/base/oi/soa.py b/rope/base/oi/soa.py +index 8ef17aee..20ab567e 100644 +--- a/rope/base/oi/soa.py ++++ b/rope/base/oi/soa.py +@@ -126,7 +126,7 @@ class SOAVisitor(object): + for subscript, levels in nodes: + instance = evaluate.eval_node(self.scope, subscript.value) + args_pynames = [evaluate.eval_node(self.scope, +- subscript.slice.value)] ++ subscript.slice)] + value = rope.base.oi.soi._infer_assignment( + rope.base.pynames.AssignmentValue(node.value, levels, + type_hint=type_hint), +@@ -149,5 +149,5 @@ class _SOAAssignVisitor(astutils._NodeNameCollector): + + def _added(self, node, levels): + if isinstance(node, rope.base.ast.Subscript) and \ +- isinstance(node.slice, rope.base.ast.Index): ++ isinstance(node.slice, (rope.base.ast.Index, rope.base.ast.expr)): + self.nodes.append((node, levels)) +-- +2.26.2 + diff --git a/dev-python/rope/rope-0.18.0-r1.ebuild b/dev-python/rope/rope-0.18.0-r1.ebuild new file mode 100644 index 000000000000..30b91ee55c4e --- /dev/null +++ b/dev-python/rope/rope-0.18.0-r1.ebuild @@ -0,0 +1,45 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{7..9} ) + +inherit distutils-r1 + +DESCRIPTION="Python refactoring library" +HOMEPAGE="https://github.com/python-rope/rope" +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" + +LICENSE="LGPL-3" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~x86 ~amd64-linux ~x86-linux" + +IUSE="doc" + +# Dependency for docbuild documentation which is not noted in +# setup.py, using standard docutils builds docs successfully. +DEPEND="doc? ( dev-python/docutils[${PYTHON_USEDEP}] )" + +PATCHES=( + "${FILESDIR}"/${P}-add-python-3.9-support.patch +) + +distutils_enable_tests pytest + +python_compile_all() { + if use doc; then + pushd docs > /dev/null || die + mkdir build || die + local i + for i in ./*.rst; do + rst2html.py $i > ./build/${i/rst/html} || die + done + popd > /dev/null || die + fi +} + +python_install_all() { + use doc && local HTML_DOCS=( docs/build/. ) + distutils-r1_python_install_all +} diff --git a/dev-python/rope/rope-0.19.0.ebuild b/dev-python/rope/rope-0.19.0.ebuild new file mode 100644 index 000000000000..dff0792c6594 --- /dev/null +++ b/dev-python/rope/rope-0.19.0.ebuild @@ -0,0 +1,40 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{7..9} ) + +inherit distutils-r1 + +DESCRIPTION="Python refactoring library" +HOMEPAGE="https://github.com/python-rope/rope" +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" + +LICENSE="LGPL-3" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~x86 ~amd64-linux ~x86-linux" +IUSE="doc" + +# Dependency for docbuild documentation which is not noted in +# setup.py, using standard docutils builds docs successfully. +BDEPEND="doc? ( dev-python/docutils[${PYTHON_USEDEP}] )" + +distutils_enable_tests pytest + +python_compile_all() { + if use doc; then + pushd docs > /dev/null || die + mkdir build || die + local i + for i in ./*.rst; do + rst2html.py $i > ./build/${i/rst/html} || die + done + popd > /dev/null || die + fi +} + +python_install_all() { + use doc && local HTML_DOCS=( docs/build/. ) + distutils-r1_python_install_all +} |