summaryrefslogtreecommitdiff
path: root/dev-python/python-language-server/files
diff options
context:
space:
mode:
authorAndrew Ammerlaan <andrewammerlaan@riseup.net>2021-04-06 22:56:26 +0200
committerMatt Turner <mattst88@gentoo.org>2021-04-06 17:40:24 -0400
commit6a52187a4127f4ee5df46b1ef82f9fea7b0be1dc (patch)
tree1d74c2ebbb0e228cdec0dd7a98943cec4bf17cdb /dev-python/python-language-server/files
parentdd250d9468d2fb9994855cd2212ad5024a9e447c (diff)
downloadgentoo-6a52187a4127f4ee5df46b1ef82f9fea7b0be1dc.tar.gz
gentoo-6a52187a4127f4ee5df46b1ef82f9fea7b0be1dc.tar.bz2
gentoo-6a52187a4127f4ee5df46b1ef82f9fea7b0be1dc.zip
dev-python/python-language-server: fix py3.9, allow jedi-0.18
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@riseup.net> Closes: https://github.com/gentoo/gentoo/pull/20284 Signed-off-by: Matt Turner <mattst88@gentoo.org>
Diffstat (limited to 'dev-python/python-language-server/files')
-rw-r--r--dev-python/python-language-server/files/pyls-fix-test_folding.patch38
-rw-r--r--dev-python/python-language-server/files/pyls-jedi-18.patch68
-rw-r--r--dev-python/python-language-server/files/pyls-numpy-1.20.patch63
3 files changed, 169 insertions, 0 deletions
diff --git a/dev-python/python-language-server/files/pyls-fix-test_folding.patch b/dev-python/python-language-server/files/pyls-fix-test_folding.patch
new file mode 100644
index 000000000000..6980053bf48a
--- /dev/null
+++ b/dev-python/python-language-server/files/pyls-fix-test_folding.patch
@@ -0,0 +1,38 @@
+From 2d3c52c7b9debd73073650d22a3aa6e86d5491aa Mon Sep 17 00:00:00 2001
+From: Ben Greiner <code@bnavigator.de>
+Date: Thu, 1 Apr 2021 21:33:38 +0200
+Subject: [PATCH 2/2] TST: accept folding of decorator parameters in Python 3.9
+
+---
+ test/plugins/test_folding.py | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/test/plugins/test_folding.py b/test/plugins/test_folding.py
+index 05f0cdd8..91ac0f3b 100644
+--- a/test/plugins/test_folding.py
++++ b/test/plugins/test_folding.py
+@@ -1,11 +1,11 @@
+ # Copyright 2019 Palantir Technologies, Inc.
+
++import sys
+ from textwrap import dedent
+
+ from pyls import uris
+-from pyls.workspace import Document
+ from pyls.plugins.folding import pyls_folding_range
+-
++from pyls.workspace import Document
+
+ DOC_URI = uris.from_fs_path(__file__)
+ DOC = dedent("""
+@@ -146,6 +146,10 @@ def test_folding(workspace):
+ {'startLine': 62, 'endLine': 63},
+ {'startLine': 64, 'endLine': 65},
+ {'startLine': 67, 'endLine': 68}]
++ if sys.version_info[:2] >= (3, 9):
++ # the argument list of the decorator is also folded in Python >= 3.9
++ expected.insert(4, {'startLine': 9, 'endLine': 10})
++
+ assert ranges == expected
+
+
diff --git a/dev-python/python-language-server/files/pyls-jedi-18.patch b/dev-python/python-language-server/files/pyls-jedi-18.patch
new file mode 100644
index 000000000000..1410f3a81dd7
--- /dev/null
+++ b/dev-python/python-language-server/files/pyls-jedi-18.patch
@@ -0,0 +1,68 @@
+From 40afab312a6bf0dcd620c82e59555ea2967aacdf Mon Sep 17 00:00:00 2001
+From: bnavigator <code@bnavigator.de>
+Date: Tue, 5 Jan 2021 01:17:33 +0100
+Subject: [PATCH 1/2] bump jedi compatibility: compare to Path-like object
+
+---
+ pyls/plugins/symbols.py | 2 +-
+ setup.py | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/pyls/plugins/symbols.py b/pyls/plugins/symbols.py
+index 6468dd83..69a09fe9 100644
+--- a/pyls/plugins/symbols.py
++++ b/pyls/plugins/symbols.py
+@@ -37,7 +37,7 @@ def pyls_document_symbols(config, document):
+ not sym_full_name.startswith('__main__')):
+ continue
+
+- if _include_def(d) and document.path == d.module_path:
++ if _include_def(d) and os.path.samefile(document.path, d.module_path):
+ tuple_range = _tuple_range(d)
+ if tuple_range in exclude:
+ continue
+diff --git a/setup.py b/setup.py
+index 12782990..99d2b312 100755
+--- a/setup.py
++++ b/setup.py
+@@ -10,7 +10,7 @@
+ 'configparser; python_version<"3.0"',
+ 'future>=0.14.0; python_version<"3"',
+ 'backports.functools_lru_cache; python_version<"3.2"',
+- 'jedi>=0.17.2,<0.18.0',
++ 'jedi>=0.17.2,<0.19.0',
+ 'python-jsonrpc-server>=0.4.0',
+ 'pluggy',
+ 'ujson<=2.0.3 ; platform_system!="Windows" and python_version<"3.0"',
+
+From e442467312fe967bff5f893b7e3f92da133182c8 Mon Sep 17 00:00:00 2001
+From: bnavigator <code@bnavigator.de>
+Date: Tue, 5 Jan 2021 01:37:25 +0100
+Subject: [PATCH 2/2] Curse you Python 2 on Windows: os.path.samefile not
+ implemented
+
+---
+ pyls/plugins/symbols.py | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/pyls/plugins/symbols.py b/pyls/plugins/symbols.py
+index 69a09fe9..ef8e7fb8 100644
+--- a/pyls/plugins/symbols.py
++++ b/pyls/plugins/symbols.py
+@@ -36,8 +36,14 @@ def pyls_document_symbols(config, document):
+ if (not sym_full_name.startswith(module_name) and
+ not sym_full_name.startswith('__main__')):
+ continue
+-
+- if _include_def(d) and os.path.samefile(document.path, d.module_path):
++ try:
++ docismodule = os.path.samefile(document.path, d.module_path)
++ except AttributeError:
++ # Python 2 on Windows has no .samefile, but then these are
++ # strings for sure
++ docismodule = document.path == d.module_path
++
++ if _include_def(d) and docismodule:
+ tuple_range = _tuple_range(d)
+ if tuple_range in exclude:
+ continue
diff --git a/dev-python/python-language-server/files/pyls-numpy-1.20.patch b/dev-python/python-language-server/files/pyls-numpy-1.20.patch
new file mode 100644
index 000000000000..ab1c5032ff46
--- /dev/null
+++ b/dev-python/python-language-server/files/pyls-numpy-1.20.patch
@@ -0,0 +1,63 @@
+From 48f5eca25c2da064bcc9aa0fefb5de525bec618f Mon Sep 17 00:00:00 2001
+From: Ben Greiner <code@bnavigator.de>
+Date: Tue, 30 Mar 2021 20:20:08 +0200
+Subject: [PATCH 1/3] don't test np.sin hover for numpy 1.20
+
+---
+ test/plugins/test_hover.py | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/test/plugins/test_hover.py b/test/plugins/test_hover.py
+index 2302b865..f36bcb29 100644
+--- a/test/plugins/test_hover.py
++++ b/test/plugins/test_hover.py
+@@ -46,9 +46,13 @@ def test_numpy_hover(workspace):
+ contents = 'NumPy\n=====\n\nProvides\n'
+ assert contents in pyls_hover(doc, numpy_hov_position_3)['contents'][0]
+
+- contents = 'Trigonometric sine, element-wise.\n\n'
+- assert contents in pyls_hover(
+- doc, numpy_sin_hov_position)['contents'][0]
++ # https://github.com/davidhalter/jedi/issues/1746
++ import numpy as np
++
++ if np.lib.NumpyVersion(np.__version__) < '1.20.0':
++ contents = 'Trigonometric sine, element-wise.\n\n'
++ assert contents in pyls_hover(
++ doc, numpy_sin_hov_position)['contents'][0]
+
+
+ def test_hover(workspace):
+
+From 3ee06dac069e27edf6231651ae27bff78ae8aaff Mon Sep 17 00:00:00 2001
+From: Ben Greiner <code@bnavigator.de>
+Date: Tue, 30 Mar 2021 20:21:20 +0200
+Subject: [PATCH 2/3] test snippet support with builtin instead of numpy
+
+---
+ test/plugins/test_completion.py | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/test/plugins/test_completion.py b/test/plugins/test_completion.py
+index 247c2c23..91df89cb 100644
+--- a/test/plugins/test_completion.py
++++ b/test/plugins/test_completion.py
+@@ -216,14 +216,14 @@ def test_completion_with_class_objects(config, workspace):
+
+
+ def test_snippet_parsing(config, workspace):
+- doc = 'import numpy as np\nnp.logical_and'
+- completion_position = {'line': 1, 'character': 14}
++ doc = 'divmod'
++ completion_position = {'line': 0, 'character': 6}
+ doc = Document(DOC_URI, workspace, doc)
+ config.capabilities['textDocument'] = {
+ 'completion': {'completionItem': {'snippetSupport': True}}}
+ config.update({'plugins': {'jedi_completion': {'include_params': True}}})
+ completions = pyls_jedi_completions(config, doc, completion_position)
+- out = 'logical_and(${1:x1}, ${2:x2})$0'
++ out = 'divmod(${1:a}, ${2:b})$0'
+ assert completions[0]['insertText'] == out
+
+
+