Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools/docs/checktransupdate.py: add support for scanning directory

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>
[jc: tweaked coding style]
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <20260308111314.27333-1-tttturtleruss@gmail.com>

authored by

Haoyang LIU and committed by
Jonathan Corbet
fcbf51dd 1722b500

+13 -1
+13 -1
tools/docs/checktransupdate.py
··· 13 13 This will print all the files that need to be updated or translated in the zh_CN locale. 14 14 - tools/docs/checktransupdate.py Documentation/translations/zh_CN/dev-tools/testing-overview.rst 15 15 This will only print the status of the specified file. 16 + - tools/docs/checktransupdate.py Documentation/translations/zh_CN/dev-tools 17 + This will print the status of all files under the directory. 16 18 17 19 The output is something like: 18 20 Documentation/dev-tools/kfence.rst ··· 264 262 help='Set the logging file (default: checktransupdate.log)') 265 263 266 264 parser.add_argument( 267 - "files", nargs="*", help="Files to check, if not specified, check all files" 265 + "files", nargs="*", help="Files or directories to check, if not specified, check all files" 268 266 ) 269 267 args = parser.parse_args() 270 268 ··· 295 293 if args.print_missing_translations: 296 294 logging.info(os.path.relpath(os.path.abspath(file), linux_path)) 297 295 logging.info("No translation in the locale of %s\n", args.locale) 296 + else: 297 + # check if the files are directories or files 298 + new_files = [] 299 + for file in files: 300 + if os.path.isfile(file): 301 + new_files.append(file) 302 + elif os.path.isdir(file): 303 + # for directories, list all files in the directory and its subfolders 304 + new_files.extend(list_files_with_excluding_folders(file, [], "rst")) 305 + files = new_files 298 306 299 307 files = list(map(lambda x: os.path.relpath(os.path.abspath(x), linux_path), files)) 300 308