Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/tools/maint/check_emcc_help_text.py
4150 views
1
#!/usr/bin/env python3
2
# Copyright 2020 The Emscripten Authors. All rights reserved.
3
# Emscripten is available under two separate licenses, the MIT license and the
4
# University of Illinois/NCSA Open Source License. Both these licenses can be
5
# found in the LICENSE file.
6
7
"""Verifies that 'docs/emcc.txt' is in sync with sphinx output."""
8
9
import os
10
import subprocess
11
import sys
12
from pathlib import Path
13
14
script_dir = os.path.dirname(os.path.abspath(__file__))
15
root_dir = os.path.dirname(os.path.dirname(script_dir))
16
17
18
def main():
19
build_output = os.path.join(root_dir, 'site', 'build', 'text', 'docs', 'tools_reference', 'emcc.txt')
20
docs_file = os.path.join(root_dir, 'docs', 'emcc.txt')
21
22
if not os.path.exists(build_output):
23
print('doc build output not found: %s' % build_output)
24
return 1
25
26
emcc_docs_output = Path(build_output).read_text()
27
emcc_docs = Path(docs_file).read_text()
28
29
if emcc_docs_output != emcc_docs:
30
print('contents of checked in docs/emcc.txt does not match build output:')
31
subprocess.call(['diff', '-u', build_output, docs_file])
32
return 1
33
34
print('docs look good')
35
36
37
if __name__ == '__main__':
38
sys.exit(main())
39
40