[Bf-docboard-svn] bf-manual: [7816] trunk/blender_docs: Remove Stale Po-file check

Aaron Carlisle noreply at blender.org
Wed Mar 10 20:50:22 CET 2021


Revision: 7816
          https://developer.blender.org/rBM7816
Author:   Blendify
Date:     2021-03-10 20:50:22 +0100 (Wed, 10 Mar 2021)
Log Message:
-----------
Remove Stale Po-file check

This is not needed after T83212

Modified Paths:
--------------
    trunk/blender_docs/Makefile
    trunk/blender_docs/make.bat
    trunk/blender_docs/tools_maintenance/update_po.py

Removed Paths:
-------------
    trunk/blender_docs/tools_rst/rst_check_locale.py

Modified: trunk/blender_docs/Makefile
===================================================================
--- trunk/blender_docs/Makefile	2021-03-10 19:45:21 UTC (rev 7815)
+++ trunk/blender_docs/Makefile	2021-03-10 19:50:22 UTC (rev 7816)
@@ -107,7 +107,6 @@
 
 check_structure:
 	@python3 tools_rst/rst_check_images.py
-	@python3 tools_rst/rst_check_locale.py
 
 check_spelling:
 	@python3 tools_rst/rst_check_spelling.py

Modified: trunk/blender_docs/make.bat
===================================================================
--- trunk/blender_docs/make.bat	2021-03-10 19:45:21 UTC (rev 7815)
+++ trunk/blender_docs/make.bat	2021-03-10 19:50:22 UTC (rev 7816)
@@ -125,7 +125,6 @@
 
 if "%1" == "check_structure" (
 	python tools_rst/rst_check_images.py
-	python tools_rst/rst_check_locale.py
 	goto EOF
 
 ) else (

Modified: trunk/blender_docs/tools_maintenance/update_po.py
===================================================================
--- trunk/blender_docs/tools_maintenance/update_po.py	2021-03-10 19:45:21 UTC (rev 7815)
+++ trunk/blender_docs/tools_maintenance/update_po.py	2021-03-10 19:50:22 UTC (rev 7816)
@@ -28,13 +28,7 @@
 from shlex import quote
 import re
 
-import importlib.util
-mod_file_path = os.path.join(os.path.dirname(__file__), "..", "tools_rst", "rst_check_locale.py")
-spec = importlib.util.spec_from_file_location("rst_check_locale", mod_file_path)
-rst_check_locale = importlib.util.module_from_spec(spec)
-spec.loader.exec_module(rst_check_locale)
 
-
 VERBOSE = False
 USE_MULTI_PROCESS = True
 
@@ -239,12 +233,6 @@
             run_svn(["add", *svn_files_new, *svn_dirs_new])
         del svn_files_new, svn_dirs_new
 
-    # Notify on redundant PO files.
-    try:
-        rst_check_locale.warn_locale()
-    except:
-        print("rst_check_locale.py has no warn_locale function")
-
     # ---------------------
     # Print Commit Messages
     #

Deleted: trunk/blender_docs/tools_rst/rst_check_locale.py
===================================================================
--- trunk/blender_docs/tools_rst/rst_check_locale.py	2021-03-10 19:45:21 UTC (rev 7815)
+++ trunk/blender_docs/tools_rst/rst_check_locale.py	2021-03-10 19:50:22 UTC (rev 7816)
@@ -1,80 +0,0 @@
-#!/usr/bin/env python3
-# Apache License, Version 2.0
-# <pep8 compliant>
-"""
-This tool checks for unused locale files,
-printing out the command to remove them (if any).
-"""
-
-import os
-import sys
-
-
-# if you want to operate on a subdir, e.g: "render"
-SUBDIR = ""
-CURRENT_DIR = os.path.abspath(os.path.dirname(__file__))
-ROOT_DIR = os.path.normpath(os.path.join(CURRENT_DIR, ".."))
-RST_DIR = os.path.join(ROOT_DIR, "manual", SUBDIR)
-LOCALE_DIR = os.path.join(ROOT_DIR, "locale")
-
-# -----------------------------------------------------------------------------
-# Common Utilities
-
-
-def files_recursive(path, ext_test):
-    for dirpath, dirnames, filenames in os.walk(path):
-        if dirpath.startswith("."):
-            continue
-
-        for filename in filenames:
-            ext = os.path.splitext(filename)[1]
-            if ext.lower().endswith(ext_test):
-                yield os.path.join(dirpath, filename)
-
-
-def print_title(title, underline="="):
-    print(f"\n{title.upper()}\n{len(title) * underline}")
-
-
-# -----------------------------------------------------------------------------
-# Locale Checks
-
-def warn_locale():
-    """
-    Check for stale PO files.
-    """
-    # files_rst = list(files_recursive(RST_DIR, ext_test=".rst"))
-    files_po = list(files_recursive(LOCALE_DIR, ext_test=".po"))
-
-    # Sphinx adds this file, it's not part of the manual but add it anyway.
-    ignore_suffix = (
-        os.path.join("LC_MESSAGES", "sphinx.po"),
-    )
-
-    print_title("List of unused locale:")
-
-    if files_po:
-        for f in files_po:
-            if f.endswith(ignore_suffix):
-                continue
-
-            # strip LOCALE_DIR from start
-            f_sub = f[len(LOCALE_DIR) + 1:-2] + "rst"
-            # strip 'fr/LC_MESSAGES'
-            f_sub = os.sep.join(f_sub.split(os.sep)[2:])
-            f_po_as_rst = os.path.join(RST_DIR, f_sub)
-            if not os.path.exists(f_po_as_rst):
-                print(" svn rm --force %s" % f[len(ROOT_DIR) + 1:])
-    return 0
-
-
-def main():
-    if "--help" in sys.argv:
-        print(__doc__)
-        sys.exit(0)
-
-    return warn_locale()
-
-
-if __name__ == "__main__":
-    main()



More information about the Bf-docboard-svn mailing list