Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-python-language-server for 
openSUSE:Factory checked in at 2021-05-16 23:42:06
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-python-language-server (Old)
 and      /work/SRC/openSUSE:Factory/.python-python-language-server.new.2988 
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-python-language-server"

Sun May 16 23:42:06 2021 rev:20 rq:893503 version:0.36.2

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-python-language-server/python-python-language-server.changes
      2021-04-21 21:00:14.818281440 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-python-language-server.new.2988/python-python-language-server.changes
    2021-05-16 23:44:24.293071802 +0200
@@ -1,0 +2,6 @@
+Sun May 16 17:22:42 UTC 2021 - Ben Greiner <[email protected]>
+
+- Add python-lsp-pylint-consider-with.patch in order to fix
+  failures with pylint 2.8, gh#python-lsp/python-lsp-server#20
+
+-------------------------------------------------------------------

New:
----
  python-lsp-pylint-consider-with.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-python-language-server.spec ++++++
--- /var/tmp/diff_new_pack.i1mhPC/_old  2021-05-16 23:44:24.821069756 +0200
+++ /var/tmp/diff_new_pack.i1mhPC/_new  2021-05-16 23:44:24.825069740 +0200
@@ -33,9 +33,11 @@
 Patch2:         test_numpy_hover_fix.patch
 # PATCH-FIX-UPSTREAM test_py39-code_folding.patch -- gh#python-ls/python-ls#9
 Patch3:         test_py39-code_folding.patch
+# PATCH-FIX-UPSTREAM python-lsp-pylint-consider-with.patch -- 
gh#python-lsp/python-lsp-server#20
+Patch4:         python-lsp-pylint-consider-with.patch
 # PATCH-FIX-OPENSUSE pyls-openSUSE-unpin-extras.patch -- unpin extras_requires,
 # because entrypoints requiring pyls[all] now check the requirements in the 
egg-info/requires.txt
-Patch4:         pyls-openSUSE-unpin-extras.patch
+Patch99:        pyls-openSUSE-unpin-extras.patch
 BuildRequires:  %{python_module jedi >= 0.17.2}
 BuildRequires:  %{python_module pluggy}
 BuildRequires:  %{python_module python-jsonrpc-server >= 0.4.0}

++++++ python-lsp-pylint-consider-with.patch ++++++
>From f6d9041b81d142657985b696d8da82cebdbe00bb Mon Sep 17 00:00:00 2001
From: krassowski <[email protected]>
Date: Sun, 25 Apr 2021 21:06:28 +0100
Subject: [PATCH 1/2] Address pylint's "consider-using-with" warnings

---
 pylsp/plugins/flake8_lint.py     | 25 +++++++++++++++----------
 pylsp/plugins/pylint_lint.py     | 28 ++++++++++++++++------------
 test/plugins/test_flake8_lint.py |  7 +++----
 test/plugins/test_pylint_lint.py |  7 +++----
 4 files changed, 37 insertions(+), 30 deletions(-)

diff --git a/pylsp/plugins/flake8_lint.py b/pylsp/plugins/flake8_lint.py
index d632395..dfee5b4 100644
--- a/pyls/plugins/flake8_lint.py
+++ b/pyls/plugins/flake8_lint.py
@@ -5,6 +5,7 @@
 import logging
 import os.path
 import re
+from contextlib import ExitStack
 from subprocess import Popen, PIPE
 from pyls import hookimpl, lsp
 
@@ -65,16 +66,20 @@ def run_flake8(flake8_executable, args, document):
         )
 
     log.debug("Calling %s with args: '%s'", flake8_executable, args)
-    try:
-        cmd = [flake8_executable]
-        cmd.extend(args)
-        p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
-    except IOError:
-        log.debug("Can't execute %s. Trying with 'python -m flake8'", 
flake8_executable)
-        cmd = ['python', '-m', 'flake8']
-        cmd.extend(args)
-        p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
-    (stdout, stderr) = p.communicate(document.source.encode())
+    with ExitStack() as stack:
+        try:
+            cmd = [flake8_executable]
+            cmd.extend(args)
+            p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)  # pylint: 
disable=consider-using-with
+            stack.enter_context(p)
+        except IOError:
+            log.debug("Can't execute %s. Trying with 'python -m flake8'", 
flake8_executable)
+            cmd = ['python', '-m', 'flake8']
+            cmd.extend(args)
+            p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)  # pylint: 
disable=consider-using-with
+            stack.enter_context(p)
+        # exit stack ensures that even if an exception happens, the process 
`p` will be properly terminated
+        (stdout, stderr) = p.communicate(document.source.encode())
     if stderr:
         log.error("Error while running flake8 '%s'", stderr.decode())
     return stdout.decode()
