scripts/checktransupdate.py: add support for scanning directory
PATCH v2 1/1 scripts/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
---
V1 -> V2: remove the fix of missing "f" in f-string and make it a new patch
scripts/checktransupdate.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
scripts/checktransupdate.py +24 -0
@@ -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
@@ -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))
Signature · 1 line
2.50.1
Hi Haoyang,
Quoted 6 lines · Haoyang LIU
Origin script can only accept a file as parameter, this commit enables it to scan a directory.
Usage example:
./scripts/checktransupdate.pyDocumentation/translations/zh_CN/dev-tools
Quoted 7 lines
Signed-off-by Haoyang LIU <[email protected]>---
V1 -> V2: remove the fix of missing "f" in f-string and make it a new patch
scripts/checktransupdate.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
Thanks for the update. While this seems reasonable to me from a purely surface level glance over the actual Python, I have added the Documentation folks that Dongliang added from the previous thread, who really own and maintain this file (the original patch is at [1]). Please include them in future revisions should they be necessary. It would probably be good for something like this to be applied?
MAINTAINERS +1 -0
@@ -7302,6 +7302,7 @@ P: Documentation/doc-guide/maintainer-profile.rst T: git git://git.lwn.net/linux.git docs-next F: Documentation/ F: scripts/check-variable-fonts.sh +F: scripts/checktransupdate.py F: scripts/documentation-file-ref-check F: scripts/get_abi.py F: scripts/kernel-doc*
[1]: https://lore.kernel.org/[email protected]/
Cheers,
Nathan
Quoted 14 lines · Nathan Chancellor' via HUST OS Kernel Contribution
Hi Haoyang,
Quoted 11 lines · Haoyang LIU
Origin script can only accept a file as parameter, this commit enables it to scan a directory.
Usage example:
./scripts/checktransupdate.pyDocumentation/translations/zh_CN/dev-toolsSigned-off-by Haoyang LIU <[email protected]>---
V1 -> V2: remove the fix of missing "f" in f-string and make it a new patch
Quoted 8 lines
Quoted 2 lines
scripts/checktransupdate.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)Thanks for the update. While this seems reasonable to me from a purely surface level glance over the actual Python, I have added the Documentation folks that Dongliang added from the previous thread, who really own and maintain this file (the original patch is at [1]). Please include them in future revisions should they be necessary. It would probably be good for something like this to be applied?
Thanks for the suggestion. I've submitted a patch[1].
[1] https://lore.kernel.org/linux-doc/[email protected]/
Quoted 19 lines
MAINTAINERS +1
-0@@ -7302,6 +7302,7 @@ P: Documentation/doc-guide/maintainer-profile.rst T: git git://git.lwn.net/linux.git docs-next F: Documentation/ F: scripts/check-variable-fonts.sh +F: scripts/checktransupdate.py F: scripts/documentation-file-ref-check F: scripts/get_abi.py F: scripts/kernel-doc*[1]: https://lore.kernel.org/[email protected]/
Cheers,
Nathan
Quoted 21 lines · Nathan Chancellor
Hi Haoyang,
Quoted 6 lines · Haoyang LIU
Origin script can only accept a file as parameter, this commit enables it to scan a directory.
Usage example:
./scripts/checktransupdate.pyDocumentation/translations/zh_CN/dev-toolsQuoted 7 lines
Signed-off-by Haoyang LIU <[email protected]>---
V1 -> V2: remove the fix of missing "f" in f-string and make it a new patch
scripts/checktransupdate.py| 24 ++++++++++++++++++++++++1 file changed, 24 insertions(+)
Quoted 6 lines
Thanks for the update. While this seems reasonable to me from a purely surface level glance over the actual Python, I have added the Documentation folks that Dongliang added from the previous thread, who really own and maintain this file (the original patch is at [1]). Please include them in future revisions should they be necessary. It would probably be good for something like this to be applied?
Hi Nathan
That makes sense. My V1 patch also missed Dongliang Mu and the other maintainers. Thanks for pointing it out.
Sincerely,
Haoyang
Quoted 18 lines
MAINTAINERS +0
-0@@ -7302,6 +7302,7 @@ P: Documentation/doc-guide/maintainer-profile.rstT: git
git://git.lwn.net/linux.gitdocs-next
F:Documentation/
F:scripts/check-variable-fonts.sh
+F:scripts/checktransupdate.py
F:scripts/documentation-file-ref-check
F:scripts/get_abi.py
F:scripts/kernel-doc*[1]: https://lore.kernel.org/[email protected]/
Cheers,
Nathan