python311Packages.python-lsp-ruff: 1.6.0 -> 2.0.0

Changelog: https://github.com/python-lsp/python-lsp-ruff/releases/tag/v2.0.0
This commit is contained in:
Gaetan Lepage 2023-11-26 18:24:16 +01:00
parent 8cfef6986a
commit 43326297e3

View File

@ -3,37 +3,45 @@
, buildPythonPackage
, fetchPypi
, ruff
, cattrs
, lsprotocol
, python-lsp-server
, tomli
, pytestCheckHook
}:
buildPythonPackage rec {
pname = "python-lsp-ruff";
version = "1.6.0";
format = "pyproject";
disabled = pythonOlder "3.7";
version = "2.0.0";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchPypi {
inherit version;
pname = "python-lsp-ruff";
sha256 = "sha256-vf3ZNZyen1W29qk4ST1sus5VTcys9F3067NlUr406bg=";
sha256 = "sha256-lCTBFKTb1djrRQcX4Eg/G2Fs+VrqTvJ/XVnUPVM/5nE=";
};
postPatch = ''
# ruff binary is used directly, the ruff python package is not needed
sed -i '/"ruff>=/d' pyproject.toml
sed -i 's|sys.executable, "-m", "ruff"|"${ruff}/bin/ruff"|' pylsp_ruff/plugin.py
sed -i -e '/sys.executable/,+2c"${ruff}/bin/ruff",' -e 's|assert "ruff" in call_args|assert "${ruff}/bin/ruff" in call_args|' tests/test_ruff_lint.py
# Nix builds everything in /build/ but ruff somehow doesn't run on files in /build/ and outputs empty results.
sed -i -e "s|workspace.root_path|'/tmp/'|g" tests/*.py
'';
propagatedBuildInputs = [
cattrs
lsprotocol
python-lsp-server
] ++ lib.optionals (pythonOlder "3.11") [
tomli
];
doCheck = true;
nativeCheckInputs = [
pytestCheckHook
];
meta = with lib; {
homepage = "https://github.com/python-lsp/python-lsp-ruff";