From 69e90daae36b068b1ec0afa830f4e587a8005d44 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Sun, 24 Oct 2021 01:48:03 -0500 Subject: [PATCH] Rename "makerst.py" to "make_rst.py" (cherry picked from commits 8f05e26198d6b8bcf620f2e87ca671bb74cf82de and cce7797a756fff15d7b3753637642482f0884abd) --- .github/workflows/static_checks.yml | 2 +- doc/Makefile | 2 +- doc/tools/{makerst.py => make_rst.py} | 4 +++- doc/translations/extract.py | 4 ++-- misc/hooks/README.md | 4 ++-- misc/hooks/pre-commit | 2 +- misc/hooks/{pre-commit-makerst => pre-commit-make-rst} | 4 ++-- 7 files changed, 12 insertions(+), 10 deletions(-) rename doc/tools/{makerst.py => make_rst.py} (99%) rename misc/hooks/{pre-commit-makerst => pre-commit-make-rst} (78%) diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml index 273d8a1e51a..cdecfc40ac8 100644 --- a/.github/workflows/static_checks.yml +++ b/.github/workflows/static_checks.yml @@ -44,4 +44,4 @@ jobs: - name: Documentation checks run: | - doc/tools/makerst.py --dry-run doc/classes modules + doc/tools/make_rst.py --dry-run doc/classes modules diff --git a/doc/Makefile b/doc/Makefile index 77738a40de4..87a442389e2 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -24,7 +24,7 @@ markdown: rst: rm -rf $(OUTPUTDIR)/rst mkdir -p $(OUTPUTDIR)/rst - python3 $(TOOLSDIR)/makerst.py -o $(OUTPUTDIR)/rst $(CLASSES) + python3 $(TOOLSDIR)/make_rst.py -o $(OUTPUTDIR)/rst $(CLASSES) rstjs: rm -rf $(OUTPUTDIR)/rstjs diff --git a/doc/tools/makerst.py b/doc/tools/make_rst.py similarity index 99% rename from doc/tools/makerst.py rename to doc/tools/make_rst.py index b3313c95339..746bfd199d4 100755 --- a/doc/tools/makerst.py +++ b/doc/tools/make_rst.py @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# This script makes RST files from the XML class reference for use with the online docs. + import argparse import os import re @@ -399,7 +401,7 @@ def make_rst_class(class_def, state, dry_run, output_dir): # type: (ClassDef, S # Warn contributors not to edit this file directly f.write(":github_url: hide\n\n") - f.write(".. Generated automatically by doc/tools/makerst.py in Godot's source tree.\n") + f.write(".. Generated automatically by doc/tools/make_rst.py in Godot's source tree.\n") f.write(".. DO NOT EDIT THIS FILE, but the " + class_name + ".xml source instead.\n") f.write(".. The source is found in doc/classes or modules//doc_classes.\n\n") diff --git a/doc/translations/extract.py b/doc/translations/extract.py index a13680a6131..68ac5d59f53 100644 --- a/doc/translations/extract.py +++ b/doc/translations/extract.py @@ -24,7 +24,7 @@ msgstr "" "Content-Transfer-Encoding: 8-bit\\n" """ -# Some strings used by makerst.py are normally part of the editor translations, +# Some strings used by make_rst.py are normally part of the editor translations, # so we need to include them manually here for the online docs. BASE_STRINGS = [ "Description", @@ -225,7 +225,7 @@ def _generate_translation_catalog_file(unique_msgs, output): with open(output, "w", encoding="utf8") as f: f.write(HEADER) for msg in BASE_STRINGS: - f.write("#: doc/tools/makerst.py\n") + f.write("#: doc/tools/make_rst.py\n") f.write('msgid "{}"\n'.format(msg)) f.write('msgstr ""\n\n') for msg in unique_msgs: diff --git a/misc/hooks/README.md b/misc/hooks/README.md index 5661c239edd..e420c6cb5c3 100644 --- a/misc/hooks/README.md +++ b/misc/hooks/README.md @@ -12,8 +12,8 @@ contributors to make sure they comply with our requirements. `PATH`, or if you want to enable colored output with `pygmentize`. - Pre-commit hook for `black`: Applies `black` to the staged Python files before accepting a commit. -- Pre-commit hook for `makerst`: Checks the class reference syntax using - `makerst.py`. +- Pre-commit hook for `make_rst`: Checks the class reference syntax using + `make_rst.py`. ## Installation diff --git a/misc/hooks/pre-commit b/misc/hooks/pre-commit index 40cb00253b3..ab0fc8176fe 100755 --- a/misc/hooks/pre-commit +++ b/misc/hooks/pre-commit @@ -14,7 +14,7 @@ # as this script. Hooks should return 0 if successful and nonzero to cancel the # commit. They are executed in the order in which they are listed. #HOOKS="pre-commit-compile pre-commit-uncrustify" -HOOKS="pre-commit-clang-format pre-commit-black pre-commit-makerst" +HOOKS="pre-commit-clang-format pre-commit-black pre-commit-make-rst" ########################################################### # There should be no need to change anything below this line. diff --git a/misc/hooks/pre-commit-makerst b/misc/hooks/pre-commit-make-rst similarity index 78% rename from misc/hooks/pre-commit-makerst rename to misc/hooks/pre-commit-make-rst index b990788b991..38b397c4944 100755 --- a/misc/hooks/pre-commit-makerst +++ b/misc/hooks/pre-commit-make-rst @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Git pre-commit hook that checks the class reference syntax using makerst.py. +# Git pre-commit hook that checks the class reference syntax using make_rst.py. # Workaround because we can't execute the .py file directly on windows PYTHON=python @@ -9,4 +9,4 @@ if [[ "$py_ver" != "3" ]]; then PYTHON+=3 fi -$PYTHON doc/tools/makerst.py doc/classes modules --dry-run +$PYTHON doc/tools/make_rst.py doc/classes modules --dry-run