diff --git a/pylsp/plugins/pylint_lint.py b/pyls/plugins/pylint_lint.py
index 5491787..6449cda 100644
--- a/pyls/plugins/pylint_lint.py
+++ b/pyls/plugins/pylint_lint.py
@@ -7,6 +7,7 @@
 import logging
 import sys
 import re
+from contextlib import ExitStack
 from subprocess import Popen, PIPE
 
 from pylint.epylint import py_run
@@ -232,18 +233,21 @@ def _run_pylint_stdio(pylint_executable, document, flags):
     :rtype: string
     """
     log.debug("Calling %s with args: '%s'", pylint_executable, flags)
-    try:
-        cmd = [pylint_executable]
-        cmd.extend(flags)
-        cmd.extend(['--from-stdin', document.path])
-        p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
-    except IOError:
-        log.debug("Can't execute %s. Trying with 'python -m pylint'", 
pylint_executable)
-        cmd = ['python', '-m', 'pylint']
-        cmd.extend(flags)
-        cmd.extend(['--from-stdin', document.path])
-        p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
-    (stdout, stderr) = p.communicate(document.source.encode())
+    with ExitStack() as stack:
+        try:
+            cmd = [pylint_executable]
+            cmd.extend(flags)
+            cmd.extend(['--from-stdin', document.path])
+            p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)  # pylint: 
disable=consider-using-with
+            stack.enter_context(p)
+        except IOError:
+            log.debug("Can't execute %s. Trying with 'python -m pylint'", 
pylint_executable)
+            cmd = ['python', '-m', 'pylint']
+            cmd.extend(flags)
+            cmd.extend(['--from-stdin', document.path])
+            p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)  # pylint: 
disable=consider-using-with
+            stack.enter_context(p)
+        (stdout, stderr) = p.communicate(document.source.encode())
     if stderr:
         log.error("Error while running pylint '%s'", stderr.decode())
     return stdout.decode()
diff --git a/test/plugins/test_flake8_lint.py b/test/plugins/test_flake8_lint.py
index eaabd40..4faf0dd 100644
--- a/test/plugins/test_flake8_lint.py
+++ b/test/plugins/test_flake8_lint.py
@@ -21,10 +21,9 @@ def using_const():
 
 
 def temp_document(doc_text, workspace):
-    temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False)
-    name = temp_file.name
-    temp_file.write(doc_text)
-    temp_file.close()
+    with tempfile.NamedTemporaryFile(mode='w', delete=False) as temp_file:
+        name = temp_file.name
+        temp_file.write(doc_text)
     doc = Document(uris.from_fs_path(name), workspace)
 
     return name, doc
diff --git a/test/plugins/test_pylint_lint.py b/test/plugins/test_pylint_lint.py
index f83e754..cf7a7e4 100644
--- a/test/plugins/test_pylint_lint.py
+++ b/test/plugins/test_pylint_lint.py
@@ -28,10 +28,9 @@ def hello():
 @contextlib.contextmanager
 def temp_document(doc_text, workspace):
     try:
-        temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False)
-        name = temp_file.name
-        temp_file.write(doc_text)
-        temp_file.close()
+        with tempfile.NamedTemporaryFile(mode='w', delete=False) as temp_file:
+            name = temp_file.name
+            temp_file.write(doc_text)
         yield Document(uris.from_fs_path(name), workspace)
     finally:
         os.remove(name)

>From 2d980b6d99b06de827d6589a48a75c6b196b32f4 Mon Sep 17 00:00:00 2001
From: krassowski <[email protected]>
Date: Sun, 25 Apr 2021 22:14:53 +0100
Subject: [PATCH 2/2] Revert the use of ExitStack, as requested

---
 pylsp/plugins/flake8_lint.py | 25 ++++++++++---------------
 pylsp/plugins/pylint_lint.py | 28 ++++++++++++----------------
 2 files changed, 22 insertions(+), 31 deletions(-)

diff --git a/pylsp/plugins/flake8_lint.py b/pylsp/plugins/flake8_lint.py
index dfee5b4..03504ef 100644
--- a/pyls/plugins/flake8_lint.py
+++ b/pyls/plugins/flake8_lint.py
@@ -5,7 +5,6 @@
 import logging
 import os.path
 import re
-from contextlib import ExitStack
 from subprocess import Popen, PIPE
 from pyls import hookimpl, lsp
 
@@ -66,20 +65,16 @@ def run_flake8(flake8_executable, args, document):
         )
 
     log.debug("Calling %s with args: '%s'", flake8_executable, args)
-    with ExitStack() as stack:
-        try:
-            cmd = [flake8_executable]
-            cmd.extend(args)
-            p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)  # pylint: 
disable=consider-using-with
-            stack.enter_context(p)
-        except IOError:
-            log.debug("Can't execute %s. Trying with 'python -m flake8'", 
flake8_executable)
-            cmd = ['python', '-m', 'flake8']
-            cmd.extend(args)
-            p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)  # pylint: 
disable=consider-using-with
-            stack.enter_context(p)
-        # exit stack ensures that even if an exception happens, the process 
`p` will be properly terminated
-        (stdout, stderr) = p.communicate(document.source.encode())
+    try:
+        cmd = [flake8_executable]
+        cmd.extend(args)
+        p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)  # pylint: 
disable=consider-using-with
+    except IOError:
+        log.debug("Can't execute %s. Trying with 'python -m flake8'", 
flake8_executable)
+        cmd = ['python', '-m', 'flake8']
+        cmd.extend(args)
+        p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)  # pylint: 
disable=consider-using-with
+    (stdout, stderr) = p.communicate(document.source.encode())
     if stderr:
         log.error("Error while running flake8 '%s'", stderr.decode())
     return stdout.decode()
diff --git a/pylsp/plugins/pylint_lint.py b/pylsp/plugins/pylint_lint.py
index 6449cda..d5ff3db 100644
--- a/pyls/plugins/pylint_lint.py
+++ b/pyls/plugins/pylint_lint.py
@@ -7,7 +7,6 @@
 import logging
 import sys
 import re
-from contextlib import ExitStack
 from subprocess import Popen, PIPE
 
 from pylint.epylint import py_run
@@ -233,21 +232,18 @@ def _run_pylint_stdio(pylint_executable, document, flags):
     :rtype: string
     """
     log.debug("Calling %s with args: '%s'", pylint_executable, flags)
