From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Chen Miao <chenmiao.ku@gmail.com>
Cc: corbet@lwn.net, alexs@kernel.org, si.yanteng@linux.dev,
skhan@linuxfoundation.org, dzm91@hust.edu.cn, mchehab@kernel.org,
wy@wyuan.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/6] docs: kdoc: add GNU Make detection
Date: Wed, 12 Aug 2026 22:13:03 +0200 [thread overview]
Message-ID: <20260812221303.4a5855bd@foz.lan> (raw)
In-Reply-To: <20260812182327.53694-2-chenmiao.ku@gmail.com>
On Thu, 13 Aug 2026 02:23:18 +0800
Chen Miao <chenmiao.ku@gmail.com> wrote:
> The Sphinx dependency checker and build wrapper need to select a GNU
> Make executable that meets the minimum supported version. Keep the version
> parsing and command selection in a common module so both tools use
> identical behavior.
>
> Signed-off-by: Chen Miao <chenmiao.ku@gmail.com>
> ---
> tools/lib/python/kdoc/gmake_detect.py | 62 +++++++++++++++++++++++++++
> 1 file changed, 62 insertions(+)
> create mode 100644 tools/lib/python/kdoc/gmake_detect.py
>
> diff --git a/tools/lib/python/kdoc/gmake_detect.py b/tools/lib/python/kdoc/gmake_detect.py
> new file mode 100644
> index 000000000..5c0a28bc7
> --- /dev/null
> +++ b/tools/lib/python/kdoc/gmake_detect.py
> @@ -0,0 +1,62 @@
> +#!/usr/bin/env python3
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2026 Chen Miao <chenmiao.ku@gmail.com>
> +
> +"""Detect a supported GNU Make executable."""
> +
> +import re
> +import shutil
> +import subprocess
> +import sys
> +
> +from kdoc.python_version import PythonVersion
Did you test it? since python_version is at the same directory,
I would expect it to be:
from python_version import PythonVersion
> +
> +
> +MIN_GMAKE_VERSION = PythonVersion("4.0").version
> +
> +
> +def get_gmake_version(cmd):
> + """Return the GNU Make version for *cmd*, or ``None`` otherwise."""
> + if not cmd:
> + return None
> +
> + kwargs = {}
> + if sys.version_info < (3, 7):
> + kwargs["universal_newlines"] = True
> + else:
> + kwargs["text"] = True
> +
> + try:
> + result = subprocess.run(
> + [cmd, "--version"],
> + stdout=subprocess.PIPE,
> + stderr=subprocess.PIPE,
> + check=True,
> + **kwargs,
> + )
> + except (OSError, subprocess.CalledProcessError):
> + return None
> +
> + match = re.search(
> + r"^GNU Make\s+([0-9]+(?:\.[0-9]+)*)", result.stdout, re.MULTILINE
> + )
> + if not match:
> + return None
> +
> + return PythonVersion.parse_version(match.group(1))
> +
> +
> +def find_gmake(make=None):
> + """Return the first GNU Make 4.0+ from MAKE, gmake, or make."""
> + candidates = (
> + make,
> + shutil.which("gmake"),
> + shutil.which("make"),
> + )
> +
> + for cmd in candidates:
> + version = get_gmake_version(cmd)
> + if version and version >= MIN_GMAKE_VERSION:
> + return cmd
> +
> + return None
Thanks,
Mauro
next prev parent reply other threads:[~2026-08-12 20:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 18:23 [PATCH v3 0/6] docs: sphinx-pre-install: improve dependency checks Chen Miao
2026-08-12 18:23 ` [PATCH v3 1/6] docs: kdoc: add GNU Make detection Chen Miao
2026-08-12 20:13 ` Mauro Carvalho Chehab [this message]
2026-08-12 18:23 ` [PATCH v3 2/6] docs: sphinx-pre-install: add macOS Homebrew support Chen Miao
2026-08-12 20:15 ` Mauro Carvalho Chehab
2026-08-12 18:23 ` [PATCH v3 3/6] docs: sphinx-pre-install: check GNU Make version Chen Miao
2026-08-12 20:17 ` Mauro Carvalho Chehab
2026-08-12 18:23 ` [PATCH v3 4/6] docs: sphinx-build-wrapper: prefer gmake Chen Miao
2026-08-12 20:23 ` Mauro Carvalho Chehab
2026-08-12 18:23 ` [PATCH v3 5/6] docs/zh_CN: doc-guide: document macOS Sphinx setup Chen Miao
2026-08-12 18:23 ` [PATCH v3 6/6] docs/zh_CN: how-to: document case-sensitive APFS setup Chen Miao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260812221303.4a5855bd@foz.lan \
--to=mchehab+huawei@kernel.org \
--cc=alexs@kernel.org \
--cc=chenmiao.ku@gmail.com \
--cc=corbet@lwn.net \
--cc=dzm91@hust.edu.cn \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=si.yanteng@linux.dev \
--cc=skhan@linuxfoundation.org \
--cc=wy@wyuan.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox