forked from apache/mxnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sphinx_util.py
42 lines (34 loc) · 1.44 KB
/
sphinx_util.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# -*- coding: utf-8 -*-
"""Helper utilty function for customization."""
import sys
import os
import docutils
import subprocess
READTHEDOCS_BUILD = (os.environ.get('READTHEDOCS', None) is not None)
def run_build_mxnet(folder):
"""Run the doxygen make command in the designated folder."""
try:
if READTHEDOCS_BUILD:
subprocess.call('cp make/readthedocs.mk config.mk', shell = True)
subprocess.call('rm -rf build', shell = True)
retcode = subprocess.call("cd %s; make" % folder, shell = True)
if retcode < 0:
sys.stderr.write("build terminated by signal %s" % (-retcode))
except OSError as e:
sys.stderr.write("build execution failed: %s" % e)
# run_build_mxnet("..")
# sys.stderr.write('READTHEDOCS=%s\n' % (READTHEDOCS_BUILD))
# if not os.path.exists('web-data'):
# subprocess.call('rm -rf web-data;' +
# 'git clone https://github.com/dmlc/web-data', shell = True)
# else:
# subprocess.call('cd web-data; git pull', shell=True)
if not os.path.exists('../recommonmark'):
subprocess.call('cd ..; rm -rf recommonmark;' +
'git clone https://github.com/tqchen/recommonmark', shell = True)
else:
subprocess.call('cd ../recommonmark/; git pull', shell=True)
sys.path.insert(0, os.path.abspath('../recommonmark/'))
from recommonmark import parser, transform
MarkdownParser = parser.CommonMarkParser
AutoStructify = transform.AutoStructify