diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2020-02-29 18:01:47 +0000 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2020-02-29 18:01:47 +0000 |
commit | ceeeb463cc1eef97fd62eaee8bf2196ba04bc384 (patch) | |
tree | 9f47ee47c31a0f13f9496879cd88a1042550aa81 /dev-python/rope | |
parent | 53cba99042fa967e2a93da9f8db806fe2d035543 (diff) |
gentoo (leap year) resync : 29.02.2020
Diffstat (limited to 'dev-python/rope')
-rw-r--r-- | dev-python/rope/Manifest | 3 | ||||
-rw-r--r-- | dev-python/rope/files/rope-0.16.0-python3.7.patch | 251 | ||||
-rw-r--r-- | dev-python/rope/rope-0.16.0.ebuild | 10 |
3 files changed, 259 insertions, 5 deletions
diff --git a/dev-python/rope/Manifest b/dev-python/rope/Manifest index 89eb0a7b20d9..99b7b9b810dd 100644 --- a/dev-python/rope/Manifest +++ b/dev-python/rope/Manifest @@ -1,6 +1,7 @@ AUX rope-0.10.3-doc-syntax-errors.patch 1207 BLAKE2B 2eb81ffc507c532feff64a09b04e9c098e0d52f702048b2e69abf53b0099454edcb82d866b8b7e83a77e493495a15e3e944f376aa2d1a0e3ddeffebb2435745e SHA512 6bf617e20ef8810496b92cb5e55240622ea7285c435b090254cd9211a29f0c8d103322ed772424cdaeb528dabe1a606adea95647480fed9609e71c29584faaf3 +AUX rope-0.16.0-python3.7.patch 9140 BLAKE2B 911b730957faa7828252f3e4c58ff9d3dfee41c1d2ed841f7df95ba9fb890207a57b5e44ad641f75d5a14ed03112c0fb5c6202d7d5c3fb29e679fb5356fac4a9 SHA512 629deb4f13c207afeb570dfde81c28d8cf623d83dd8b9b004627e50b6634834f308ac7bb450c37d4ffa416b4c5f01d20ba6f071a567b82a4a7647204257f7c59 DIST rope-0.10.7.tar.gz 244089 BLAKE2B aebc1eaa3715aa4f2423490790f53040ad256fca35b3ad7b516e6b1f0af051b79f812f7b701ff5ac2414dbf2d1cba319da0f4cf241041329c0c750ae63e0ec33 SHA512 80343b8b7af883afbd04734b0fe4dbdab114301234654cbd95b3ae8be8dff40878105b7647209f5e899b981ab6a7ecb987d9bdf942b32ed083c745128c22ef95 DIST rope-0.16.0.tar.gz 243304 BLAKE2B 2c41572687ef245eb20abfccebcc9f12ecaa177be313cec59c85be5102b7358566570730a7140f952b0a1c515b479c3d21740d32d4678e65c4c572acf86f4e27 SHA512 33ba57b246337e413126309a521c54e861899b03fd250e148b97d9789cddf6eceab36609ea6e36e84ad1ac514bc3363f4937b01bcb96b6103c2a33bec1d4fb75 EBUILD rope-0.10.7.ebuild 1113 BLAKE2B b2604b27be6546a38eaff0afedc8ba2cc02fbfc25037374be85bd5c0660b02e2d594c9f7eeaeaa35b3045c7b1bbadedfba9f8a2e7c2ac0a552c8037155a420b8 SHA512 9cb3ab0f5d1695bd1c7dbf4bb85c7b14c25f587693e9e75f19f6c54333704185f982e43155446fa472cb5b51dbaa649f28ecca201b110869fc0ee4ab99eb0e44 -EBUILD rope-0.16.0.ebuild 982 BLAKE2B f4cb03afcfdb72051ff4f7cf481f995cb223f795c9e361b229639c00b587e7ceaa529da59bf47786bdac0c4b6f55049069dc70a9a78bb79485c611ebfbac2137 SHA512 d4b1107782253fd0ead95fdb3ddf709b5efc844b1e86154f2bf300a13261ce20b6ba9634f67d8ed17b5c861719ad8edfdb984e2a7144f7a8029a275171ca90dd +EBUILD rope-0.16.0.ebuild 975 BLAKE2B 89c9f51d3778b6489640f0d4511392cf86443fd1f2b0213eed77977e60dffa1d586e38ba03b9fdf6f4781385aa18d9015313344718e0bc1f410cdad38d8ece7e SHA512 10cb6f677aa258cf00853fa75564a6166e093579cf7ee6f3054a213428810379760e6ee2fa87adaf25b47fdd9685037aafc1e63a1aa1fb05ab4ff518022e2dea MISC metadata.xml 517 BLAKE2B 165eea4dc0b2ee1244b9b94f3763c90692c6483d4c09b6535197b34ace789d364c2b63de1dc9d50645ec01cc2975c6f20a95d7756c2bac78a40733e343b7968c SHA512 6289b55677d1e26372017042042229865bad64a396952c21a7d5a1f25322c2ccfed11c0a9ea0c0896573dd1f04dc3263dc3eb28ff7b0b804c2bddf231e924630 diff --git a/dev-python/rope/files/rope-0.16.0-python3.7.patch b/dev-python/rope/files/rope-0.16.0-python3.7.patch new file mode 100644 index 000000000000..d120a8ecc514 --- /dev/null +++ b/dev-python/rope/files/rope-0.16.0-python3.7.patch @@ -0,0 +1,251 @@ +From 5c38f7c8ba23813b475dcb24fa66ed3fc52d1658 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= <mcepl@cepl.eu> +Date: Mon, 13 Jan 2020 15:07:46 +0100 +Subject: [PATCH 1/4] Use .is_alive method instead of a deprecated .isAlive in + threading.Thread + +--- + ropetest/type_hinting_test.py | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/ropetest/type_hinting_test.py b/ropetest/type_hinting_test.py +index 7cc02bb1..afb98e19 100644 +--- a/ropetest/type_hinting_test.py ++++ b/ropetest/type_hinting_test.py +@@ -198,18 +198,18 @@ def test_hint_parametrized_iterable(self): + + self._make_class_hint('collections.Iterable[threading.Thread]') + \ + ' def a_method(self):\n' \ + ' for i in self.a_attr:\n' \ +- ' i.isA' ++ ' i.is_a' + result = self._assist(code) +- self.assert_completion_in_result('isAlive', 'attribute', result) ++ self.assert_completion_in_result('is_alive', 'attribute', result) + + def test_hint_parametrized_iterator(self): + code = 'class Sample(object):\n' \ + + self._make_class_hint('collections.Iterator[threading.Thread]') + \ + ' def a_method(self):\n' \ + ' for i in self.a_attr:\n' \ +- ' i.isA' ++ ' i.is_a' + result = self._assist(code) +- self.assert_completion_in_result('isAlive', 'attribute', result) ++ self.assert_completion_in_result('is_alive', 'attribute', result) + + def test_hint_parametrized_dict_key(self): + code = 'class Sample(object):\n' \ + +From df3567f2afac8b5c5b50f8b7a01e21259e397f81 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= <mcepl@cepl.eu> +Date: Mon, 13 Jan 2020 15:29:14 +0100 +Subject: [PATCH 2/4] Direct import from collections is getting deprecated. + +--- + rope/base/utils/datastructures.py | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/rope/base/utils/datastructures.py b/rope/base/utils/datastructures.py +index 0cb16cf2..3790a6e1 100644 +--- a/rope/base/utils/datastructures.py ++++ b/rope/base/utils/datastructures.py +@@ -1,10 +1,13 @@ + # this snippet was taken from this link + # http://code.activestate.com/recipes/576694/ + +-import collections ++try: ++ from collections import MutableSet ++except ImportError: ++ from collections.abc import MutableSet + + +-class OrderedSet(collections.MutableSet): ++class OrderedSet(MutableSet): + + def __init__(self, iterable=None): + self.end = end = [] + +From fa5626ea99a6cac4780184d708108a98bd7e6095 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= <mcepl@cepl.eu> +Date: Mon, 13 Jan 2020 16:36:01 +0100 +Subject: [PATCH 3/4] Don't use underscored _ast, but use ast instead + +--- + rope/base/ast.py | 15 ++++++++------- + rope/base/utils/pycompat.py | 6 +++--- + 2 files changed, 11 insertions(+), 10 deletions(-) + +diff --git a/rope/base/ast.py b/rope/base/ast.py +index d43c83c5..d24524e7 100644 +--- a/rope/base/ast.py ++++ b/rope/base/ast.py +@@ -1,5 +1,6 @@ +-import _ast +-from _ast import * ++from __future__ import absolute_import ++import ast ++from ast import * + + from rope.base import fscommands + +@@ -18,7 +19,7 @@ def parse(source, filename='<string>'): + if not source.endswith(b'\n'): + source += b'\n' + try: +- return compile(source, filename, 'exec', _ast.PyCF_ONLY_AST) ++ return ast.parse(source, filename='<unknown>') + except (TypeError, ValueError) as e: + error = SyntaxError() + error.lineno = 1 +@@ -32,7 +33,7 @@ def walk(node, walker): + method_name = '_' + node.__class__.__name__ + method = getattr(walker, method_name, None) + if method is not None: +- if isinstance(node, _ast.ImportFrom) and node.module is None: ++ if isinstance(node, ast.ImportFrom) and node.module is None: + # In python < 2.7 ``node.module == ''`` for relative imports + # but for python 2.7 it is None. Generalizing it to ''. + node.module = '' +@@ -42,7 +43,7 @@ def walk(node, walker): + + + def get_child_nodes(node): +- if isinstance(node, _ast.Module): ++ if isinstance(node, ast.Module): + return node.body + result = [] + if node._fields is not None: +@@ -50,9 +51,9 @@ def get_child_nodes(node): + child = getattr(node, name) + if isinstance(child, list): + for entry in child: +- if isinstance(entry, _ast.AST): ++ if isinstance(entry, ast.AST): + result.append(entry) +- if isinstance(child, _ast.AST): ++ if isinstance(child, ast.AST): + result.append(child) + return result + +diff --git a/rope/base/utils/pycompat.py b/rope/base/utils/pycompat.py +index 1214658f..de7cf2e4 100644 +--- a/rope/base/utils/pycompat.py ++++ b/rope/base/utils/pycompat.py +@@ -1,5 +1,5 @@ + import sys +-import _ast ++import ast + # from rope.base import ast + + PY2 = sys.version_info[0] == 2 +@@ -15,7 +15,7 @@ + str = str + string_types = (str,) + import builtins +- ast_arg_type = _ast.arg ++ ast_arg_type = ast.arg + + def execfile(fn, global_vars=None, local_vars=None): + with open(fn) as f: +@@ -34,7 +34,7 @@ def get_ast_with_items(node): + + string_types = (basestring,) + builtins = __import__('__builtin__') +- ast_arg_type = _ast.Name ++ ast_arg_type = ast.Name + execfile = execfile + + def get_ast_arg_arg(node): + +From 431d35d3e7ed2286bea2d13908cd80a0e42a9b13 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= <mcepl@cepl.eu> +Date: Tue, 14 Jan 2020 15:00:36 +0100 +Subject: [PATCH 4/4] Work with deprecated types and using aliased ones. + +Fixes #247 +--- + rope/base/oi/type_hinting/utils.py | 50 ++++++++++++++++++++---------- + 1 file changed, 34 insertions(+), 16 deletions(-) + +diff --git a/rope/base/oi/type_hinting/utils.py b/rope/base/oi/type_hinting/utils.py +index aec82ac0..ce90dfeb 100644 +--- a/rope/base/oi/type_hinting/utils.py ++++ b/rope/base/oi/type_hinting/utils.py +@@ -1,8 +1,12 @@ +-import rope.base.builtins ++import logging ++try: ++ from typing import Union, Optional ++except ImportError: ++ pass + import rope.base.utils as base_utils + from rope.base.evaluate import ScopeNameFinder + from rope.base.exceptions import AttributeNotFoundError +-from rope.base.pyobjects import PyClass, PyFunction ++from rope.base.pyobjects import PyClass, PyDefinedObject, PyFunction, PyObject + from rope.base.utils import pycompat + + +@@ -66,33 +70,47 @@ def get_lineno_for_node(assign_node): + + def get_mro(pyclass): + # FIXME: to use real mro() result +- l = [pyclass] +- for cls in l: ++ class_list = [pyclass] ++ for cls in class_list: + for super_cls in cls.get_superclasses(): +- if isinstance(super_cls, PyClass) and super_cls not in l: +- l.append(super_cls) +- return l ++ if isinstance(super_cls, PyClass) and super_cls not in class_list: ++ class_list.append(super_cls) ++ return class_list + + + def resolve_type(type_name, pyobject): ++ # type: (str, Union[PyDefinedObject, PyObject]) -> Optional[PyDefinedObject, PyObject] + """ +- :type type_name: str +- :type pyobject: rope.base.pyobjects.PyDefinedObject | rope.base.pyobjects.PyObject +- :rtype: rope.base.pyobjects.PyDefinedObject | rope.base.pyobjects.PyObject or None ++ Find proper type object from its name. + """ ++ deprecated_aliases = {'collections': 'collections.abc'} ++ ret_type = None ++ logging.debug('Looking for %s', type_name) + if '.' not in type_name: + try: +- return pyobject.get_module().get_scope().get_name(type_name).get_object() +- except Exception: +- pass ++ ret_type = pyobject.get_module().get_scope().get_name( ++ type_name).get_object() ++ except AttributeNotFoundError: ++ logging.exception('Cannot resolve type %s', type_name) + else: + mod_name, attr_name = type_name.rsplit('.', 1) + try: + mod_finder = ScopeNameFinder(pyobject.get_module()) + mod = mod_finder._find_module(mod_name).get_object() +- return mod.get_attribute(attr_name).get_object() +- except Exception: +- pass ++ ret_type = mod.get_attribute(attr_name).get_object() ++ except AttributeNotFoundError: ++ if mod_name in deprecated_aliases: ++ try: ++ logging.debug('Looking for %s in %s', ++ attr_name, deprecated_aliases[mod_name]) ++ mod = mod_finder._find_module( ++ deprecated_aliases[mod_name]).get_object() ++ ret_type = mod.get_attribute(attr_name).get_object() ++ except AttributeNotFoundError: ++ logging.exception('Cannot resolve type %s in %s', ++ attr_name, dir(mod)) ++ logging.debug('ret_type = %s', ret_type) ++ return ret_type + + + class ParametrizeType(object): diff --git a/dev-python/rope/rope-0.16.0.ebuild b/dev-python/rope/rope-0.16.0.ebuild index a60999bb3c8d..7854b2c3f39a 100644 --- a/dev-python/rope/rope-0.16.0.ebuild +++ b/dev-python/rope/rope-0.16.0.ebuild @@ -21,9 +21,11 @@ IUSE="doc" # setup.py, using standard docutils builds docs successfully. DEPEND="doc? ( dev-python/docutils[${PYTHON_USEDEP}] )" -python_test() { - PYTHONPATH="${BUILD_DIR}/lib:." ${EPYTHON} ropetest/__init__.py -} +PATCHES=( + "${FILESDIR}"/${P}-python3.7.patch +) + +distutils_enable_tests pytest python_compile_all() { if use doc; then @@ -33,7 +35,7 @@ python_compile_all() { for i in ./*.rst; do rst2html.py $i > ./build/${i/rst/html} || die done - popd > /dev/null || die + popd > /dev/null || die fi } |