public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-lsp-black] rawhide: Unretirement request: https://forge.fedoraproject.org/releng/fedora-scm-requests/issues/1742
@ 2026-11-05 14:39 releng-bot
  0 siblings, 0 replies; only message in thread
From: releng-bot @ 2026-11-05 14:39 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/python-lsp-black
Branch : rawhide
Commit : df3334dc68f4939408a2d19f2929920ed7cbafca
Author : releng-bot <releng-bot@fedoraproject.org>
Date   : 2026-11-05T14:39:23+00:00
Stats  : +284/-1 in 9 file(s)
URL    : https://src.fedoraproject.org/rpms/python-lsp-black/c/df3334dc68f4939408a2d19f2929920ed7cbafca?branch=rawhide

Log:
Unretirement request: https://forge.fedoraproject.org/releng/fedora-scm-requests/issues/1742

---
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5d3f1f0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+/python-lsp-black-1.0.0.tar.gz
+/python-lsp-black-1.2.0.tar.gz
+/python-lsp-black-1.3.0.tar.gz
+/python-lsp-black-2.0.0.tar.gz

diff --git a/56.patch b/56.patch
new file mode 100644
index 0000000..b013e09
--- /dev/null
+++ b/56.patch
@@ -0,0 +1,60 @@
+From d43b41431379f9c9bb05fab158c4d97e6d515f8f Mon Sep 17 00:00:00 2001
+From: Johannes Schauer Marin Rodrigues <josch@mister-muffin.de>
+Date: Tue, 20 Feb 2024 07:44:20 +0100
+Subject: [PATCH] Make tests work with black 24.2.0
+
+Closes: #55
+---
+ setup.cfg            |  2 ++
+ tests/test_plugin.py | 18 ++++++++++++++++--
+ 2 files changed, 18 insertions(+), 2 deletions(-)
+
+diff --git a/setup.cfg b/setup.cfg
+index a4fefd3..5103bcb 100644
+--- a/setup.cfg
++++ b/setup.cfg
+@@ -22,6 +22,8 @@ install_requires =
+     python-lsp-server>=1.4.0
+     black>=23.11.0
+     tomli; python_version<'3.11'
++tests_require =
++    black>=24.2.0
+ python_requires = >= 3.8
+ 
+ [options.entry_points]
+diff --git a/tests/test_plugin.py b/tests/test_plugin.py
+index 0a51767..2ae8088 100644
+--- a/tests/test_plugin.py
++++ b/tests/test_plugin.py
+@@ -281,7 +281,14 @@ def test_load_config_defaults(config):
+ 
+     assert config == {
+         "line_length": 88,
+-        "target_version": set(),
++        "target_version": set(
++            [
++                black.TargetVersion.PY38,
++                black.TargetVersion.PY39,
++                black.TargetVersion.PY310,
++                black.TargetVersion.PY311,
++            ]
++        ),
+         "pyi": False,
+         "fast": False,
+         "skip_magic_trailing_comma": False,
+@@ -297,7 +304,14 @@ def test_load_config_with_skip_options(config_with_skip_options):
+ 
+     assert config == {
+         "line_length": 88,
+-        "target_version": set(),
++        "target_version": set(
++            [
++                black.TargetVersion.PY38,
++                black.TargetVersion.PY39,
++                black.TargetVersion.PY310,
++                black.TargetVersion.PY311,
++            ]
++        ),
+         "pyi": False,
+         "fast": False,
+         "skip_magic_trailing_comma": True,

diff --git a/59.patch b/59.patch
new file mode 100644
index 0000000..b9400cd
--- /dev/null
+++ b/59.patch
@@ -0,0 +1,28 @@
+From 9298585a9d14d25920c33b188d79e820dc98d4a9 Mon Sep 17 00:00:00 2001
+From: Anton Zhukharev <ancieg@altlinux.org>
+Date: Tue, 9 Apr 2024 16:06:55 +0300
+Subject: [PATCH] Make tests work with black 24.3.0
+
+Closes: #57
+
+Black changed raising exception from AssertionError to ASTSafetyError
+and we need to apply similar change.
+
+See: https://github.com/psf/black/commit/6af7d1109693c4ad3af08ecbc34649c232b47a6d
+---
+ pylsp_black/plugin.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/pylsp_black/plugin.py b/pylsp_black/plugin.py
+index e4fb9ba..5523896 100644
+--- a/pylsp_black/plugin.py
++++ b/pylsp_black/plugin.py
+@@ -127,7 +127,7 @@ def format_text(*, text, config, lines):
+         IndentationError,
+         # raised when black produces invalid Python code or formats the file
+         # differently on the second pass
+-        AssertionError,
++        black.parsing.ASTSafetyError,
+     ) as e:
+         # errors will show on lsp stderr stream
+         logger.error("Error formatting with black: %s", e)

diff --git a/64.patch b/64.patch
new file mode 100644
index 0000000..034e945
--- /dev/null
+++ b/64.patch
@@ -0,0 +1,49 @@
+From 077c3e5e8720c6cb9e99483a8fd53899a007a0e9 Mon Sep 17 00:00:00 2001
+From: "Benjamin A. Beasley" <code@musicinmybrain.net>
+Date: Tue, 14 Jul 2026 10:52:12 +0100
+Subject: [PATCH] Migrate test_entry_point from pkg_resources to
+ importlib.metadata
+
+---
+ tests/test_plugin.py | 15 +++++++++------
+ 1 file changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/tests/test_plugin.py b/tests/test_plugin.py
+index 2ae8088..0fa3e2d 100644
+--- a/tests/test_plugin.py
++++ b/tests/test_plugin.py
+@@ -1,11 +1,11 @@
+ # Standard library imports
+ import types
+ from pathlib import Path
++import importlib.metadata
+ from unittest.mock import Mock
+ 
+ # Third-party imports
+ import black
+-import pkg_resources
+ import pytest
+ 
+ # Python LSP imports
+@@ -321,13 +321,16 @@ def test_load_config_with_skip_options(config_with_skip_options):
+ 
+ 
+ def test_entry_point():
+-    distribution = pkg_resources.get_distribution("python-lsp-black")
+-    entry_point = distribution.get_entry_info("pylsp", "black")
++    entry_points_pylsp = importlib.metadata.entry_points(name="pylsp")
++    entry_points_black = importlib.metadata.entry_points(name="black")
+ 
+-    assert entry_point is not None
++    assert entry_points_pylsp
++    assert entry_points_black
+ 
+-    module = entry_point.load()
+-    assert isinstance(module, types.ModuleType)
++    pylsp_entry = next(iter(entry_points_pylsp)).load()
++    black_entry = next(iter(entry_points_pylsp)).load()
++    assert isinstance(pylsp_entry, (types.ModuleType, types.FunctionType))
++    assert isinstance(black_entry, (types.ModuleType, types.FunctionType))
+ 
+ 
+ def test_pylsp_format_crlf_document(

diff --git a/65.patch b/65.patch
new file mode 100644
index 0000000..55d31ad
--- /dev/null
+++ b/65.patch
@@ -0,0 +1,55 @@
+From 35b5bc6f944bddac0c896127dc44a9404e95f482 Mon Sep 17 00:00:00 2001
+From: "Benjamin A. Beasley" <code@musicinmybrain.net>
+Date: Tue, 14 Jul 2026 11:17:27 +0100
+Subject: [PATCH] =?UTF-8?q?Fix=20compatibility=20with=20black=E2=89=A526.5?=
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+---
+ pylsp_black/plugin.py | 25 ++++++++++++++++---------
+ 1 file changed, 16 insertions(+), 9 deletions(-)
+
+diff --git a/pylsp_black/plugin.py b/pylsp_black/plugin.py
+index 5523896..a6751bb 100644
+--- a/pylsp_black/plugin.py
++++ b/pylsp_black/plugin.py
+@@ -100,6 +100,21 @@ def format_text(*, text, config, lines):
+         magic_trailing_comma=not config["skip_magic_trailing_comma"],
+         preview=config["preview"],
+     )
++    handled_errors = (
++        # raised when the file has syntax errors
++        ValueError,
++        # raised when the file being formatted has an indentation error
++        IndentationError,
++        # raised when black produces invalid Python code or formats the file
++        # differently on the second pass
++        black.parsing.ASTSafetyError,
++    )
++    # SourceASTParseError was split out from ASTSafetyError in black 26.5.0,
++    # https://github.com/psf/black/pull/5080; expect it if it exists.
++    try:
++        handled_errors += (black.parsing.SourceASTParseError,)
++    except AttributeError:
++        pass
+     try:
+         # Black's format_file_contents only works reliably when eols are '\n'. It gives
+         # an error for '\r' and produces wrong formatting for '\r\n'. So we replace
+@@ -120,15 +135,7 @@ def format_text(*, text, config, lines):
+             formatted_text = formatted_text.replace("\n", eol_chars)
+ 
+         return formatted_text
+-    except (
+-        # raised when the file has syntax errors
+-        ValueError,
+-        # raised when the file being formatted has an indentation error
+-        IndentationError,
+-        # raised when black produces invalid Python code or formats the file
+-        # differently on the second pass
+-        black.parsing.ASTSafetyError,
+-    ) as e:
++    except handled_errors as e:
+         # errors will show on lsp stderr stream
+         logger.error("Error formatting with black: %s", e)
+         raise black.NothingChanged from e

diff --git a/changelog b/changelog
new file mode 100644
index 0000000..05d425d
--- /dev/null
+++ b/changelog
@@ -0,0 +1,11 @@
+* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.0-4
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
+
+* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.0-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
+
+* Wed Jul 07 2021 Mukundan Ragavan <nonamedotc@fedoraproject.org> - 1.0.0-2
+- Spec cleanup
+
+* Mon Jul 05 2021 Mukundan Ragavan <nonamedotc@fedoraproject.org> - 1.0.0-1
+- Initial package.

diff --git a/dead.package b/dead.package
deleted file mode 100644
index 5204a84..0000000
--- a/dead.package
+++ /dev/null
@@ -1 +0,0 @@
-Orphaned for 6+ weeks

diff --git a/python-lsp-black.spec b/python-lsp-black.spec
new file mode 100644
index 0000000..a66f422
--- /dev/null
+++ b/python-lsp-black.spec
@@ -0,0 +1,76 @@
+%global short_name lsp-black
+
+%global _description %{expand:
+lsp-black is a python-lsp-server plugin that adds support to black
+autoformatter. This is forked from pyls-black to be compatible wth
+community maintained language-server (python-lsp-server).
+}
+
+Name:           python-%{short_name}
+Version:        2.0.0
+Release:        %autorelease
+Summary:        A python-lsp-server plugin that adds support to black autoformatter
+
+%global forgeurl https://github.com/python-lsp/python-lsp-black
+%forgemeta
+
+# SPDX
+License:        MIT
+URL:            %{forgeurl}
+Source:         %{forgesource}
+# Fix tests failing since `black >= 24.3.0`
+# https://github.com/python-lsp/python-lsp-black/issues/57
+Patch:          %{forgeurl}/pull/59.patch
+# And two more failing since `black >= 24.4.0`
+# https://github.com/python-lsp/python-lsp-black/issues/57
+Patch:          %{forgeurl}/pull/56.patch
+# Migrate test_entry_point from pkg_resources to importlib.metadata
+# https://github.com/python-lsp/python-lsp-black/pull/64
+# Fixes compatibility with setuptools≥82.
+Patch:          %{forgeurl}/pull/64.patch
+# Fix compatibility with black≥26.5
+# https://github.com/python-lsp/python-lsp-black/pull/65
+Patch:          %{forgeurl}/pull/65.patch
+
+BuildArch:      noarch
+
+BuildRequires:  python3-devel
+BuildRequires:  pyproject-rpm-macros
+BuildRequires:  python3-pytest
+
+%description %_description
+
+%package -n     python3-%{short_name}
+Summary:        %{summary}
+
+Supplements:    python3dist(python-lsp-server)
+
+%description -n python3-%{short_name} %_description
+
+%prep
+%forgeautosetup -p1
+# Remove version pinning from python-lsp-server dependency
+sed -i -r -e 's/(lsp-server)>=.*/\1/' setup.cfg
+# Remove Python version upper bound
+sed -i -e 's/; python_version.*//' setup.cfg
+
+%generate_buildrequires
+%pyproject_buildrequires
+
+%build
+%pyproject_wheel
+
+%install
+%pyproject_install
+
+%pyproject_save_files pylsp_black
+
+%check
+%pytest -v
+
+%files -n python3-%{short_name} -f %{pyproject_files}
+%license LICENSE
+%doc README.md
+
+%changelog
+%autochangelog

diff --git a/sources b/sources
new file mode 100644
index 0000000..f2a0437
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+SHA512 (python-lsp-black-2.0.0.tar.gz) = e374ea34ac53e0d78ba198814210d9d7293e18b8fc7b22bb288621a994c8c9d492cc9c99c40cd1574b618add518671430e1e88f32e93e4c95507373932c08dc0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-05 14:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 14:39 [rpms/python-lsp-black] rawhide: Unretirement request: https://forge.fedoraproject.org/releng/fedora-scm-requests/issues/1742 releng-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox