python3Packages.python-lsp-black: fix build

Two independent breakages on the default Python 3.14 / setuptools 82 stack:

- tests/test_plugin.py imports pkg_resources, which setuptools 81+ no longer
  ships; add setuptools_80 to nativeCheckInputs so it is available at test time.
- black 26.5 split SourceASTParseError out of ASTSafetyError, which the plugin
  did not catch; backport the upstream fix (python-lsp-black#65).

Assisted-by: Claude Code (Claude Opus 4.8)
This commit is contained in:
Daniel Baker
2026-07-19 22:50:02 -07:00
committed by Sandro Jäckel
parent 703c1307f5
commit 28d1115bb5
@@ -15,6 +15,7 @@
# checks
pytestCheckHook,
setuptools_80,
}:
buildPythonPackage rec {
@@ -41,7 +42,14 @@ buildPythonPackage rec {
++ lib.optional (lib.versionAtLeast black.version "24.3.0") (fetchpatch {
url = "https://github.com/python-lsp/python-lsp-black/commit/9298585a9d14d25920c33b188d79e820dc98d4a9.patch";
hash = "sha256-4u0VIS7eidVEiKRW2wc8lJVkJwhzJD/M+uuqmTtiZ7E=";
});
})
# https://github.com/python-lsp/python-lsp-black/pull/65 (black >= 26.5)
++ [
(fetchpatch {
url = "https://github.com/python-lsp/python-lsp-black/commit/35b5bc6f944bddac0c896127dc44a9404e95f482.patch";
hash = "sha256-FRxM8leFVkPjRiR3wNjy5g5BazHc6ZvtnoI8Qgz4co4=";
})
];
build-system = [ setuptools ];
@@ -52,7 +60,10 @@ buildPythonPackage rec {
pythonImportsCheck = [ "pylsp_black" ];
nativeCheckInputs = [ pytestCheckHook ];
nativeCheckInputs = [
pytestCheckHook
setuptools_80 # for pkg_resources, removed in setuptools 81+ (tests/test_plugin.py)
];
meta = {
homepage = "https://github.com/python-lsp/python-lsp-black";