Projects#

Other projects are included by copying their documentation into the projects directory e.g.

# Separately built trade_engine docs, published under projects/trade_engine/.
TRADE_ENGINE_HTML = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..', 'trade_engine', 'docs', '_build', 'html'))

def _copy_trade_engine_docs(app, exception):
    if exception or app.builder.format != 'html':
        return
    if not os.path.isdir(TRADE_ENGINE_HTML):
        from sphinx.util import logging
        logging.getLogger(__name__).warning(
            'trade_engine docs not built: %s', TRADE_ENGINE_HTML)
        return
    shutil.copytree(TRADE_ENGINE_HTML, os.path.join(app.outdir, 'projects', 'trade_engine'),
                    ignore=shutil.ignore_patterns('.doctrees', '.buildinfo'),
                    dirs_exist_ok=True)

def setup(app):
    app.connect('build-finished', _copy_trade_engine_docs)