Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import sys, os, subprocess
if not os.path.exists('../recommonmark'):
subprocess.call('cd ..; 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
# MarkdownParser.github_doc_root = github_doc_root
def generate_doxygen_xml(app):
"""Run the doxygen make commands"""
subprocess.call('doxygen')
# -*- coding: utf-8 -*-
"""Helper utilty function for customization."""
import sys
import os
import docutils
import subprocess
if os.environ.get('READTHEDOCS', None) == 'True':
subprocess.call('cd ..; rm -rf recommonmark;' +
'git clone https://github.com/tqchen/recommonmark', shell=True)
sys.path.insert(0, os.path.abspath('../recommonmark/'))
from recommonmark import parser, transform
MarkdownParser = parser.CommonMarkParser
AutoStructify = transform.AutoStructify
def setup(app):
app.add_config_value('recommonmark_config', {
'url_resolver': lambda url: github_doc_root + url,
'auto_toc_tree_section': 'Contents',
}, True)
app.add_transform(md_transform.AutoStructify)
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# sys.path.insert(0, os.path.abspath('.'))
import recommonmark
from recommonmark import transform
AutoStructify = transform.AutoStructify
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.mathjax']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
if not _DEV_MODE:
subprocess.call('./build-notebooks.sh')
convert_md_table(curr_path)
build_r_docs(root_path)
build_scala_docs(root_path)
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
sys.stderr.write("build terminated by signal %s" % (-retcode))
except OSError as e:
sys.stderr.write("build execution failed: %s" % e)
if READTHEDOCS_BUILD or not os.path.exists('../recommonmark'):
subprocess.call('cd ..; rm -rf recommonmark;' +
'git clone https://github.com/tqchen/recommonmark', shell = True)
run_build_mxnet("..")
sys.path.insert(0, os.path.abspath('../recommonmark/'))
from recommonmark import parser, transform
MarkdownParser = parser.CommonMarkParser
AutoStructify = transform.AutoStructify
arnold_version = '5.1.1.1'
arnold_path_linux = '/opt/solidangle/arnold-{0}'.format( arnold_version )
arnold_path_osx = '/opt/solidangle/arnold-{0}'.format( arnold_version )
delight_version = '13.0.18'
delight_path_linux = '/opt/3delight-{0}'.format( delight_version )
delight_path_osx = '/opt/3delight-{0}'.format( delight_version )
tractor_version = '2.2'
tractor_path_linux = '/opt/pixar/Tractor-{0}'.format( tractor_version )
tractor_path_osx = '/Applications/pixar/Tractor-{0}'.format( tractor_version )
## \Todo See if the recommonmark folks would accept a patch with this
# functionality.
class GafferTransform( recommonmark.transform.AutoStructify ) :
def auto_admonition( self, node ) :
"""
Replace blockquotes beginning with "admonitionType :"
with the equivalent admonition.
"""
if not len( node ) :
return None
if not isinstance( node[0], docutils.nodes.paragraph ) :
return None
if not isinstance( node[0][0], docutils.nodes.Text ) :
return None
def setup(app):
app.add_config_value('recommonmark_config', {
'url_resolver': lambda url: github_doc_root + url,
'enable_auto_toc_tree': True,
'enable_eval_rst': True,
}, True)
app.add_transform(recommonmark.transform.AutoStructify)
if _JAVA_DOCS:
print("Building Java Docs!")
app.connect("builder-inited", build_java_docs)
if _CLOJURE_DOCS:
print("Building Clojure Docs!")
app.connect("builder-inited", build_clojure_docs)
if _R_DOCS:
print("Building R Docs!")
app.connect("builder-inited", build_r_docs)
app.connect('source-read', convert_table)
app.connect('source-read', add_buttons)
app.add_config_value('recommonmark_config', {
'url_resolver': lambda url: 'http://mxnet.io/' + url,
'enable_eval_rst': True,
}, True)
app.add_transform(transform.AutoStructify)