From e681612ff32aa8f523c5b615049a04dfff706c72 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 2 Sep 2026 17:40:19 +0200 Subject: [PATCH 1/2] tools: do not hardcode `yamllint` path Allows user to get `yamlllint` from other source than Pip (e.g. Nix). Signed-off-by: Antoine du Hamel --- Makefile | 16 +++++++++------- shell.nix | 8 ++++++++ tools/nix/devTools.nix | 1 + 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index df31980e4fc6..76697bd5c6f9 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ BUILDTYPE ?= Release PYTHON ?= python3 RUFF ?= tools/pip/site-packages/bin/ruff +YAMLLINT ?= tools/pip/site-packages/bin/yamllint DESTDIR ?= SIGN ?= PREFIX ?= /usr/local @@ -1719,14 +1720,15 @@ lint-yaml-build: ## Build resources needed to lint YAML files. $(PYTHON) -m pip install --upgrade --system -t tools/pip/site-packages yamllint .PHONY: lint-yaml +ifneq ("","$(wildcard $(YAMLLINT))") lint-yaml: ## Lint the YAML files with yamllint. - @if [ -d "tools/pip/site-packages/yamllint" ]; then \ - $(info Running YAML linter...) \ - PYTHONPATH=tools/pip $(PYTHON) -m yamllint .; \ - else \ - echo 'YAML linting with yamllint is not available'; \ - echo "Run 'make lint-yaml-build'"; \ - fi + $(info Running YAML linter...) + $(YAMLLINT) . +else +lint-yaml: + $(warning YAML linting with yamllint is not available) + $(warning Run 'make lint-yaml-build') +endif .PHONY: lint .PHONY: lint-ci diff --git a/shell.nix b/shell.nix index 9b4d9da55855..d146361b5c09 100644 --- a/shell.nix +++ b/shell.nix @@ -149,6 +149,14 @@ pkgs.mkShell { RUFF = pkgs.lib.getExe ruff; } ) + // ( + let + yamllint = pkgs.lib.lists.findFirst (p: p.meta.mainProgram == "yamllint") null devTools; + in + pkgs.lib.optionalAttrs (yamllint != null) { + YAMLLINT = pkgs.lib.getExe yamllint; + } + ) // pkgs.lib.optionalAttrs (!withSQLite) { NOSQLITE = "1"; } diff --git a/tools/nix/devTools.nix b/tools/nix/devTools.nix index 0ead37da9108..e33ae720785c 100644 --- a/tools/nix/devTools.nix +++ b/tools/nix/devTools.nix @@ -9,6 +9,7 @@ pkgs.jq pkgs.ruff pkgs.shellcheck + pkgs.yamllint ] ++ ( if (ncu-path == null) then From bab6fb59063d36815ec719f9b0612c6dcc8f1da6 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 2 Sep 2026 17:51:14 +0200 Subject: [PATCH 2/2] fixup! tools: do not hardcode `yamllint` path --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 76697bd5c6f9..75553806ab79 100644 --- a/Makefile +++ b/Makefile @@ -1723,7 +1723,7 @@ lint-yaml-build: ## Build resources needed to lint YAML files. ifneq ("","$(wildcard $(YAMLLINT))") lint-yaml: ## Lint the YAML files with yamllint. $(info Running YAML linter...) - $(YAMLLINT) . + PYTHONPATH=tools/pip $(YAMLLINT) . else lint-yaml: $(warning YAML linting with yamllint is not available)