Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2022-06-17 18:07:37 +0300
committerBastien Montagne <bastien@blender.org>2022-06-17 18:07:37 +0300
commitd86af604290be0507db113dc8c82540bb30d4fd3 (patch)
tree931ca579278174e495f39764ec2efa040ef0e338 /doc/python_api/sphinx_doc_gen.py
parent3c0162295f76cdd8fe32bc255f3850d35dab49cf (diff)
TEST COMMIT: API doc generation changes.
This commit is intended to be reverted within a few minutes. commit 50adc860a652508570dbc7102ef288049a9ffed4 Author: Bastien Montagne <bastien@blender.org> Date: Wed Jun 15 15:43:13 2022 +0200 Py API Doc: add runtime changelog generation to `sphinx_doc_gen.py`. Optionally use `sphinx_changelog_gen.py` to dump current version of the API in a JSON file, and use closest previous one listed in given index file to create a changelog RST page for Sphinx. commit 88fc683e78f866f1b3cda379c3b90e1f2916ce00 Author: Bastien Montagne <bastien@blender.org> Date: Wed Jun 15 15:36:19 2022 +0200 Py API Doc: refactor changelog generation script. Main change is to make it use JSON format for its dump files, instead of some Python code. It also introduces an index for those API dump files, mapping a blender version to the relevant file path. This is then used to automatically the most recent (version-number wise) previous API dump to compare against current one, when generating the change log RST file.
Diffstat (limited to 'doc/python_api/sphinx_doc_gen.py')
-rw-r--r--doc/python_api/sphinx_doc_gen.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index 8d4320917fc..4f27b662c60 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -142,6 +142,26 @@ def handle_args():
)
parser.add_argument(
+ "--api-changelog-generate",
+ dest="changelog",
+ default=False,
+ action='store_true',
+ help="Generate the API changelog RST file "
+ "(default=False, requires `--api-dump-index-path` parameter)",
+ required=False,
+ )
+
+ parser.add_argument(
+ "--api-dump-index-path",
+ dest="api_dump_index_path",
+ metavar='FILE',
+ default=None,
+ help="Path to the API dump index JSON file "
+ "(required when `--api-changelog-generate` is True)",
+ required=False,
+ )
+
+ parser.add_argument(
"-o", "--output",
dest="output_dir",
type=str,
@@ -514,6 +534,26 @@ if ARGS.sphinx_build_pdf:
sphinx_make_pdf_log = os.path.join(ARGS.output_dir, ".latex_make.log")
SPHINX_MAKE_PDF_STDOUT = open(sphinx_make_pdf_log, "w", encoding="utf-8")
+
+# --------------------------------CHANGELOG GENERATION--------------------------------------
+
+def generate_changelog():
+ import importlib.util
+ spec = importlib.util.spec_from_file_location("sphinx_changelog_gen",
+ os.path.abspath(os.path.join(SCRIPT_DIR, "sphinx_changelog_gen.py")))
+ sphinx_changelog_gen = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(sphinx_changelog_gen)
+
+ API_DUMP_INDEX_FILEPATH = ARGS.api_dump_index_path
+ API_DUMP_ROOT = os.path.dirname(API_DUMP_INDEX_FILEPATH)
+ API_DUMP_FILEPATH = os.path.abspath(os.path.join(API_DUMP_ROOT, BLENDER_VERSION_DOTS, "api_dump.json"))
+ API_CHANGELOG_FILEPATH = os.path.abspath(os.path.join(SPHINX_IN_TMP, "change_log.rst"))
+
+ sphinx_changelog_gen.main(("--", "--indexpath", API_DUMP_INDEX_FILEPATH, "dump", "--filepath-out", API_DUMP_FILEPATH))
+
+ sphinx_changelog_gen.main(("--", "--indexpath", API_DUMP_INDEX_FILEPATH, "changelog", "--filepath-out", API_CHANGELOG_FILEPATH))
+
+
# --------------------------------API DUMP--------------------------------------
# Lame, python won't give some access.
@@ -2473,6 +2513,9 @@ def main():
rna2sphinx(SPHINX_IN_TMP)
+ if ARGS.changelog:
+ generate_changelog()
+
if ARGS.full_rebuild:
# Only for full updates.
shutil.rmtree(SPHINX_IN, True)