aboutsummaryrefslogtreecommitdiff
path: root/thirdparty/fmt/support/mkdocs
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2025-11-07 14:49:13 +0100
committerGitHub Enterprise <[email protected]>2025-11-07 14:49:13 +0100
commit24e43a913f29ac3b314354e8ce5175f135bcc64f (patch)
treeca442937ceeb63461012b33a4576e9835099f106 /thirdparty/fmt/support/mkdocs
parentget oplog attachments (#622) (diff)
downloadzen-24e43a913f29ac3b314354e8ce5175f135bcc64f.tar.xz
zen-24e43a913f29ac3b314354e8ce5175f135bcc64f.zip
switch to xmake for package management (#611)
This change removes our dependency on vcpkg for package management, in favour of bringing some code in-tree in the `thirdparty` folder as well as using the xmake build-in package management feature. For the latter, all the package definitions are maintained in the zen repo itself, in the `repo` folder. It should now also be easier to build the project as it will no longer depend on having the right version of vcpkg installed, which has been a common problem for new people coming in to the codebase. Now you should only need xmake to build. * Bumps xmake requirement on github runners to 2.9.9 to resolve an issue where xmake on Windows invokes cmake with `v144` toolchain which does not exist * BLAKE3 is now in-tree at `thirdparty/blake3` * cpr is now in-tree at `thirdparty/cpr` * cxxopts is now in-tree at `thirdparty/cxxopts` * fmt is now in-tree at `thirdparty/fmt` * robin-map is now in-tree at `thirdparty/robin-map` * ryml is now in-tree at `thirdparty/ryml` * sol2 is now in-tree at `thirdparty/sol2` * spdlog is now in-tree at `thirdparty/spdlog` * utfcpp is now in-tree at `thirdparty/utfcpp` * xmake package repo definitions is in `repo` * implemented support for sanitizers. ASAN is supported on windows, TSAN, UBSAN, MSAN etc are supported on Linux/MacOS though I have not yet tested it extensively on MacOS * the zencore encryption implementation also now supports using mbedTLS which is used on MacOS, though for now we still use openssl on Linux * crashpad * bumps libcurl to 8.11.0 (from 8.8.0) which should address a rare build upload bug
Diffstat (limited to 'thirdparty/fmt/support/mkdocs')
-rwxr-xr-xthirdparty/fmt/support/mkdocs78
1 files changed, 78 insertions, 0 deletions
diff --git a/thirdparty/fmt/support/mkdocs b/thirdparty/fmt/support/mkdocs
new file mode 100755
index 000000000..610d81d67
--- /dev/null
+++ b/thirdparty/fmt/support/mkdocs
@@ -0,0 +1,78 @@
+#!/usr/bin/env python3
+# A script to invoke mkdocs with the correct environment.
+# Additionally supports deploying via mike:
+# ./mkdocs deploy [mike-deploy-options]
+
+import errno, os, shutil, sys
+from subprocess import call
+
+support_dir = os.path.dirname(os.path.normpath(__file__))
+build_dir = os.path.join(os.path.dirname(support_dir), 'build')
+
+# Set PYTHONPATH for the mkdocstrings handler.
+env = os.environ.copy()
+path = env.get('PYTHONPATH')
+env['PYTHONPATH'] = \
+ (path + ':' if path else '') + os.path.join(support_dir, 'python')
+
+redirect_page = \
+'''<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Redirecting</title>
+ <noscript>
+ <meta http-equiv="refresh" content="1; url=11.0/" />
+ </noscript>
+ <script>
+ window.location.replace(
+ "api/" + window.location.search + window.location.hash
+ );
+ </script>
+</head>
+<body>
+ Redirecting to <a href="api/">api</a>...
+</body>
+</html>
+'''
+
+config_path = os.path.join(support_dir, 'mkdocs.yml')
+args = sys.argv[1:]
+if len(args) > 0:
+ command = args[0]
+ if command == 'deploy':
+ git_url = 'https://github.com/' if 'CI' in os.environ else '[email protected]:'
+ site_repo = git_url + 'fmtlib/fmt.dev.git'
+
+ site_dir = os.path.join(build_dir, 'fmt.dev')
+ try:
+ shutil.rmtree(site_dir)
+ except OSError as e:
+ if e.errno == errno.ENOENT:
+ pass
+ ret = call(['git', 'clone', '--depth=1', site_repo, site_dir])
+ if ret != 0:
+ sys.exit(ret)
+
+ # Copy the config to the build dir because the site is built relative to it.
+ config_build_path = os.path.join(build_dir, 'mkdocs.yml')
+ shutil.copyfile(config_path, config_build_path)
+
+ version = args[1]
+ ret = call(['mike'] + args + ['--config-file', config_build_path,
+ '--branch', 'master'], cwd=site_dir, env=env)
+ if ret != 0 or version == 'dev':
+ sys.exit(ret)
+ current_doc_path = os.path.join(site_dir, version)
+ os.makedirs(current_doc_path, exist_ok=True)
+ redirect_page_path = os.path.join(current_doc_path, 'api.html')
+ with open(redirect_page_path, "w") as file:
+ file.write(redirect_page)
+ ret = call(['git', 'add', redirect_page_path], cwd=site_dir)
+ if ret != 0:
+ sys.exit(ret)
+ ret = call(['git', 'commit', '--amend', '--no-edit'], cwd=site_dir)
+ sys.exit(ret)
+ elif not command.startswith('-'):
+ args += ['-f', config_path]
+sys.exit(call(['mkdocs'] + args, env=env))