当前位置: 首页>>代码示例>>Python>>正文


Python sphinx.build_main方法代码示例

本文整理汇总了Python中sphinx.build_main方法的典型用法代码示例。如果您正苦于以下问题:Python sphinx.build_main方法的具体用法?Python sphinx.build_main怎么用?Python sphinx.build_main使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sphinx的用法示例。


在下文中一共展示了sphinx.build_main方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_build_ok

# 需要导入模块: import sphinx [as 别名]
# 或者: from sphinx import build_main [as 别名]
def test_build_ok(self):
        args = [
            "build_sphinx",
            "-E",  # Dont use a saved environment but rebuild it completely.
            "-q",  # Do not output anything on standard output, only write warnings and errors to standard error.
            "-w{}".format(
                self.stderr_file
            ),  # Write warnings (and errors) to the given file
            self.rst_source_files_dir,  # souce dir of rst files
            self.build_output_dir,  # output dir for html files
        ]

        exit_status = build_main(args)

        self.assertEqual(exit_status, 0)
        # Confirm that html file was generated:
        self.assertTrue(
            os.path.isfile(os.path.join(self.build_output_dir, "contents.html"))
        )
        #  Confirm there is no content (no errors/warnings) in self.stderr_file:
        self.assertEqual(os.stat(self.stderr_file).st_size, 0) 
开发者ID:genialis,项目名称:resolwe,代码行数:23,代码来源:test_docs.py

示例2: build

# 需要导入模块: import sphinx [as 别名]
# 或者: from sphinx import build_main [as 别名]
def build(ctx, source, nowarn):
    """
    Build documentation from ``source``, placing built files in
    ``target``.
    """
    _logger.info('building documentation')
    outdir = ctx.obj['outdir']

    if sphinx_version_at_least_1_7:
        # args have to be specified this way for 1.7+, otherwise one gets
        # "Builder name  html not registered or available through entry point"
        # See https://github.com/sphinx-doc/sphinx/issues/4623
        args = ['-b', 'html']
    else:
        args = ['-b html']

    if not nowarn:
        args.append('-W')
    if build_main(args + [source, outdir]):
        raise click.ClickException("Error building sphinx doc") 
开发者ID:Syntaf,项目名称:travis-sphinx,代码行数:22,代码来源:build.py

示例3: sphinx_build

# 需要导入模块: import sphinx [as 别名]
# 或者: from sphinx import build_main [as 别名]
def sphinx_build(src_dir, build_dir):
    import sphinx
    cmd = [ '-b', 'html',
            '-d', op.join(build_dir, 'doctrees'),
            src_dir,  # Source
            op.join(build_dir, 'html'),  # Dest
            ]

    if sphinx.version_info > (1, 7):
        import sphinx.cmd.build
        ret = sphinx.cmd.build.build_main(cmd)
    else:
        ret = sphinx.build_main(['sphinx-build'] + cmd)
    if ret != 0:
        raise RuntimeError('Sphinx error: %s' % ret)
    print("Build finished. The HTML pages are in %s/html." % build_dir) 
开发者ID:flexxui,项目名称:flexx,代码行数:18,代码来源:docs.py

示例4: sphinx_build

# 需要导入模块: import sphinx [as 别名]
# 或者: from sphinx import build_main [as 别名]
def sphinx_build(src_dir, build_dir):
    import sphinx
    cmd = [ '-b', 'html',
            '-d', op.join(build_dir, 'doctrees'),
            src_dir,  # Source
            op.join(build_dir, 'html'),  # Dest
            ]
    
    if sphinx.version_info > (1, 7):
        import sphinx.cmd.build
        ret = sphinx.cmd.build.build_main(cmd)
    else:
        ret = sphinx.build_main(['sphinx-build'] + cmd)
    if ret != 0:
        raise RuntimeError('Sphinx error: %s' % ret)
    print("Build finished. The HTML pages are in %s/html." % build_dir) 
开发者ID:flexxui,项目名称:pscript,代码行数:18,代码来源:docs.py

示例5: call_sphinx

# 需要导入模块: import sphinx [as 别名]
# 或者: from sphinx import build_main [as 别名]
def call_sphinx(builder, workdir):
        import sphinx
        if options['--check']:
            extraopts = ['-W']
        else:
            extraopts = []
        if not options['--cache'] and files is None:
            extraopts.append('-E')
        docpath = os.path.join(throot, 'doc')
        inopt = [docpath, workdir]
        if files is not None:
            inopt.extend(files)
        ret = sphinx.build_main(['', '-b', builder] + extraopts + inopt)
        if ret != 0:
            sys.exit(ret) 
开发者ID:muhanzhang,项目名称:D-VAE,代码行数:17,代码来源:docgen.py

示例6: _build

