python3Packages.python-lsp-ruff: 2.2.2 -> 2.3.0 (#447297)
This commit is contained in:
@@ -18,25 +18,48 @@
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "python-lsp-ruff";
|
||||
version = "2.2.2";
|
||||
version = "2.3.0";
|
||||
pyproject = true;
|
||||
disabled = pythonOlder "3.8";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "python-lsp";
|
||||
repo = "python-lsp-ruff";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-czGA/gl7uoWG9UqYUaY9zER79IKfv7ClqgimgyNCAa4=";
|
||||
hash = "sha256-jtfDdZ68AroXlmR+AIVk/b3WpZk78BCtT8TUh4ELZZI=";
|
||||
};
|
||||
|
||||
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
|
||||
postPatch =
|
||||
let
|
||||
ruffBin = lib.getExe ruff;
|
||||
in
|
||||
''
|
||||
substituteInPlace pylsp_ruff/plugin.py \
|
||||
--replace-fail \
|
||||
"*find_executable(executable)" \
|
||||
'"${ruffBin}"'
|
||||
|
||||
substituteInPlace tests/test_ruff_lint.py \
|
||||
--replace-fail "str(sys.executable)" '"${ruffBin}"' \
|
||||
--replace-fail '"-m",' "" \
|
||||
--replace-fail '"ruff",' "" \
|
||||
--replace-fail \
|
||||
'assert "ruff" in call_args' \
|
||||
'assert "${ruffBin}" in call_args' \
|
||||
--replace-fail \
|
||||
'ruff_executable = ruff_exe.name' \
|
||||
'ruff_executable = "${ruffBin}"' \
|
||||
--replace-fail 'os.chmod(ruff_executable, st.st_mode | stat.S_IEXEC)' ""
|
||||
''
|
||||
# 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
|
||||
'';
|
||||
+ ''
|
||||
substituteInPlace tests/*.py \
|
||||
--replace-fail "workspace.root_path" '"/tmp/"'
|
||||
'';
|
||||
|
||||
pythonRemoveDeps = [
|
||||
# ruff binary is used directly, the ruff python package is not needed
|
||||
"ruff"
|
||||
];
|
||||
|
||||
dependencies = [
|
||||
cattrs
|
||||
|
||||
Reference in New Issue
Block a user