summaryrefslogtreecommitdiff
path: root/devel
diff options
context:
space:
mode:
authorRainer Hurling <rhurlin@FreeBSD.org>2023-01-14 09:16:28 +0100
committerRainer Hurling <rhurlin@FreeBSD.org>2023-01-14 09:28:25 +0100
commitabc7dd2d594e2537238a5344bf186d286ce219de (patch)
treec6b0849c8527fc9824c5853b21aefbecf09ce31b /devel
parentgraphics/mesa-devel: update to 23.0.b.54 (diff)
devel/py-pyls-black: Use python-lsp-server
Conversion from python-language-server (deprecated) to python-lsp-server by cherry picking from Github[1][2]. No conversion to PEP517, since 2023Q1 does not contain it. This will be done in a follow up commit. [1] https://github.com/rupert/pyls-black/pull/37 [2] https://github.com/rupert/pyls-black/pull/41 PR: 268342 Reported by: p5B2EA84B3@t-online.de MFH: 2023Q1 (cherry picked from commit 4b0bcfb68e9f96e3ace2f359ef99a539b229ee13)
Diffstat (limited to 'devel')
-rw-r--r--devel/py-pyls-black/Makefile2
-rw-r--r--devel/py-pyls-black/files/patch-README.md14
-rw-r--r--devel/py-pyls-black/files/patch-pyls__black_plugin.py41
-rw-r--r--devel/py-pyls-black/files/patch-setup.cfg11
4 files changed, 68 insertions, 0 deletions
diff --git a/devel/py-pyls-black/Makefile b/devel/py-pyls-black/Makefile
index 07333ba8abd6..20c40223ab91 100644
--- a/devel/py-pyls-black/Makefile
+++ b/devel/py-pyls-black/Makefile
@@ -1,5 +1,6 @@
PORTNAME= pyls-black
PORTVERSION= 0.4.7
+PORTREVISION= 1
CATEGORIES= devel python
MASTER_SITES= CHEESESHOP
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
@@ -12,6 +13,7 @@ LICENSE= MIT
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}black>0:devel/py-black@${PY_FLAVOR}
+# No tests because they are not in the release tarball
USES= python:3.6+
USE_PYTHON= autoplist concurrent distutils
diff --git a/devel/py-pyls-black/files/patch-README.md b/devel/py-pyls-black/files/patch-README.md
new file mode 100644
index 000000000000..cb37e192584b
--- /dev/null
+++ b/devel/py-pyls-black/files/patch-README.md
@@ -0,0 +1,14 @@
+--- README.md.orig 2021-06-04 22:43:13 UTC
++++ README.md
+@@ -2,9 +2,9 @@
+
+ [![PyPI](https://img.shields.io/pypi/v/pyls-black.svg)](https://pypi.org/project/pyls-black/) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
+
+-> [Black](https://github.com/ambv/black) plugin for the [Python Language Server](https://github.com/palantir/python-language-server).
++> [Black](https://github.com/ambv/black) plugin for the [Python LSP Server](https://github.com/python-lsp/python-lsp-server).
+
+-In the same `virtualenv` as `python-language-server`:
++In the same `virtualenv` as `python-lsp-server`:
+
+ ```shell
+ pip3 install pyls-black
diff --git a/devel/py-pyls-black/files/patch-pyls__black_plugin.py b/devel/py-pyls-black/files/patch-pyls__black_plugin.py
new file mode 100644
index 000000000000..45cb5e2bddd2
--- /dev/null
+++ b/devel/py-pyls-black/files/patch-pyls__black_plugin.py
@@ -0,0 +1,41 @@
+--- pyls_black/plugin.py.orig 2021-06-04 22:43:13 UTC
++++ pyls_black/plugin.py
+@@ -2,18 +2,18 @@ import toml
+
+ import black
+ import toml
+-from pyls import hookimpl
++from pylsp import hookimpl
+
+ _PY36_VERSIONS = {black.TargetVersion[v] for v in ["PY36", "PY37", "PY38", "PY39"]}
+
+
+ @hookimpl(tryfirst=True)
+-def pyls_format_document(document):
++def pylsp_format_document(document):
+ return format_document(document)
+
+
+ @hookimpl(tryfirst=True)
+-def pyls_format_range(document, range):
++def pylsp_format_range(document, range):
+ range["start"]["character"] = 0
+ range["end"]["line"] += 1
+ range["end"]["character"] = 0
+@@ -73,8 +73,14 @@ def load_config(filename: str) -> Dict:
+
+ root = black.find_project_root((filename,))
+
+- pyproject_filename = root / "pyproject.toml"
+-
++ # Note: find_project_root returns a tuple in 22.1.0+
++ try:
++ # Keeping this to not break backward compatibility.
++ pyproject_filename = root / "pyproject.toml"
++ except TypeError:
++ _root, _ = root
++ pyproject_filename = _root / "pyproject.toml"
++
+ if not pyproject_filename.is_file():
+ return defaults
+
diff --git a/devel/py-pyls-black/files/patch-setup.cfg b/devel/py-pyls-black/files/patch-setup.cfg
new file mode 100644
index 000000000000..a6685da7e681
--- /dev/null
+++ b/devel/py-pyls-black/files/patch-setup.cfg
@@ -0,0 +1,11 @@
+--- setup.cfg.orig 2021-06-04 23:01:09 UTC
++++ setup.cfg
+@@ -14,7 +14,7 @@ packages = find:
+
+ [options]
+ packages = find:
+-install_requires = python-language-server; black>=19.3b0; toml
++install_requires = python-lsp-server; black>=19.3b0; toml
+ python_requires = >= 3.6
+
+ [options.entry_points]