python3Packages.python-lsp-ruff: 2.2.2 -> 2.3.0

Diff: https://github.com/python-lsp/python-lsp-ruff/compare/v2.2.2...v2.3.0

Changelog: https://github.com/python-lsp/python-lsp-ruff/releases/tag/v2.3.0

Changed files
+33 -10
pkgs
development
python-modules
python-lsp-ruff
+33 -10
pkgs/development/python-modules/python-lsp-ruff/default.nix
···
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 = ''
+
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.
+
+ ''
+
substituteInPlace tests/*.py \
+
--replace-fail "workspace.root_path" '"/tmp/"'
+
'';
+
+
pythonRemoveDeps = [
# 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
-
'';
+
"ruff"
+
];
dependencies = [
cattrs