Gentoo Archives: gentoo-commits

From: Andrew Ammerlaan <andrewammerlaan@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/python-lsp-server/files/, dev-python/python-lsp-server/
Date: Wed, 20 Oct 2021 11:11:45
Message-Id: 1634728287.4302c3f2a6469ea07d3d6d6c5e365e952c14d3a2.andrewammerlaan@gentoo
1 commit: 4302c3f2a6469ea07d3d6d6c5e365e952c14d3a2
2 Author: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
3 AuthorDate: Wed Oct 20 11:11:27 2021 +0000
4 Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
5 CommitDate: Wed Oct 20 11:11:27 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4302c3f2
7
8 dev-python/python-lsp-server: add version 1.2.4
9
10 - unpin pylint version dep
11 - tests fail with py3.10 in: test_syntax_error_pyflakes
12
13 Package-Manager: Portage-3.0.28, Repoman-3.0.3
14 Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>
15
16 dev-python/python-lsp-server/Manifest | 1 +
17 .../python-lsp-server-1.2.4-unpin-pylint.patch | 254 +++++++++++++++++++++
18 .../python-lsp-server-1.2.4.ebuild | 86 +++++++
19 3 files changed, 341 insertions(+)
20
21 diff --git a/dev-python/python-lsp-server/Manifest b/dev-python/python-lsp-server/Manifest
22 index 613de13e20c..5b458b0658a 100644
23 --- a/dev-python/python-lsp-server/Manifest
24 +++ b/dev-python/python-lsp-server/Manifest
25 @@ -1,2 +1,3 @@
26 DIST python-lsp-server-1.2.2.tar.gz 61742 BLAKE2B d0886549d9ebf79bf97be30abb361be1fdee243abf9ed4707e27857122e9721dcc59f968c4ad7d2904ba11f06e6e6dc34593e5255ce0c9c528defdab7b6e3b7e SHA512 afeb0798fef151ab7cb79b3a0b294a30111d4bb409a4a8ad5148f9cb3dfb9a56e0033541b44a2b683bf043fcb31a8d83a788b0c9c22587b6ae532abb288542a6
27 DIST python-lsp-server-1.2.3.tar.gz 62072 BLAKE2B 3d84e2d1eb77a706eee2da0e02bfab5e075faec9a0279070e2e43bd9dbfb973c6e343c5c2e3826fd64b55987603f7b1b27762d598bd1b5689f2013e3f5d06e90 SHA512 48b9441962d9d00010cee9b482f141259ff4944f737626630ef5051cac82578c9a37f62eea238c6e9df1b90dae739db335195a9eff4f50d0120721763791dad1
28 +DIST python-lsp-server-1.2.4.tar.gz 62073 BLAKE2B b1426d71a4da5ac29fa6b3e956010625d594eee7924a51eb5074933866254189a9738895bc5dd4aae8acc1733b9f162b73646d9a3eee3ac17a587456f2da00e4 SHA512 862d59426c6e7c19f9d3d2766ec5f9ec818d29988ee72cde9553e4b1725fbbe4230ed2f6d7e8d08983c9ef1ced8d5afe42d6751ea529d3d8799c8930b1e10a26
29
30 diff --git a/dev-python/python-lsp-server/files/python-lsp-server-1.2.4-unpin-pylint.patch b/dev-python/python-lsp-server/files/python-lsp-server-1.2.4-unpin-pylint.patch
31 new file mode 100644
32 index 00000000000..8c849720447
33 --- /dev/null
34 +++ b/dev-python/python-lsp-server/files/python-lsp-server-1.2.4-unpin-pylint.patch
35 @@ -0,0 +1,254 @@
36 +diff --git a/.pylintrc b/.pylintrc
37 +index 4249ac5..326751f 100644
38 +--- a/.pylintrc
39 ++++ b/.pylintrc
40 +@@ -16,7 +16,8 @@ disable =
41 + too-few-public-methods,
42 + too-many-arguments,
43 + too-many-instance-attributes,
44 +- import-error
45 ++ import-error,
46 ++ consider-using-f-string,
47 +
48 + [REPORTS]
49 +
50 +diff --git a/pylsp/__main__.py b/pylsp/__main__.py
51 +index a480823..4698d5c 100644
52 +--- a/pylsp/__main__.py
53 ++++ b/pylsp/__main__.py
54 +@@ -92,7 +92,7 @@ def _configure_logger(verbose=0, log_config=None, log_file=None):
55 + root_logger = logging.root
56 +
57 + if log_config:
58 +- with open(log_config, 'r') as f:
59 ++ with open(log_config, 'r', encoding='utf-8') as f:
60 + logging.config.dictConfig(json.load(f))
61 + else:
62 + formatter = logging.Formatter(LOG_FORMAT)
63 +diff --git a/pylsp/_utils.py b/pylsp/_utils.py
64 +index 92376f6..9ac30cf 100644
65 +--- a/pylsp/_utils.py
66 ++++ b/pylsp/_utils.py
67 +@@ -144,8 +144,8 @@ def format_docstring(contents):
68 + Until we can find a fast enough way of discovering and parsing each format,
69 + we can do a little better by at least preserving indentation.
70 + """
71 +- contents = contents.replace('\t', u'\u00A0' * 4)
72 +- contents = contents.replace(' ', u'\u00A0' * 2)
73 ++ contents = contents.replace('\t', '\u00A0' * 4)
74 ++ contents = contents.replace(' ', '\u00A0' * 2)
75 + return contents
76 +
77 +
78 +diff --git a/pylsp/plugins/flake8_lint.py b/pylsp/plugins/flake8_lint.py
79 +index 7ac8c62..aefd09e 100644
80 +--- a/pylsp/plugins/flake8_lint.py
81 ++++ b/pylsp/plugins/flake8_lint.py
82 +@@ -79,7 +79,7 @@ def run_flake8(flake8_executable, args, document):
83 + try:
84 + cmd = [flake8_executable]
85 + cmd.extend(args)
86 +- p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) # pylint: disable=consider-using-with
87 ++ p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
88 + except IOError:
89 + log.debug("Can't execute %s. Trying with 'python -m flake8'", flake8_executable)
90 + cmd = ['python', '-m', 'flake8']
91 +diff --git a/pylsp/plugins/pylint_lint.py b/pylsp/plugins/pylint_lint.py
92 +index bdb65fe..69bad1c 100644
93 +--- a/pylsp/plugins/pylint_lint.py
94 ++++ b/pylsp/plugins/pylint_lint.py
95 +@@ -236,7 +236,7 @@ def _run_pylint_stdio(pylint_executable, document, flags):
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) # pylint: disable=consider-using-with
100 ++ p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
101 + except IOError:
102 + log.debug("Can't execute %s. Trying with 'python -m pylint'", pylint_executable)
103 + cmd = ['python', '-m', 'pylint']
104 +diff --git a/pylsp/workspace.py b/pylsp/workspace.py
105 +index ec031b6..bf312f6 100644
106 +--- a/pylsp/workspace.py
107 ++++ b/pylsp/workspace.py
108 +@@ -76,7 +76,7 @@ def root_uri(self):
109 + return self._root_uri
110 +
111 + def is_local(self):
112 +- return (self._root_uri_scheme == '' or self._root_uri_scheme == 'file') and os.path.exists(self._root_path)
113 ++ return (self._root_uri_scheme in ['', 'file']) and os.path.exists(self._root_path)
114 +
115 + def get_document(self, doc_uri):
116 + """Return a managed document if-present, else create one pointing at disk.
117 +diff --git a/setup.py b/setup.py
118 +index 3f79774..14ade20 100755
119 +--- a/setup.py
120 ++++ b/setup.py
121 +@@ -52,7 +52,7 @@ def get_version(module='pylsp'):
122 + 'pycodestyle>=2.7.0',
123 + 'pydocstyle>=2.0.0',
124 + 'pyflakes>=2.3.0,<2.4.0',
125 +- 'pylint>=2.5.0,<2.10.0',
126 ++ 'pylint>=2.5.0',
127 + 'rope>=0.10.5',
128 + 'yapf',
129 + ],
130 +@@ -62,10 +62,10 @@ def get_version(module='pylsp'):
131 + 'pycodestyle': ['pycodestyle>=2.7.0'],
132 + 'pydocstyle': ['pydocstyle>=2.0.0'],
133 + 'pyflakes': ['pyflakes>=2.3.0,<2.4.0'],
134 +- 'pylint': ['pylint>=2.5.0,<2.10.0'],
135 ++ 'pylint': ['pylint>=2.5.0'],
136 + 'rope': ['rope>0.10.5'],
137 + 'yapf': ['yapf'],
138 +- 'test': ['pylint>=2.5.0,<2.10.0', 'pytest', 'pytest-cov', 'coverage',
139 ++ 'test': ['pylint>=2.5.0', 'pytest', 'pytest-cov', 'coverage',
140 + 'numpy', 'pandas', 'matplotlib', 'pyqt5', 'flaky'],
141 + },
142 + entry_points={
143 +diff --git a/test/fixtures.py b/test/fixtures.py
144 +index 3ced0d5..e57bda6 100644
145 +--- a/test/fixtures.py
146 ++++ b/test/fixtures.py
147 +@@ -101,7 +101,7 @@ def temp_workspace_factory(workspace): # pylint: disable=redefined-outer-name
148 + def fn(files):
149 + def create_file(name, content):
150 + fn = os.path.join(workspace.root_path, name)
151 +- with open(fn, 'w') as f:
152 ++ with open(fn, 'w', encoding='utf-8') as f:
153 + f.write(content)
154 + workspace.put_document(uris.from_fs_path(fn), content)
155 +
156 +diff --git a/test/plugins/test_flake8_lint.py b/test/plugins/test_flake8_lint.py
157 +index 046127c..e82a226 100644
158 +--- a/test/plugins/test_flake8_lint.py
159 ++++ b/test/plugins/test_flake8_lint.py
160 +@@ -93,7 +93,7 @@ def get_flake8_cfg_settings(workspace, config_str):
161 + This function creates a ``setup.cfg``; you'll have to delete it yourself.
162 + """
163 +
164 +- with open(os.path.join(workspace.root_path, "setup.cfg"), "w+") as f:
165 ++ with open(os.path.join(workspace.root_path, "setup.cfg"), "w+", encoding='utf-8') as f:
166 + f.write(config_str)
167 +
168 + workspace.update_config({"pylsp": {"configurationSources": ["flake8"]}})
169 +diff --git a/test/plugins/test_pycodestyle_lint.py b/test/plugins/test_pycodestyle_lint.py
170 +index c0d1d7e..e238147 100644
171 +--- a/test/plugins/test_pycodestyle_lint.py
172 ++++ b/test/plugins/test_pycodestyle_lint.py
173 +@@ -91,7 +91,7 @@ def test_pycodestyle_config(workspace):
174 +
175 + for conf_file, (content, working) in list(content.items()):
176 + # Now we'll add config file to ignore it
177 +- with open(os.path.join(workspace.root_path, conf_file), 'w+') as f:
178 ++ with open(os.path.join(workspace.root_path, conf_file), 'w+', encoding='utf-8') as f:
179 + f.write(content)
180 + workspace._config.settings.cache_clear()
181 +
182 +diff --git a/test/plugins/test_pyflakes_lint.py b/test/plugins/test_pyflakes_lint.py
183 +index 494cb63..d52ac63 100644
184 +--- a/test/plugins/test_pyflakes_lint.py
185 ++++ b/test/plugins/test_pyflakes_lint.py
186 +@@ -21,7 +21,7 @@ def hello():
187 + DOC_UNDEFINED_NAME_ERR = "a = b"
188 +
189 +
190 +-DOC_ENCODING = u"""# encoding=utf-8
191 ++DOC_ENCODING = """# encoding=utf-8
192 + import sys
193 + """
194 +
195 +diff --git a/test/plugins/test_pylint_lint.py b/test/plugins/test_pylint_lint.py
196 +index cf7a7e4..5b5b99c 100644
197 +--- a/test/plugins/test_pylint_lint.py
198 ++++ b/test/plugins/test_pylint_lint.py
199 +@@ -37,7 +37,7 @@ def temp_document(doc_text, workspace):
200 +
201 +
202 + def write_temp_doc(document, contents):
203 +- with open(document.path, 'w') as temp_file:
204 ++ with open(document.path, 'w', encoding='utf-8') as temp_file:
205 + temp_file.write(contents)
206 +
207 +
208 +diff --git a/test/test_document.py b/test/test_document.py
209 +index b543a40..3dcabb6 100644
210 +--- a/test/test_document.py
211 ++++ b/test/test_document.py
212 +@@ -16,7 +16,7 @@ def test_document_lines(doc):
213 +
214 +
215 + def test_document_source_unicode(workspace):
216 +- document_mem = Document(DOC_URI, workspace, u'my source')
217 ++ document_mem = Document(DOC_URI, workspace, 'my source')
218 + document_disk = Document(DOC_URI, workspace)
219 + assert isinstance(document_mem.source, type(document_disk.source))
220 +
221 +@@ -44,27 +44,27 @@ def test_word_at_position(doc):
222 +
223 +
224 + def test_document_empty_edit(workspace):
225 +- doc = Document('file:///uri', workspace, u'')
226 ++ doc = Document('file:///uri', workspace, '')
227 + doc.apply_change({
228 + 'range': {
229 + 'start': {'line': 0, 'character': 0},
230 + 'end': {'line': 0, 'character': 0}
231 + },
232 +- 'text': u'f'
233 ++ 'text': 'f'
234 + })
235 +- assert doc.source == u'f'
236 ++ assert doc.source == 'f'
237 +
238 +
239 + def test_document_line_edit(workspace):
240 +- doc = Document('file:///uri', workspace, u'itshelloworld')
241 ++ doc = Document('file:///uri', workspace, 'itshelloworld')
242 + doc.apply_change({
243 +- 'text': u'goodbye',
244 ++ 'text': 'goodbye',
245 + 'range': {
246 + 'start': {'line': 0, 'character': 3},
247 + 'end': {'line': 0, 'character': 8}
248 + }
249 + })
250 +- assert doc.source == u'itsgoodbyeworld'
251 ++ assert doc.source == 'itsgoodbyeworld'
252 +
253 +
254 + def test_document_multiline_edit(workspace):
255 +@@ -73,8 +73,8 @@ def test_document_multiline_edit(workspace):
256 + " print a\n",
257 + " print b\n"
258 + ]
259 +- doc = Document('file:///uri', workspace, u''.join(old))
260 +- doc.apply_change({'text': u'print a, b', 'range': {
261 ++ doc = Document('file:///uri', workspace, ''.join(old))
262 ++ doc.apply_change({'text': 'print a, b', 'range': {
263 + 'start': {'line': 1, 'character': 4},
264 + 'end': {'line': 2, 'character': 11}
265 + }})
266 +@@ -89,8 +89,8 @@ def test_document_end_of_file_edit(workspace):
267 + "print 'a'\n",
268 + "print 'b'\n"
269 + ]
270 +- doc = Document('file:///uri', workspace, u''.join(old))
271 +- doc.apply_change({'text': u'o', 'range': {
272 ++ doc = Document('file:///uri', workspace, ''.join(old))
273 ++ doc.apply_change({'text': 'o', 'range': {
274 + 'start': {'line': 2, 'character': 0},
275 + 'end': {'line': 2, 'character': 0}
276 + }})
277 +diff --git a/test/test_workspace.py b/test/test_workspace.py
278 +index a008e7e..44d754b 100644
279 +--- a/test/test_workspace.py
280 ++++ b/test/test_workspace.py
281 +@@ -51,7 +51,7 @@ def test_non_root_project(pylsp, metafiles):
282 + os.mkdir(project_root)
283 +
284 + for metafile in metafiles:
285 +- with open(os.path.join(project_root, metafile), 'w+') as f:
286 ++ with open(os.path.join(project_root, metafile), 'w+', encoding='utf-8') as f:
287 + f.write('# ' + metafile)
288 +
289 + test_uri = uris.from_fs_path(os.path.join(project_root, 'hello/test.py'))
290
291 diff --git a/dev-python/python-lsp-server/python-lsp-server-1.2.4.ebuild b/dev-python/python-lsp-server/python-lsp-server-1.2.4.ebuild
292 new file mode 100644
293 index 00000000000..b04edfbecc6
294 --- /dev/null
295 +++ b/dev-python/python-lsp-server/python-lsp-server-1.2.4.ebuild
296 @@ -0,0 +1,86 @@
297 +# Copyright 1999-2021 Gentoo Authors
298 +# Distributed under the terms of the GNU General Public License v2
299 +
300 +EAPI=8
301 +
302 +PYTHON_COMPAT=( python3_{8..9} )
303 +
304 +DISTUTILS_USE_SETUPTOOLS=rdepend
305 +inherit distutils-r1 optfeature
306 +
307 +DESCRIPTION="Python Language Server for the Language Server Protocol"
308 +HOMEPAGE="https://github.com/python-lsp/python-lsp-server"
309 +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
310 +
311 +LICENSE="MIT"
312 +SLOT="0"
313 +KEYWORDS="~amd64 ~arm64 ~x86"
314 +
315 +IUSE="all-plugins"
316 +
317 +BDEPEND="
318 + test? (
319 + dev-python/autopep8[${PYTHON_USEDEP}]
320 + dev-python/flaky[${PYTHON_USEDEP}]
321 + >=dev-python/flake8-3.8.0[${PYTHON_USEDEP}]
322 + <dev-python/flake8-4.0.0[${PYTHON_USEDEP}]
323 + dev-python/matplotlib[${PYTHON_USEDEP}]
324 + >=dev-python/mccabe-0.6.0[${PYTHON_USEDEP}]
325 + <dev-python/mccabe-0.7.0[${PYTHON_USEDEP}]
326 + dev-python/numpy[${PYTHON_USEDEP}]
327 + dev-python/pandas[${PYTHON_USEDEP}]
328 + >=dev-python/pycodestyle-2.7.0[${PYTHON_USEDEP}]
329 + >=dev-python/pydocstyle-2.0.0[${PYTHON_USEDEP}]
330 + >=dev-python/pyflakes-2.3.0[${PYTHON_USEDEP}]
331 + <dev-python/pyflakes-2.4.0[${PYTHON_USEDEP}]
332 + >=dev-python/pylint-2.5.0[${PYTHON_USEDEP}]
333 + dev-python/QtPy[gui,testlib,${PYTHON_USEDEP}]
334 + >=dev-python/rope-0.10.5[${PYTHON_USEDEP}]
335 + dev-python/yapf[${PYTHON_USEDEP}]
336 + )"
337 +
338 +RDEPEND="
339 + >=dev-python/jedi-0.17.2[${PYTHON_USEDEP}]
340 + <dev-python/jedi-0.19.0[${PYTHON_USEDEP}]
341 + >=dev-python/python-lsp-jsonrpc-1.0.0[${PYTHON_USEDEP}]
342 + dev-python/pluggy[${PYTHON_USEDEP}]
343 + all-plugins? (
344 + dev-python/autopep8[${PYTHON_USEDEP}]
345 + >=dev-python/flake8-3.8.0[${PYTHON_USEDEP}]
346 + <dev-python/flake8-4.0.0[${PYTHON_USEDEP}]
347 + >=dev-python/mccabe-0.6.0[${PYTHON_USEDEP}]
348 + <dev-python/mccabe-0.7.0[${PYTHON_USEDEP}]
349 + >=dev-python/pycodestyle-2.7.0[${PYTHON_USEDEP}]
350 + >=dev-python/pydocstyle-2.0.0[${PYTHON_USEDEP}]
351 + >=dev-python/pyflakes-2.3.0[${PYTHON_USEDEP}]
352 + <dev-python/pyflakes-2.4.0[${PYTHON_USEDEP}]
353 + >=dev-python/pylint-2.5.0[${PYTHON_USEDEP}]
354 + >=dev-python/rope-0.10.5[${PYTHON_USEDEP}]
355 + dev-python/yapf[${PYTHON_USEDEP}]
356 + )
357 +"
358 +
359 +PATCHES=(
360 + "${FILESDIR}/${P}-unpin-pylint.patch"
361 +)
362 +
363 +distutils_enable_tests pytest
364 +
365 +python_prepare_all() {
366 + # remove pytest-cov dep
367 + sed -i -e '0,/addopts/I!d' setup.cfg || die
368 +
369 + distutils-r1_python_prepare_all
370 +}
371 +
372 +pkg_postinst() {
373 + optfeature "Automatically formats Python code to conform to the PEP 8 style guide" dev-python/autopep8
374 + optfeature "A wrapper around PyFlakes, pep8 & mccabe" dev-python/flake8
375 + optfeature "flake8 plugin: McCabe complexity checker" dev-python/mccabe
376 + optfeature "Python style guide checker (fka pep8)" dev-python/pycodestyle
377 + optfeature "Python docstring style checker" dev-python/pydocstyle
378 + optfeature "Passive checker for Python programs" dev-python/pyflakes
379 + optfeature "Python code static checker" dev-python/pylint
380 + optfeature "Python refactoring library" dev-python/rope
381 + optfeature "A formatter for Python files" dev-python/yapf
382 +}