-    with ExitStack() as stack:
-        try:
-            cmd = [pylint_executable]
-            cmd.extend(flags)
-            cmd.extend(['--from-stdin', document.path])
-            p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)  # pylint: 
disable=consider-using-with
-            stack.enter_context(p)
-        except IOError:
-            log.debug("Can't execute %s. Trying with 'python -m pylint'", 
pylint_executable)
-            cmd = ['python', '-m', 'pylint']
-            cmd.extend(flags)
-            cmd.extend(['--from-stdin', document.path])
-            p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)  # pylint: 
disable=consider-using-with
-            stack.enter_context(p)
-        (stdout, stderr) = p.communicate(document.source.encode())
+    try:
+        cmd = [pylint_executable]
+        cmd.extend(flags)
+        cmd.extend(['--from-stdin', document.path])
+        p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)  # pylint: 
disable=consider-using-with
+    except IOError:
+        log.debug("Can't execute %s. Trying with 'python -m pylint'", 
pylint_executable)
+        cmd = ['python', '-m', 'pylint']
+        cmd.extend(flags)
+        cmd.extend(['--from-stdin', document.path])
+        p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)  # pylint: 
disable=consider-using-with
+    (stdout, stderr) = p.communicate(document.source.encode())
     if stderr:
         log.error("Error while running pylint '%s'", stderr.decode())
     return stdout.decode()

Reply via email to