* [PATCH] tools/docs/checktransupdate.py: add support for scanning directory
@ 2026-03-08 11:13 Haoyang LIU
2026-03-09 16:07 ` Jonathan Corbet
0 siblings, 1 reply; 4+ messages in thread
From: Haoyang LIU @ 2026-03-08 11:13 UTC (permalink / raw)
To: Dongliang Mu, Yanteng Si, Alex Shi, Jonathan Corbet, Shuah Khan,
Mauro Carvalho Chehab, Nathan Chancellor, Nick Desaulniers,
Bill Wendling, Justin Stitt
Cc: Haoyang LIU, linux-doc, linux-kernel, llvm
Origin script can only accept a file as parameter, this commit enables
it to scan a directory.
Usage example:
./scripts/checktransupdate.py Documentation/translations/zh_CN/dev-tools
And it will output something like:
"""
[1772967203.351603] Documentation/translations/zh_CN/dev-tools/kmemleak.rst
[1772967205.074201] commit 7591c127f3b1 ("kmemleak: iommu/iova: fix transient kmemleak false positive")
[1772967205.074337] 1 commits needs resolving in total
[1772967205.301705] Documentation/translations/zh_CN/dev-tools/index.rst
[1772967206.912395] commit a592a36e4937 ("Documentation: use a source-read extension for the index link boilerplate")
[1772967206.921424] commit 6eac13c87680 ("Documentation: dev-tools: add container.rst page")
[1772967206.930220] commit 8f32441d7a53 ("Documentation: Add documentation for Compiler-Based Context Analysis")
[1772967206.939002] commit 1e9ddbb2cd34 ("docs: Pull LKMM documentation into dev-tools book")
[1772967206.948636] commit d5af79c05e93 ("Documentation: move dev-tools debugging files to process/debugging/")
[1772967206.957562] commit d5dc95836147 ("kbuild: Add Propeller configuration for kernel build")
[1772967206.966255] commit 315ad8780a12 ("kbuild: Add AutoFDO support for Clang build")
[1772967206.966410] 7 commits needs resolving in total
"""
Signed-off-by: Haoyang LIU <tttturtleruss@gmail.com>
---
tools/docs/checktransupdate.py | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/tools/docs/checktransupdate.py b/tools/docs/checktransupdate.py
index bf735562aeeb..b0bc61f958cf 100755
--- a/tools/docs/checktransupdate.py
+++ b/tools/docs/checktransupdate.py
@@ -13,6 +13,8 @@ The usage is as follows:
This will print all the files that need to be updated or translated in the zh_CN locale.
- tools/docs/checktransupdate.py Documentation/translations/zh_CN/dev-tools/testing-overview.rst
This will only print the status of the specified file.
+- tools/docs/checktransupdate.py Documentation/translations/zh_CN/dev-tools
+This will print the status of all files under the directory.
The output is something like:
Documentation/dev-tools/kfence.rst
@@ -262,7 +264,7 @@ def main():
help='Set the logging file (default: checktransupdate.log)')
parser.add_argument(
- "files", nargs="*", help="Files to check, if not specified, check all files"
+ "files", nargs="*", help="Files or directories to check, if not specified, check all files"
)
args = parser.parse_args()
@@ -293,6 +295,17 @@ def main():
if args.print_missing_translations:
logging.info(os.path.relpath(os.path.abspath(file), linux_path))
logging.info("No translation in the locale of %s\n", args.locale)
+ else:
+ # check if the files are directories or files
+ new_files = []
+ for file in files:
+ if os.path.isfile(file):
+ new_files.append(file)
+ elif os.path.isdir(file):
+ # for directories, list all files in the directory and its subfolders
+ new_files.extend(list_files_with_excluding_folders(
+ file, [], "rst"))
+ files = new_files
files = list(map(lambda x: os.path.relpath(os.path.abspath(x), linux_path), files))
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] tools/docs/checktransupdate.py: add support for scanning directory
2026-03-08 11:13 [PATCH] tools/docs/checktransupdate.py: add support for scanning directory Haoyang LIU
@ 2026-03-09 16:07 ` Jonathan Corbet
2026-03-09 16:32 ` Haoyang Liu
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Corbet @ 2026-03-09 16:07 UTC (permalink / raw)
To: Haoyang LIU, Dongliang Mu, Yanteng Si, Alex Shi, Shuah Khan,
Mauro Carvalho Chehab, Nathan Chancellor, Nick Desaulniers,
Bill Wendling, Justin Stitt
Cc: Haoyang LIU, linux-doc, linux-kernel, llvm
Haoyang LIU <tttturtleruss@gmail.com> writes:
> Origin script can only accept a file as parameter, this commit enables
> it to scan a directory.
>
> Usage example:
> ./scripts/checktransupdate.py Documentation/translations/zh_CN/dev-tools
I've applied this, with one tweak:
> + else:
> + # check if the files are directories or files
> + new_files = []
> + for file in files:
> + if os.path.isfile(file):
> + new_files.append(file)
> + elif os.path.isdir(file):
> + # for directories, list all files in the directory and its subfolders
> + new_files.extend(list_files_with_excluding_folders(
> + file, [], "rst"))
There's no reason to break that line there, so I took the liberty of
joining it back together.
Thanks,
jon
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tools/docs/checktransupdate.py: add support for scanning directory
2026-03-09 16:07 ` Jonathan Corbet
@ 2026-03-09 16:32 ` Haoyang Liu
2026-03-09 16:39 ` Jonathan Corbet
0 siblings, 1 reply; 4+ messages in thread
From: Haoyang Liu @ 2026-03-09 16:32 UTC (permalink / raw)
To: Jonathan Corbet, Dongliang Mu, Yanteng Si, Alex Shi, Shuah Khan,
Mauro Carvalho Chehab, Nathan Chancellor, Nick Desaulniers,
Bill Wendling, Justin Stitt
Cc: linux-doc, linux-kernel, llvm
On 3/10/2026 12:07 AM, Jonathan Corbet wrote:
> Haoyang LIU <tttturtleruss@gmail.com> writes:
>
>> Origin script can only accept a file as parameter, this commit enables
>> it to scan a directory.
>>
>> Usage example:
>> ./scripts/checktransupdate.py Documentation/translations/zh_CN/dev-tools
> I've applied this, with one tweak:
>
>> + else:
>> + # check if the files are directories or files
>> + new_files = []
>> + for file in files:
>> + if os.path.isfile(file):
>> + new_files.append(file)
>> + elif os.path.isdir(file):
>> + # for directories, list all files in the directory and its subfolders
>> + new_files.extend(list_files_with_excluding_folders(
>> + file, [], "rst"))
> There's no reason to break that line there, so I took the liberty of
> joining it back together.
Dear Jon,
Thanks for pointing it out, I didn't notice when I make this change, and
I'm sorry for that.
Sincerely,
Haoyang
>
>
> Thanks,
>
> jon
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tools/docs/checktransupdate.py: add support for scanning directory
2026-03-09 16:32 ` Haoyang Liu
@ 2026-03-09 16:39 ` Jonathan Corbet
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Corbet @ 2026-03-09 16:39 UTC (permalink / raw)
To: Haoyang Liu, Dongliang Mu, Yanteng Si, Alex Shi, Shuah Khan,
Mauro Carvalho Chehab, Nathan Chancellor, Nick Desaulniers,
Bill Wendling, Justin Stitt
Cc: linux-doc, linux-kernel, llvm
Haoyang Liu <tttturtleruss@gmail.com> writes:
> On 3/10/2026 12:07 AM, Jonathan Corbet wrote:
>> Haoyang LIU <tttturtleruss@gmail.com> writes:
>>
>>> Origin script can only accept a file as parameter, this commit enables
>>> it to scan a directory.
>>>
>>> Usage example:
>>> ./scripts/checktransupdate.py Documentation/translations/zh_CN/dev-tools
>> I've applied this, with one tweak:
>>
>>> + else:
>>> + # check if the files are directories or files
>>> + new_files = []
>>> + for file in files:
>>> + if os.path.isfile(file):
>>> + new_files.append(file)
>>> + elif os.path.isdir(file):
>>> + # for directories, list all files in the directory and its subfolders
>>> + new_files.extend(list_files_with_excluding_folders(
>>> + file, [], "rst"))
>> There's no reason to break that line there, so I took the liberty of
>> joining it back together.
>
> Dear Jon,
>
> Thanks for pointing it out, I didn't notice when I make this change, and
> I'm sorry for that.
Not a big problem! Thanks for working to make our tools better.
jon
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-09 16:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-08 11:13 [PATCH] tools/docs/checktransupdate.py: add support for scanning directory Haoyang LIU
2026-03-09 16:07 ` Jonathan Corbet
2026-03-09 16:32 ` Haoyang Liu
2026-03-09 16:39 ` Jonathan Corbet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®