1 |
commit: 5ed52523ca8b87188a09dc5344f1f3f791c192b8 |
2 |
Author: Michael Mair-Keimberger <mmk <AT> levelnine <DOT> at> |
3 |
AuthorDate: Sun Sep 5 18:23:38 2021 +0000 |
4 |
Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Sep 5 20:07:41 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5ed52523 |
7 |
|
8 |
dev-python/python-lsp-server: remove unused patch(es) |
9 |
|
10 |
Package-Manager: Portage-3.0.22, Repoman-3.0.3 |
11 |
Signed-off-by: Michael Mair-Keimberger <mmk <AT> levelnine.at> |
12 |
Closes: https://github.com/gentoo/gentoo/pull/22226 |
13 |
Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org> |
14 |
|
15 |
.../files/pyls-fix-test-with-pylint28.patch | 237 --------------------- |
16 |
1 file changed, 237 deletions(-) |
17 |
|
18 |
diff --git a/dev-python/python-lsp-server/files/pyls-fix-test-with-pylint28.patch b/dev-python/python-lsp-server/files/pyls-fix-test-with-pylint28.patch |
19 |
deleted file mode 100644 |
20 |
index 99790b6baed..00000000000 |
21 |
--- a/dev-python/python-lsp-server/files/pyls-fix-test-with-pylint28.patch |
22 |
+++ /dev/null |
23 |
@@ -1,237 +0,0 @@ |
24 |
-From f6d9041b81d142657985b696d8da82cebdbe00bb Mon Sep 17 00:00:00 2001 |
25 |
-From: krassowski <krassowski.michal@×××××.com> |
26 |
-Date: Sun, 25 Apr 2021 21:06:28 +0100 |
27 |
-Subject: [PATCH 1/2] Address pylint's "consider-using-with" warnings |
28 |
- |
29 |
---- |
30 |
- pylsp/plugins/flake8_lint.py | 25 +++++++++++++++---------- |
31 |
- pylsp/plugins/pylint_lint.py | 28 ++++++++++++++++------------ |
32 |
- test/plugins/test_flake8_lint.py | 7 +++---- |
33 |
- test/plugins/test_pylint_lint.py | 7 +++---- |
34 |
- 4 files changed, 37 insertions(+), 30 deletions(-) |
35 |
- |
36 |
-diff --git a/pylsp/plugins/flake8_lint.py b/pylsp/plugins/flake8_lint.py |
37 |
-index d632395..dfee5b4 100644 |
38 |
---- a/pylsp/plugins/flake8_lint.py |
39 |
-+++ b/pylsp/plugins/flake8_lint.py |
40 |
-@@ -5,6 +5,7 @@ |
41 |
- import logging |
42 |
- import os.path |
43 |
- import re |
44 |
-+from contextlib import ExitStack |
45 |
- from subprocess import Popen, PIPE |
46 |
- from pylsp import hookimpl, lsp |
47 |
- |
48 |
-@@ -65,16 +66,20 @@ def run_flake8(flake8_executable, args, document): |
49 |
- ) |
50 |
- |
51 |
- log.debug("Calling %s with args: '%s'", flake8_executable, args) |
52 |
-- try: |
53 |
-- cmd = [flake8_executable] |
54 |
-- cmd.extend(args) |
55 |
-- p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) |
56 |
-- except IOError: |
57 |
-- log.debug("Can't execute %s. Trying with 'python -m flake8'", flake8_executable) |
58 |
-- cmd = ['python', '-m', 'flake8'] |
59 |
-- cmd.extend(args) |
60 |
-- p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) |
61 |
-- (stdout, stderr) = p.communicate(document.source.encode()) |
62 |
-+ with ExitStack() as stack: |
63 |
-+ try: |
64 |
-+ cmd = [flake8_executable] |
65 |
-+ cmd.extend(args) |
66 |
-+ p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) # pylint: disable=consider-using-with |
67 |
-+ stack.enter_context(p) |
68 |
-+ except IOError: |
69 |
-+ log.debug("Can't execute %s. Trying with 'python -m flake8'", flake8_executable) |
70 |
-+ cmd = ['python', '-m', 'flake8'] |
71 |
-+ cmd.extend(args) |
72 |
-+ p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) # pylint: disable=consider-using-with |
73 |
-+ stack.enter_context(p) |
74 |
-+ # exit stack ensures that even if an exception happens, the process `p` will be properly terminated |
75 |
-+ (stdout, stderr) = p.communicate(document.source.encode()) |
76 |
- if stderr: |
77 |
- log.error("Error while running flake8 '%s'", stderr.decode()) |
78 |
- return stdout.decode() |
79 |
-diff --git a/pylsp/plugins/pylint_lint.py b/pylsp/plugins/pylint_lint.py |
80 |
-index 5491787..6449cda 100644 |
81 |
---- a/pylsp/plugins/pylint_lint.py |
82 |
-+++ b/pylsp/plugins/pylint_lint.py |
83 |
-@@ -7,6 +7,7 @@ |
84 |
- import logging |
85 |
- import sys |
86 |
- import re |
87 |
-+from contextlib import ExitStack |
88 |
- from subprocess import Popen, PIPE |
89 |
- |
90 |
- from pylint.epylint import py_run |
91 |
-@@ -232,18 +233,21 @@ def _run_pylint_stdio(pylint_executable, document, flags): |
92 |
- :rtype: string |
93 |
- """ |
94 |
- log.debug("Calling %s with args: '%s'", pylint_executable, flags) |
95 |
-- try: |
96 |
-- cmd = [pylint_executable] |
97 |
-- cmd.extend(flags) |
98 |
-- cmd.extend(['--from-stdin', document.path]) |
99 |
-- p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) |
100 |
-- except IOError: |
101 |
-- log.debug("Can't execute %s. Trying with 'python -m pylint'", pylint_executable) |
102 |
-- cmd = ['python', '-m', 'pylint'] |
103 |
-- cmd.extend(flags) |
104 |
-- cmd.extend(['--from-stdin', document.path]) |
105 |
-- p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) |
106 |
-- (stdout, stderr) = p.communicate(document.source.encode()) |
107 |
-+ with ExitStack() as stack: |
108 |
-+ try: |
109 |
-+ cmd = [pylint_executable] |
110 |
-+ cmd.extend(flags) |
111 |
-+ cmd.extend(['--from-stdin', document.path]) |
112 |
-+ p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) # pylint: disable=consider-using-with |
113 |
-+ stack.enter_context(p) |
114 |
-+ except IOError: |
115 |
-+ log.debug("Can't execute %s. Trying with 'python -m pylint'", pylint_executable) |
116 |
-+ cmd = ['python', '-m', 'pylint'] |
117 |
-+ cmd.extend(flags) |
118 |
-+ cmd.extend(['--from-stdin', document.path]) |
119 |
-+ p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) # pylint: disable=consider-using-with |
120 |
-+ stack.enter_context(p) |
121 |
-+ (stdout, stderr) = p.communicate(document.source.encode()) |
122 |
- if stderr: |
123 |
- log.error("Error while running pylint '%s'", stderr.decode()) |
124 |
- return stdout.decode() |
125 |
-diff --git a/test/plugins/test_flake8_lint.py b/test/plugins/test_flake8_lint.py |
126 |
-index eaabd40..4faf0dd 100644 |
127 |
---- a/test/plugins/test_flake8_lint.py |
128 |
-+++ b/test/plugins/test_flake8_lint.py |
129 |
-@@ -21,10 +21,9 @@ def using_const(): |
130 |
- |
131 |
- |
132 |
- def temp_document(doc_text, workspace): |
133 |
-- temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False) |
134 |
-- name = temp_file.name |
135 |
-- temp_file.write(doc_text) |
136 |
-- temp_file.close() |
137 |
-+ with tempfile.NamedTemporaryFile(mode='w', delete=False) as temp_file: |
138 |
-+ name = temp_file.name |
139 |
-+ temp_file.write(doc_text) |
140 |
- doc = Document(uris.from_fs_path(name), workspace) |
141 |
- |
142 |
- return name, doc |
143 |
-diff --git a/test/plugins/test_pylint_lint.py b/test/plugins/test_pylint_lint.py |
144 |
-index f83e754..cf7a7e4 100644 |
145 |
---- a/test/plugins/test_pylint_lint.py |
146 |
-+++ b/test/plugins/test_pylint_lint.py |
147 |
-@@ -28,10 +28,9 @@ def hello(): |
148 |
- @contextlib.contextmanager |
149 |
- def temp_document(doc_text, workspace): |
150 |
- try: |
151 |
-- temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False) |
152 |
-- name = temp_file.name |
153 |
-- temp_file.write(doc_text) |
154 |
-- temp_file.close() |
155 |
-+ with tempfile.NamedTemporaryFile(mode='w', delete=False) as temp_file: |
156 |
-+ name = temp_file.name |
157 |
-+ temp_file.write(doc_text) |
158 |
- yield Document(uris.from_fs_path(name), workspace) |
159 |
- finally: |
160 |
- os.remove(name) |
161 |
- |
162 |
-From 2d980b6d99b06de827d6589a48a75c6b196b32f4 Mon Sep 17 00:00:00 2001 |
163 |
-From: krassowski <krassowski.michal@×××××.com> |
164 |
-Date: Sun, 25 Apr 2021 22:14:53 +0100 |
165 |
-Subject: [PATCH 2/2] Revert the use of ExitStack, as requested |
166 |
- |
167 |
---- |
168 |
- pylsp/plugins/flake8_lint.py | 25 ++++++++++--------------- |
169 |
- pylsp/plugins/pylint_lint.py | 28 ++++++++++++---------------- |
170 |
- 2 files changed, 22 insertions(+), 31 deletions(-) |
171 |
- |
172 |
-diff --git a/pylsp/plugins/flake8_lint.py b/pylsp/plugins/flake8_lint.py |
173 |
-index dfee5b4..03504ef 100644 |
174 |
---- a/pylsp/plugins/flake8_lint.py |
175 |
-+++ b/pylsp/plugins/flake8_lint.py |
176 |
-@@ -5,7 +5,6 @@ |
177 |
- import logging |
178 |
- import os.path |
179 |
- import re |
180 |
--from contextlib import ExitStack |
181 |
- from subprocess import Popen, PIPE |
182 |
- from pylsp import hookimpl, lsp |
183 |
- |
184 |
-@@ -66,20 +65,16 @@ def run_flake8(flake8_executable, args, document): |
185 |
- ) |
186 |
- |
187 |
- log.debug("Calling %s with args: '%s'", flake8_executable, args) |
188 |
-- with ExitStack() as stack: |
189 |
-- try: |
190 |
-- cmd = [flake8_executable] |
191 |
-- cmd.extend(args) |
192 |
-- p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) # pylint: disable=consider-using-with |
193 |
-- stack.enter_context(p) |
194 |
-- except IOError: |
195 |
-- log.debug("Can't execute %s. Trying with 'python -m flake8'", flake8_executable) |
196 |
-- cmd = ['python', '-m', 'flake8'] |
197 |
-- cmd.extend(args) |
198 |
-- p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) # pylint: disable=consider-using-with |
199 |
-- stack.enter_context(p) |
200 |
-- # exit stack ensures that even if an exception happens, the process `p` will be properly terminated |
201 |
-- (stdout, stderr) = p.communicate(document.source.encode()) |
202 |
-+ try: |
203 |
-+ cmd = [flake8_executable] |
204 |
-+ cmd.extend(args) |
205 |
-+ p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) # pylint: disable=consider-using-with |
206 |
-+ except IOError: |
207 |
-+ log.debug("Can't execute %s. Trying with 'python -m flake8'", flake8_executable) |
208 |
-+ cmd = ['python', '-m', 'flake8'] |
209 |
-+ cmd.extend(args) |
210 |
-+ p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) # pylint: disable=consider-using-with |
211 |
-+ (stdout, stderr) = p.communicate(document.source.encode()) |
212 |
- if stderr: |
213 |
- log.error("Error while running flake8 '%s'", stderr.decode()) |
214 |
- return stdout.decode() |
215 |
-diff --git a/pylsp/plugins/pylint_lint.py b/pylsp/plugins/pylint_lint.py |
216 |
-index 6449cda..d5ff3db 100644 |
217 |
---- a/pylsp/plugins/pylint_lint.py |
218 |
-+++ b/pylsp/plugins/pylint_lint.py |
219 |
-@@ -7,7 +7,6 @@ |
220 |
- import logging |
221 |
- import sys |
222 |
- import re |
223 |
--from contextlib import ExitStack |
224 |
- from subprocess import Popen, PIPE |
225 |
- |
226 |
- from pylint.epylint import py_run |
227 |
-@@ -233,21 +232,18 @@ def _run_pylint_stdio(pylint_executable, document, flags): |
228 |
- :rtype: string |
229 |
- """ |
230 |
- log.debug("Calling %s with args: '%s'", pylint_executable, flags) |
231 |
-- with ExitStack() as stack: |
232 |
-- try: |
233 |
-- cmd = [pylint_executable] |
234 |
-- cmd.extend(flags) |
235 |
-- cmd.extend(['--from-stdin', document.path]) |
236 |
-- p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) # pylint: disable=consider-using-with |
237 |
-- stack.enter_context(p) |
238 |
-- except IOError: |
239 |
-- log.debug("Can't execute %s. Trying with 'python -m pylint'", pylint_executable) |
240 |
-- cmd = ['python', '-m', 'pylint'] |
241 |
-- cmd.extend(flags) |
242 |
-- cmd.extend(['--from-stdin', document.path]) |
243 |
-- p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) # pylint: disable=consider-using-with |
244 |
-- stack.enter_context(p) |
245 |
-- (stdout, stderr) = p.communicate(document.source.encode()) |
246 |
-+ try: |
247 |
-+ cmd = [pylint_executable] |
248 |
-+ cmd.extend(flags) |
249 |
-+ cmd.extend(['--from-stdin', document.path]) |
250 |
-+ p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) # pylint: disable=consider-using-with |
251 |
-+ except IOError: |
252 |
-+ log.debug("Can't execute %s. Trying with 'python -m pylint'", pylint_executable) |
253 |
-+ cmd = ['python', '-m', 'pylint'] |
254 |
-+ cmd.extend(flags) |
255 |
-+ cmd.extend(['--from-stdin', document.path]) |
256 |
-+ p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) # pylint: disable=consider-using-with |
257 |
-+ (stdout, stderr) = p.communicate(document.source.encode()) |
258 |
- if stderr: |
259 |
- log.error("Error while running pylint '%s'", stderr.decode()) |
260 |
- return stdout.decode() |