tools: do not hardcode path to Ruff

Allows user to get Ruff from other source than Pip (e.g. Nix).

Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/65681
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
This commit is contained in:
Antoine du Hamel committed 2026-09-08 22:03:36 +02:00
1 parent e47c432dd6
commit 837ce2ccef
3 files changed
+14 -4

No files matched your search

+5 -4
View File
@@ -2,6 +2,7 @@
BUILDTYPE ?= Release
PYTHON ?= python3
RUFF ?= tools/pip/site-packages/bin/ruff
DESTDIR ?=
SIGN ?=
PREFIX ?= /usr/local
@@ -1694,15 +1695,15 @@ lint-py-build: ## Build resources needed to lint python files.
$(PYTHON) -m pip install --upgrade --system --target tools/pip/site-packages ruff==0.13.1
.PHONY: lint-py lint-py-fix lint-py-fix-unsafe
ifneq ("","$(wildcard tools/pip/site-packages/ruff)")
ifneq ("","$(wildcard $(RUFF))")
# Lint the Python code with ruff.
lint-py:
$(info Running Python linter...)
tools/pip/site-packages/bin/ruff check .
$(RUFF) check .
lint-py-fix:
tools/pip/site-packages/bin/ruff check . --fix
$(RUFF) check . --fix
lint-py-fix-unsafe:
tools/pip/site-packages/bin/ruff check . --fix --unsafe-fixes
$(RUFF) check . --fix --unsafe-fixes
else
lint-py lint-py-fix lint-py-fix-unsafe:
$(warning Python linting with ruff is not available)
+8
View File
@@ -141,6 +141,14 @@ pkgs.mkShell {
)
);
}
// (
let
ruff = pkgs.lib.lists.findFirst (p: p.meta.mainProgram == "ruff") null devTools;
in
pkgs.lib.optionalAttrs (ruff != null) {
RUFF = pkgs.lib.getExe ruff;
}
)
// pkgs.lib.optionalAttrs (!withSQLite) {
NOSQLITE = "1";
}
+1
View File
@@ -7,6 +7,7 @@
pkgs.gh
pkgs.git
pkgs.jq
pkgs.ruff
pkgs.shellcheck
]
++ (