From 99f2ce1db48a835c159a831a77f953c173d7bfd8 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 29 Sep 2025 20:41:06 +0000 Subject: [PATCH] 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 --- .../python-lsp-ruff/default.nix | 43 ++++++++++++++----- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/pkgs/development/python-modules/python-lsp-ruff/default.nix b/pkgs/development/python-modules/python-lsp-ruff/default.nix index 8c0f66ee40ea..ded4e7073e8b 100644 --- a/pkgs/development/python-modules/python-lsp-ruff/default.nix +++ b/pkgs/development/python-modules/python-lsp-ruff/default.nix @@ -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