summaryrefslogtreecommitdiffstats
path: root/modules/freetype2/builds/meson/generate_reference_docs.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /modules/freetype2/builds/meson/generate_reference_docs.py
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'modules/freetype2/builds/meson/generate_reference_docs.py')
-rw-r--r--modules/freetype2/builds/meson/generate_reference_docs.py89
1 files changed, 89 insertions, 0 deletions
diff --git a/modules/freetype2/builds/meson/generate_reference_docs.py b/modules/freetype2/builds/meson/generate_reference_docs.py
new file mode 100644
index 0000000000..4208bb6771
--- /dev/null
+++ b/modules/freetype2/builds/meson/generate_reference_docs.py
@@ -0,0 +1,89 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2020-2023 by
+# David Turner, Robert Wilhelm, and Werner Lemberg.
+#
+# This file is part of the FreeType project, and may only be used, modified,
+# and distributed under the terms of the FreeType project license,
+# LICENSE.TXT. By continuing to use, modify, or distribute this file you
+# indicate that you have read the license and understand and accept it
+# fully.
+
+"""Generate FreeType reference documentation."""
+
+from __future__ import print_function
+
+import argparse
+import glob
+import os
+import subprocess
+import sys
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__)
+
+ parser.add_argument(
+ "--input-dir",
+ required=True,
+ help="Top-level FreeType source directory.",
+ )
+
+ parser.add_argument(
+ "--version", required=True, help='FreeType version (e.g. "2.x.y").'
+ )
+
+ parser.add_argument(
+ "--output-dir", required=True, help="Output directory."
+ )
+
+ args = parser.parse_args()
+
+ # Get the list of input files of interest.
+ include_dir = os.path.join(args.input_dir, "include")
+ include_config_dir = os.path.join(include_dir, "config")
+ include_cache_dir = os.path.join(include_dir, "cache")
+
+ all_headers = (
+ glob.glob(os.path.join(args.input_dir, "include", "freetype", "*.h"))
+ + glob.glob(
+ os.path.join(
+ args.input_dir, "include", "freetype", "config", "*.h"
+ )
+ )
+ + glob.glob(
+ os.path.join(
+ args.input_dir, "include", "freetype", "cache", "*.h"
+ )
+ )
+ )
+
+ if not os.path.exists(args.output_dir):
+ os.makedirs(args.output_dir)
+ else:
+ assert os.path.isdir(args.output_dir), (
+ "Not a directory: " + args.output_dir
+ )
+
+ cmds = [
+ sys.executable,
+ "-m",
+ "docwriter",
+ "--prefix=ft2",
+ "--title=FreeType-" + args.version,
+ "--site=reference",
+ "--output=" + args.output_dir,
+ ] + all_headers
+
+ print("Running docwriter...")
+ subprocess.check_call(cmds)
+
+ print("Building static site...")
+ subprocess.check_call(
+ [sys.executable, "-m", "mkdocs", "build"], cwd=args.output_dir
+ )
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())