fmt/support/mkdocs

18 lines
496 B
Plaintext
Raw Normal View History

2024-06-02 16:29:07 +00:00
#!/usr/bin/env python3
# A script to invoke mkdocs with the correct environment.
import os, subprocess, sys
2024-06-09 18:37:18 +00:00
dirname = os.path.join(os.path.dirname(__file__), 'python')
2024-06-02 16:47:52 +00:00
2024-06-02 16:29:07 +00:00
# Set PYTHONPATH for the mkdocstrings handler.
env = os.environ.copy()
path = env.get('PYTHONPATH')
2024-06-02 16:47:52 +00:00
env['PYTHONPATH'] = (path + ':' if path else '') + dirname
2024-06-02 16:29:07 +00:00
2024-06-02 16:47:52 +00:00
config_path = os.path.join(dirname, 'mkdocs.yml')
2024-06-09 18:37:18 +00:00
args = sys.argv[1:]
if 'build' in args:
args += ['-f', config_path]
subprocess.run(['mkdocs'] + args, env=env)