linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] scripts/checktransupdate.py: add support for scanning directory
       [not found] <20250810161730.6530-1-tttturtleruss@gmail.com>
@ 2025-08-11  6:15 ` Dongliang Mu
  0 siblings, 0 replies; only message in thread
From: Dongliang Mu @ 2025-08-11  6:15 UTC (permalink / raw)
  To: Haoyang LIU, Nathan Chancellor, Nick Desaulniers, Bill Wendling,
	Justin Stitt, dzm91, Yanteng Si, Alex Shi, Jonathan Corbet
  Cc: hust-os-kernel-patches, linux-kernel, llvm,
	open list:DOCUMENTATION

+to Yanteng, Dongliang, Alex and Jon

+cc linux-doc mailing list

On 8/11/25 12:17 AM, Haoyang LIU wrote:
> 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
>
> Signed-off-by: Haoyang LIU <tttturtleruss@gmail.com>
> ---
>   scripts/checktransupdate.py | 26 +++++++++++++++++++++++++-
>   1 file changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/checktransupdate.py b/scripts/checktransupdate.py
> index e39529e46c3d..0d197d036650 100755
> --- a/scripts/checktransupdate.py
> +++ b/scripts/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.
>   - ./scripts/checktransupdate.py Documentation/translations/zh_CN/dev-tools/testing-overview.rst
>   This will only print the status of the specified file.
> +- ./scripts/checktransupdate.py Documentation/translations/zh_CN/dev-tools
> +This will print all the files in the specified folder and its subfolders.
>   
>   The output is something like:
>   Documentation/dev-tools/kfence.rst
> @@ -21,6 +23,17 @@ No translation in the locale of zh_CN
>   Documentation/translations/zh_CN/dev-tools/testing-overview.rst
>   commit 42fb9cfd5b18 ("Documentation: dev-tools: Add link to RV docs")
>   1 commits needs resolving in total
> +
> +Documentation/translations/zh_CN/dev-tools/index.rst
> +commit d5af79c05e93 ("Documentation: move dev-tools debugging files to process/debugging/")
> +commit d5dc95836147 ("kbuild: Add Propeller configuration for kernel build")
> +commit 315ad8780a12 ("kbuild: Add AutoFDO support for Clang build")
> +3 commits needs resolving in total
> +
> +Documentation/translations/zh_CN/dev-tools/kcsan.rst
> +commit b37221cc861d ("Documentation: kcsan: fix "Plain Accesses and Data Races" URL in kcsan.rst")
> +commit 72ffee678f6f ("docs: update dev-tools/kcsan.rst url about KTSAN")
> +2 commits needs resolving in total
>   """
>   
>   import os
> @@ -131,7 +144,7 @@ def check_per_file(file_path):
>       opath = get_origin_path(file_path)
>   
>       if not os.path.isfile(opath):
> -        logging.error("Cannot find the origin path for {file_path}")
> +        logging.error(f"Cannot find the origin path for {file_path}")
>           return
>   
>       o_from_head = get_latest_commit_from(opath, "HEAD")
> @@ -293,6 +306,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))
>   


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-08-11  6:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250810161730.6530-1-tttturtleruss@gmail.com>
2025-08-11  6:15 ` [PATCH] scripts/checktransupdate.py: add support for scanning directory Dongliang Mu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).