From f1456f1d46d57ef350437324461feec45455ac10 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Tue, 2 Jun 2026 12:55:15 +0200 Subject: [PATCH] project.conf, py-topdir.mk: Fix check target for Kali "make check" fails on Kali Linux, because the machinery lacks pieces: - Add mypy, yapf3, python3-pyright to project.conf for Debian. The pyright package is not in upstream Kali, but is now supplied by the jw-foss repo. - ifdef ruff out from "make check" in py-topdir.mk, because it's too much work to get that to work from packages on Kali Linux for now. project.conf, py-topdir.mk: Make Kali work Signed-off-by: Jan Lindemann --- make/project.conf | 6 +++--- make/py-topdir.mk | 20 +++++++++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/make/project.conf b/make/project.conf index 71fa0347..13d178fa 100644 --- a/make/project.conf +++ b/make/project.conf @@ -21,7 +21,7 @@ devel = jw-pkg-run = VERSION-REVISION run = bash, python3 build = make, time, xdg-utils, coreutils, cpio, xdg-utils, git-core devel = sudo, gawk, pkg-config -release = python3-isort, python3-yapf, python3-ruff, python3-pyright +release = mypy, python3-isort, python3-yapf, python3-pyright [pkg.requires.centos] run = hostname, python @@ -36,11 +36,11 @@ build = realpath [pkg.requires.suse] run = python3 -release = rpmbuild, python3-base +release = rpmbuild, python3-base, python3-yapf [pkg.requires.debian] run = python3 -release = devscripts, debhelper, dput, libparse-debcontrol-perl, fakeroot, build-essential:native +release = devscripts, debhelper, dput, libparse-debcontrol-perl, fakeroot, build-essential:native, yapf3 [pkg.requires.yocto] run = python3-core diff --git a/make/py-topdir.mk b/make/py-topdir.mk index 951762f1..377bad28 100644 --- a/make/py-topdir.mk +++ b/make/py-topdir.mk @@ -4,6 +4,14 @@ TD_GENERATE_FILES += pyrightconfig.json PY_CHECK_EXCLUDE ?= PY_SRC_ROOT += $(wildcard $(TOPDIR)/src $(TOPDIR)/tools) +ifndef PY_CHECK_RUFF + PY_CHECK_RUFF := $(shell which ruff 2>/dev/null) +endif + +ifndef PY_CHECK_YAPF + PY_CHECK_YAPF := $(firstword $(wildcard /usr/bin/yapf /usr/bin/yapf3)) +endif + all: format: py-format @@ -12,17 +20,23 @@ check-format: py-check-format py-check: py-check-syntax py-check-format py-check-syntax: - ruff check $(addprefix --exclude ,$(PY_CHECK_EXCLUDE)) $(PY_SRC_ROOT) +ifneq ($(PY_CHECK_RUFF),) + $(PY_CHECK_RUFF) check $(addprefix --exclude ,$(PY_CHECK_EXCLUDE)) $(PY_SRC_ROOT) +endif mypy $(addprefix --exclude ,$(PY_CHECK_EXCLUDE)) $(PY_SRC_ROOT) pyright py-check-format: - yapf --diff --recursive . +ifneq ($(PY_CHECK_YAPF),) + $(PY_CHECK_YAPF) --diff --recursive . +endif py-format: find . -type f -name '*.py' -print0 | \ xargs -0 sed -i -E '1{/^# -\*- coding: utf-8 -\*-$$/{:a;N;/\n[[:space:]]*$$/ba;s/^# -\*- coding: utf-8 -\*-\n([[:space:]]*\n)*/ /;s/^ //}}' - yapf --in-place --recursive . +ifneq ($(PY_CHECK_YAPF),) + $(PY_CHECK_YAPF) --in-place --recursive . +endif py-format-assignments: find . \