forked from sberbank-ai-lab/LightAutoML
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_docs.py
More file actions
22 lines (16 loc) · 811 Bytes
/
check_docs.py
File metadata and controls
22 lines (16 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import logging
import os
logging.basicConfig(
format='[%(asctime)s] (%(levelname)s): %(message)s', level=logging.DEBUG)
logging.debug('Check that all .rst files compile to .html.')
DOCS_PATH = os.path.join(os.path.dirname(__file__), 'docs')
RSTS_PATH = os.path.join(DOCS_PATH, 'generated')
HTML_PATH = os.path.join(DOCS_PATH, os.path.join('_build', 'html', 'generated'))
html_filenames = [os.path.splitext(name)[0] + '.html' for name in os.listdir(RSTS_PATH) if '.rst' in name]
html_filenames = sorted(html_filenames)
logging.debug('.rst filenames: {}'.format(html_filenames))
for fname in html_filenames:
fpath = os.path.join(HTML_PATH, fname)
logging.debug('Check {}'.format(fname))
assert os.path.exists(fpath), 'File {} doesn`t exist.'.format(fpath)
logging.debug('All files exists.')