Path: blob/main/tools/maint/check_emcc_help_text.py
4150 views
#!/usr/bin/env python31# Copyright 2020 The Emscripten Authors. All rights reserved.2# Emscripten is available under two separate licenses, the MIT license and the3# University of Illinois/NCSA Open Source License. Both these licenses can be4# found in the LICENSE file.56"""Verifies that 'docs/emcc.txt' is in sync with sphinx output."""78import os9import subprocess10import sys11from pathlib import Path1213script_dir = os.path.dirname(os.path.abspath(__file__))14root_dir = os.path.dirname(os.path.dirname(script_dir))151617def main():18build_output = os.path.join(root_dir, 'site', 'build', 'text', 'docs', 'tools_reference', 'emcc.txt')19docs_file = os.path.join(root_dir, 'docs', 'emcc.txt')2021if not os.path.exists(build_output):22print('doc build output not found: %s' % build_output)23return 12425emcc_docs_output = Path(build_output).read_text()26emcc_docs = Path(docs_file).read_text()2728if emcc_docs_output != emcc_docs:29print('contents of checked in docs/emcc.txt does not match build output:')30subprocess.call(['diff', '-u', build_output, docs_file])31return 13233print('docs look good')343536if __name__ == '__main__':37sys.exit(main())383940