2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
pythonOlder,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
pytestCheckHook,
|
|
|
|
black,
|
|
|
|
python-lsp-server,
|
|
|
|
setuptools,
|
|
|
|
tomli,
|
|
|
|
fetchpatch,
|
2021-07-24 12:14:16 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "python-lsp-black";
|
2024-01-13 08:15:51 +00:00
|
|
|
version = "2.0.0";
|
|
|
|
pyproject = true;
|
|
|
|
disabled = pythonOlder "3.8";
|
2021-07-24 12:14:16 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "python-lsp";
|
|
|
|
repo = "python-lsp-black";
|
2023-07-15 17:15:38 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-01-13 08:15:51 +00:00
|
|
|
hash = "sha256-nV6mePSWzfPW2RwXg/mxgzfT9wD95mmTuPnPEro1kEY=";
|
2021-07-24 12:14:16 +00:00
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
patches =
|
2024-06-05 15:53:02 +00:00
|
|
|
/**
|
|
|
|
includes a series of patches fixing tests not yet released as 2.0.1+ version
|
|
|
|
they are meant to keep up to date with black releases
|
|
|
|
*/
|
|
|
|
lib.optional (with lib; versionAtLeast black.version "24.2.0") (fetchpatch {
|
|
|
|
url = "https://github.com/python-lsp/python-lsp-black/commit/d43b41431379f9c9bb05fab158c4d97e6d515f8f.patch";
|
|
|
|
hash = "sha256-38bYU27+xtA8Kq3appXTkNnkG5/XgrUJ2nQ5+yuSU2U=";
|
|
|
|
})
|
|
|
|
++ lib.optional (with 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=";
|
|
|
|
});
|
|
|
|
|
|
|
|
nativeBuildInputs = [ setuptools ];
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2021-07-24 12:14:16 +00:00
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
black
|
|
|
|
python-lsp-server
|
2024-06-05 15:53:02 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.11") [ tomli ];
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "pylsp_black" ];
|
2021-07-24 12:14:16 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/python-lsp/python-lsp-black";
|
|
|
|
description = "Black plugin for the Python LSP Server";
|
2024-01-13 08:15:51 +00:00
|
|
|
changelog = "https://github.com/python-lsp/python-lsp-black/blob/${src.rev}/CHANGELOG.md";
|
2021-07-24 12:14:16 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ cpcloud ];
|
|
|
|
};
|
|
|
|
}
|