Move emcc.txt and check that its up-to-date during CI (#11099)

This commit is contained in:
Sam Clegg 2020-05-07 21:49:08 -04:00 коммит произвёл GitHub
Родитель 68bfc93b9a
Коммит 569dbacea6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 46 добавлений и 8 удалений

Просмотреть файл

@ -340,7 +340,10 @@ jobs:
executor: bionic
steps:
- checkout
- run: pip3 install sphinx==1.4.9
- run: make -C site html
- run: make -C site text
- run: tests/check_emcc_help_text.py
flake8:
executor: bionic
steps:

Просмотреть файл

11
emcc.py
Просмотреть файл

@ -622,14 +622,11 @@ def run(args):
if '--help' in args:
# Documentation for emcc and its options must be updated in:
# site/source/docs/tools_reference/emcc.rst
# A prebuilt local version of the documentation is available at:
# This then gets built (via: `make -C site text`) to:
# site/build/text/docs/tools_reference/emcc.txt
# (it is read from there and printed out when --help is invoked)
# You can also build docs locally as HTML or other formats in site/
# An online HTML version (which may be of a different version of Emscripten)
# is up at http://kripken.github.io/emscripten-site/docs/tools_reference/emcc.html
with open(shared.path_from_root('site', 'build', 'text', 'docs', 'tools_reference', 'emcc.txt'), 'r') as f:
# This then needs to be copied to its final home in docs/emcc.txt from where
# we read it here. We have CI rules that ensure its always up-to-date.
with open(shared.path_from_root('docs', 'emcc.txt'), 'r') as f:
print(f.read())
print('''

39
tests/check_emcc_help_text.py поставляемый Executable file
Просмотреть файл

@ -0,0 +1,39 @@
#!/usr/bin/env python3
# Copyright 2020 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
"""Verifies that 'docs/emcc.txt' is in sync with sphinx output."""
import os
import subprocess
import sys
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def main():
build_output = os.path.join(root, 'site', 'build', 'text', 'docs', 'tools_reference', 'emcc.txt')
docs_file = os.path.join(root, 'docs', 'emcc.txt')
if not os.path.exists(build_output):
print('doc build output not found: %s' % build_output)
return 1
with open(build_output, 'r') as f:
emcc_docs_output = f.read()
with open(docs_file, 'r') as f:
emcc_docs = f.read()
if emcc_docs_output != emcc_docs:
print('contents of checked in docs/emcc.txt does not match build output:')
subprocess.call(['diff', '-u', build_output, docs_file])
return 1
print('docs look good')
if __name__ == '__main__':
sys.exit(main())

Просмотреть файл

@ -23,7 +23,6 @@ EXCLUDES = '''
tests/third_party
site
node_modules
docs
Makefile
.git
'''.split()