# 需要导入模块: import sphinx [as 别名]
# 或者: from sphinx import build_main [as 别名]
def _build(argv, config, versions, current_name, is_root):
    """Build Sphinx docs via multiprocessing for isolation.

    :param tuple argv: Arguments to pass to Sphinx.
    :param sphinxcontrib.versioning.lib.Config config: Runtime configuration.
    :param sphinxcontrib.versioning.versions.Versions versions: Versions class instance.
    :param str current_name: The ref name of the current version being built.
    :param bool is_root: Is this build in the web root?
    """
    # Patch.
    application.Config = ConfigInject
    if config.show_banner:
        EventHandlers.BANNER_GREATEST_TAG = config.banner_greatest_tag
        EventHandlers.BANNER_MAIN_VERSION = config.banner_main_ref
        EventHandlers.BANNER_RECENT_TAG = config.banner_recent_tag
        EventHandlers.SHOW_BANNER = True
    EventHandlers.CURRENT_VERSION = current_name
    EventHandlers.IS_ROOT = is_root
    EventHandlers.VERSIONS = versions
    SC_VERSIONING_VERSIONS[:] = [p for r in versions.remotes for p in sorted(r.items()) if p[0] not in ('sha', 'date')]

    # Update argv.
    if config.verbose > 1:
        argv += ('-v',) * (config.verbose - 1)
    if config.no_colors:
        argv += ('-N',)
    if config.overflow:
        argv += config.overflow

    # Build.
    result = build_main(argv)
    if result != 0:
        raise SphinxError 
开发者ID:sphinx-contrib,项目名称:sphinxcontrib-versioning,代码行数:35,代码来源:sphinx_.py

示例7: sphinx_build

# 需要导入模块: import sphinx [as 别名]
# 或者: from sphinx import build_main [as 别名]
def sphinx_build(rst_directory):
    """
    Builds a sphinx project as html and latex.

    :param rst_directory:
    :return:
    """

    print('project directory {}'.format(rst_directory))

    # output directory and builder name
    build_directory = os.path.join(rst_directory, '_build')

    # delete files of old build
    if os.path.exists(build_directory):
        shutil.rmtree(build_directory)

    environment_file = os.path.join(rst_directory, 'environment.pickle')
    if os.path.exists(environment_file):
        os.remove(environment_file)

    for file_name in glob.glob(os.path.join(rst_directory, '*.doctree')):
        os.remove(file_name)

    # call to sphinx
    for builder_name in ('html', 'latex'):
        sphinx.build_main(argv=['', '-b', builder_name, rst_directory, os.path.join(build_directory, builder_name)]) 
开发者ID:Trilarion,项目名称:imperialism-remake,代码行数:29,代码来源:build_documentation.py

示例8: run

# 需要导入模块: import sphinx [as 别名]
# 或者: from sphinx import build_main [as 别名]
def run(self):
        input_dir = './docs/sphinx'
        build_doctree_dir = './build/doctrees'
        build_output_dir = './build/man'
        output_dir = DOC_MAN_PATH

        if os.path.exists(build_doctree_dir):
            shutil.rmtree(build_doctree_dir)
        if os.path.exists(build_output_dir):
            shutil.rmtree(build_output_dir)

        # sphinx doc generation
        sphinx.build_main(['sphinx-build',
                           '-c', input_dir,
                           '-b', 'man',
                           '-T',
                           '-d', build_doctree_dir,
                           # input dir
                           input_dir,
                           # output dir
                           build_output_dir])

        # copy to docs folder
        if os.path.exists(output_dir):
            shutil.rmtree(output_dir)
        shutil.copytree(build_output_dir, output_dir)

        # actual sdist
        sdist.run(self) 
开发者ID:masc3d,项目名称:btrfs-sxbackup,代码行数:31,代码来源:setup.py

示例9: call_sphinx

# 需要导入模块: import sphinx [as 别名]
# 或者: from sphinx import build_main [as 别名]
def call_sphinx(builder, build_setup, dest_dir):
    WritePluginList(join(build_setup.docsDir, "pluginlist.rst"))
    Prepare(build_setup.docsDir)
    sphinx.build_main(
        [
            None,
            "-D", "project=EventGhost",
            "-D", "copyright=2005-2017 EventGhost Project",
            # "-D", "templates_path=[]",
            '-q',    # be quiet
            # "-a",  # always write all output files
            # "-E",  # Don’t use a saved environment (the structure
                     # caching all cross-references),
            # "-N",  # Prevent colored output.
            # "-P",  # (Useful for debugging only.) Run the Python debugger,
                     # pdb, if an unhandled exception occurs while building.
            # '-v',  # verbosity, can be given up to three times
            # '-v',
            # write warnings and errors to file:
            # '-w', join('output', 'sphinx_log_chm.txt'),
            "-b", builder,
            "-D", "version=%s" % build_setup.appVersion,
            "-D", "release=%s" % build_setup.appVersion,
            "-d", join(build_setup.tmpDir, ".doctree"),
            build_setup.docsDir,
            dest_dir,
        ]
    ) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:30,代码来源:BuildDocs.py


注:本文中的sphinx.build_main方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。