Ejemplo n.º 1
0
def setup(app):
    from mozbuild.virtualenv import VirtualenvManager
    from moztreedocs import manager

    app.add_directive('mozbuildsymbols', MozbuildSymbols)

    # Unlike typical Sphinx installs, our documentation is assembled from
    # many sources and staged in a common location. This arguably isn't a best
    # practice, but it was the easiest to implement at the time.
    #
    # Here, we invoke our custom code for staging/generating all our
    # documentation.
    manager.generate_docs(app)
    app.srcdir = manager.staging_dir

    # We need to adjust sys.path in order for Python API docs to get generated
    # properly. We leverage the in-tree virtualenv for this.
    topsrcdir = manager.topsrcdir
    ve = VirtualenvManager(
        topsrcdir, os.path.join(topsrcdir, 'dummy-objdir'),
        os.path.join(app.outdir, '_venv'), sys.stderr,
        os.path.join(topsrcdir, 'build', 'virtualenv_packages.txt'))
    ve.ensure()
    ve.activate()