• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python apidoc.main函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sphinx.apidoc.main函数的典型用法代码示例。如果您正苦于以下问题:Python main函数的具体用法?Python main怎么用?Python main使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: _generate_api_docs

 def _generate_api_docs(self):
     package_source_dir = os.path.join(PACKAGE_TOPDIR, self.distribution.package_dir[''], 'taucmdr')
     sphinx_apidoc.main(['-M', # Put module documentation before submodule documentation
                         '-P', # Include "_private" modules
                         '-f', # Overwrite existing files
                         '-e', # Put documentation for each module on its own page
                         '-o', self.source_dir, package_source_dir])
开发者ID:ParaToolsInc,项目名称:taucmdr,代码行数:7,代码来源:setup.py


示例2: test_pep_0420_disabled_top_level_verify

def test_pep_0420_disabled_top_level_verify(tempdir):
    codedir = rootdir / 'root' / 'pep_0420' / 'a' / 'b'
    outdir = tempdir / 'out'
    args = ['sphinx-apidoc', '-o', outdir, '-F', codedir]
    apidoc.main(args)

    assert (outdir / 'conf.py').isfile()
    assert (outdir / 'c.rst').isfile()
    assert not (outdir / 'x.rst').exists()

    with open(outdir / 'c.rst') as f:
        rst = f.read()
        assert "c package\n" in rst
        assert "automodule:: c.d\n" in rst
        assert "automodule:: c\n" in rst

    @with_app('text', srcdir=outdir)
    def assert_build(app, status, warning):
        app.build()
        print(status.getvalue())
        print(warning.getvalue())

    sys.path.append(codedir)
    try:
        assert_build()
    finally:
        sys.path.remove(codedir)
开发者ID:Felix-neko,项目名称:sphinx,代码行数:27,代码来源:test_apidoc.py


示例3: test_pep_0420_enabled

def test_pep_0420_enabled(tempdir):
    codedir = rootdir / 'root' / 'pep_0420'
    outdir = tempdir / 'out'
    args = ['sphinx-apidoc', '-o', outdir, '-F', codedir, "--implicit-namespaces"]
    apidoc.main(args)

    assert (outdir / 'conf.py').isfile()
    assert (outdir / 'a.b.c.rst').isfile()
    assert (outdir / 'a.b.x.rst').isfile()

    with open(outdir / 'a.b.c.rst') as f:
        rst = f.read()
        assert "a.b.c package\n" in rst
        assert "automodule:: a.b.c.d\n" in rst
        assert "automodule:: a.b.c\n" in rst

    with open(outdir / 'a.b.x.rst') as f:
        rst = f.read()
        assert "a.b.x namespace\n" in rst
        assert "automodule:: a.b.x.y\n" in rst
        assert "automodule:: a.b.x\n" not in rst

    @with_app('text', srcdir=outdir)
    def assert_build(app, status, warning):
        app.build()
        print(status.getvalue())
        print(warning.getvalue())

    sys.path.append(codedir)
    try:
        assert_build()
    finally:
        sys.path.remove(codedir)
开发者ID:Felix-neko,项目名称:sphinx,代码行数:33,代码来源:test_apidoc.py


示例4: run_apidoc

def run_apidoc(_):
    chdir(cur_dir)  # use same dir as readthedocs, which is docs/source
    from sphinx.apidoc import main
    output_path = join(cur_dir, 'api')
    # here use paths relative to docs/source
    main(['', '-f', '-e', '--module-first', '-o', output_path, '../../phypno',
          '../../phypno/viz'])
开发者ID:gpiantoni,项目名称:phypno,代码行数:7,代码来源:conf.py


示例5: apidoc

def apidoc(options):
    if not has_sphinx:
        raise BuildFailure('Install sphinx to build html docs')

    outputdir = options.get('apidoc_outputdir', '')
    if not outputdir:
        docroot = options.get('docroot', 'docs')
        if not os.path.exists(docroot):
            raise BuildFailure('Doc root dir (%s) does not exist' % docroot)
        outputdir = os.path.join(docroot, options.get('sourcedir', ''))
    if not os.path.exists(outputdir):
        raise BuildFailure('Doc source dir (%s) does not exist' % outputdir)

    moduledir = options.get('apidoc_moduledir', '.')
    if not os.path.exists(moduledir):
        raise BuildFailure('Module dir (%s) does not exist' % moduledir)

    excludes = options.get('apidoc_excludes', [])
    if isinstance(excludes, basestring):
        excludes = [excludes]

    if options.get('apidoc_overwrite', True):
        args = ['sphinx-apidoc', '-f']
    else:
        args = ['sphinx-apidoc']

    from sphinx.apidoc import main
    args.extend(['-o', outputdir, moduledir] + excludes)
    print(' '.join(args))
    main(args)
开发者ID:alberthdev,项目名称:pyradmon,代码行数:30,代码来源:pavertasks.py


示例6: run_apidoc

def run_apidoc(app):
    this_dir = os.path.dirname(__file__)
    parser = ConfigParser()
    parser.read(os.path.join(this_dir, '..', 'setup.cfg'))
    packages = parser.get('sphinx-apidocs', 'packages').strip().split('\n')
    for package in packages:
        apidoc.main(argv=['sphinx-apidoc', '-f', '-o', os.path.join(this_dir, 'source'), os.path.join(this_dir, '..', package)])
开发者ID:KarrLab,项目名称:gdoc2text,代码行数:7,代码来源:conf.py


示例7: run_apidoc

def run_apidoc(*args):
    from sphinx.apidoc import main

    cur_dir = os.path.abspath(os.path.dirname(__file__))
    output_path = os.path.join(cur_dir, 'api')
    module_path = os.path.join(cur_dir, '../../icinga2client')

    main(['-T', '-e', '-o', output_path, module_path])
开发者ID:lewiseason,项目名称:icinga2client,代码行数:8,代码来源:conf.py


示例8: run

 def run(self):
     output_dir = os.path.join(__location__, "docs/_rst")
     module_dir = os.path.join(__location__, MAIN_PACKAGE)
     cmd_line_template = "sphinx-apidoc -f -o {outputdir} {moduledir}"
     cmd_line = cmd_line_template.format(outputdir=output_dir,
                                         moduledir=module_dir)
     apidoc.main(cmd_line.split(" "))
     BuildDoc.run(self)
开发者ID:takesxi-shimada,项目名称:pyscaffold,代码行数:8,代码来源:setup.py


示例9: run_apidoc

def run_apidoc(_):
    from sphinx.apidoc import main
    parent_folder = os.path.join(os.path.dirname(__file__), '..')
    cur_dir = os.path.abspath(os.path.dirname(__file__))
    sys.path.append(parent_folder)

    module = os.path.join(parent_folder, 'askomics')
    output_path = os.path.join(cur_dir, 'api')
    main(['-e', '-f', '-o', output_path, module])
开发者ID:askomics,项目名称:askomics,代码行数:9,代码来源:conf.py


示例10: run_apidoc

def run_apidoc(_):
    """Heler function for run apidoc as part of the build."""
    current_directory = os.path.abspath(os.path.dirname(__file__))
    output_path = os.path.join(current_directory, 'source')
    cmd_path = 'sphinx-apidoc'
    if hasattr(sys, 'real_prefix'):  # Check to see if we are in a virtualenv
        # If we are, assemble the path manually
        cmd_path = os.path.abspath(os.path.join(sys.prefix, 'bin', 'sphinx-apidoc'))
    main([cmd_path, '-e', '-o', output_path, '../cinder_data', '--force'])
开发者ID:almcc,项目名称:cinder-data,代码行数:9,代码来源:conf.py


示例11: run_apidoc

def run_apidoc(_):

    cur_dir = os.path.abspath(os.path.dirname(__file__))
    print(cur_dir)
    module = os.path.abspath(os.path.join(cur_dir, "..", "udapi"))
    print(module)

    from sphinx.apidoc import main
    main(['--separate', '-o', cur_dir, module, '--force'])
开发者ID:udapi,项目名称:udapi-python,代码行数:9,代码来源:conf.py


示例12: run_apidoc

def run_apidoc(_):
    from sphinx.apidoc import main
    import os
    import sys

    sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
    cur_dir = os.path.abspath(os.path.dirname(__file__))
    module = os.path.join(cur_dir, "..", "cumulusci")
    main(["-E", "-P", "-o", os.path.join(cur_dir, "api"), module, "--force"])
开发者ID:SalesforceFoundation,项目名称:CumulusCI,代码行数:9,代码来源:conf.py


示例13: run_apidoc

def run_apidoc(_):
    modules = ['caar']
    for module in modules:
        cur_dir = os.path.abspath(os.path.dirname(__file__))
        output_path = os.path.join(cur_dir, 'docs')
        cmd_path = 'sphinx-apidoc'
        if hasattr(sys, 'real_prefix'):  # Check to see if we are in a virtualenv
            # If we are, assemble the path manually
            cmd_path = os.path.abspath(os.path.join(sys.prefix, 'bin', 'sphinx-apidoc'))
        main(['-e', '-o', output_path, module, '--force'])
开发者ID:nickpowersys,项目名称:CaaR,代码行数:10,代码来源:conf.py


示例14: run_apidoc

def run_apidoc(app):
    global run_already
    if run_already:
        return
    run_already = True

    package_dir = path.abspath(path.join(app.srcdir, '..', '..', 'keystone'))
    source_dir = path.join(app.srcdir, 'api')
    apidoc.main(['apidoc', package_dir, '-f',
                 '-H', 'Keystone Modules',
                 '-o', source_dir])
开发者ID:anilkrishnan,项目名称:keystone,代码行数:11,代码来源:apidoc.py


示例15: run

    def run (self):
        import sphinx
        from sphinx import apidoc
        
        sphinx_args = ['-P', '-n', '-c', 'documentation/', '.']
        apidoc_args = []
        
        if self.cathartic:
            sphinx_args = ['-a', '-E'] + sphinx_args
            apidoc_args = ['--force'] + apidoc_args
            
        apidoc.main(['sphinx-apidoc', '--output-dir=fipy/generated', '--suffix=rst'] 
                    + apidoc_args + ['fipy'])
        apidoc.main(['sphinx-apidoc', '--output-dir=documentation/tutorial/package/generated', '--suffix=rst'] 
                    + apidoc_args + ['documentation/tutorial/package'])

        if self.html:
            sphinx.main(['sphinx-build', '-b', 'redirecting_html'] + sphinx_args + ['documentation/_build/html/'])

        if self.pdf:
            try:
                sphinx.main(['sphinx-build', '-b', 'latex'] + sphinx_args + ['documentation/_build/latex/'])
            except SystemExit:
                pass
            
            outdir = os.path.join('documentation', '_build', 'latex')
            
            from docutils.core import publish_file

            for xtra in ("LICENSE", "DISCLAIMER"):
                publish_file(source_path="%s.rst" % xtra,
                             destination_path=os.path.join(outdir, "%s.tex" % xtra),
                             reader_name='standalone',
                             parser_name='restructuredtext',
                             writer_name='latex',
                             settings_overrides= {
                                 'template': 'documentation/_templates/empty.tex'
                             })

            savedir = os.getcwd()
            
            os.chdir(outdir)
                
            os.system("pdflatex fipy")
            os.system("pdflatex fipy")
            os.system("pdflatex fipy")
            os.system("makeindex -s python.ist fipy")
            os.system("makeindex -s python.ist modfipy")
            os.system("pdflatex fipy")
            os.system("pdflatex fipy")
                
            os.chdir(savedir)
开发者ID:Rhys314,项目名称:fipy,代码行数:52,代码来源:setup.py


示例16: sphinx_api_build

def sphinx_api_build(source_directory, out_directory):
    """

    :param source_directory:
    :param out_directory:
    :return:
    """

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

    apidoc.main(argv=['', '-o', out_directory, source_directory])
开发者ID:Trilarion,项目名称:imperialism-remake,代码行数:13,代码来源:build_documentation.py


示例17: run

    def run(self):
        import sphinx
        from sphinx import apidoc

        sphinx_args = ["-P", "-n", "-c", "documentation/", "."]
        apidoc_args = []

        if self.cathartic:
            sphinx_args = ["-a", "-E"] + sphinx_args
            apidoc_args = ["--force"] + apidoc_args

        apidoc.main(["sphinx-apidoc", "--output-dir=fipy/generated", "--suffix=txt"] + apidoc_args + ["fipy"])
        apidoc.main(
            ["sphinx-apidoc", "--output-dir=documentation/tutorial/package/generated", "--suffix=txt"]
            + apidoc_args
            + ["documentation/tutorial/package"]
        )

        if self.html:
            sphinx.main(["sphinx-build", "-b", "redirecting_html"] + sphinx_args + ["documentation/_build/html/"])

        if self.pdf:
            sphinx.main(["sphinx-build", "-b", "latex"] + sphinx_args + ["documentation/_build/latex/"])

            outdir = os.path.join("documentation", "_build", "latex")

            from docutils.core import publish_file

            for xtra in ("LICENSE", "DISCLAIMER"):
                publish_file(
                    source_path="%s.txt" % xtra,
                    destination_path=os.path.join(outdir, "%s.tex" % xtra),
                    reader_name="standalone",
                    parser_name="restructuredtext",
                    writer_name="latex",
                    settings_overrides={"template": "documentation/_templates/empty.tex"},
                )

            savedir = os.getcwd()

            os.chdir(outdir)

            os.system("pdflatex fipy")
            os.system("pdflatex fipy")
            os.system("pdflatex fipy")
            os.system("makeindex -s python.ist fipy")
            os.system("makeindex -s python.ist modfipy")
            os.system("pdflatex fipy")
            os.system("pdflatex fipy")

            os.chdir(savedir)
开发者ID:Teslos,项目名称:fipy,代码行数:51,代码来源:setup.py


示例18: run

 def run(self):
     # metadata contains information supplied in setup()
     metadata = self.distribution.metadata
     src_dir = os.path.join(os.getcwd(),  'genomics')
     # Run sphinx by calling the main method, '--full' also adds a conf.py
     from sphinx import apidoc
     apidoc.main(
         ['', '-f', '-H', 'Python Genomics', '-A', metadata.author,
          '-V', metadata.version, '-R', metadata.version,
          '-o', os.path.join('doc', 'api'), src_dir])
     # build the doc sources
     os.chdir('doc')
     os.system('make html')
     os.chdir('..')
开发者ID:dalloliogm,项目名称:pygenomics,代码行数:14,代码来源:setup.py


示例19: run_apidoc

def run_apidoc(_):
    modules = ['ufl']

    # Get location of Sphinx files
    sphinx_source_dir = os.path.abspath(os.path.dirname(__file__))
    repo_dir = os.path.abspath(os.path.join(sphinx_source_dir, os.path.pardir,
                                            os.path.pardir, os.path.pardir))
    apidoc_dir = os.path.join(sphinx_source_dir, "api-doc")

    from sphinx.apidoc import main
    for module in modules:
        # Generate .rst files ready for autodoc
        module_dir = os.path.join(repo_dir, module)
        main(["-f", "-d", "1", "-o", apidoc_dir, module_dir])
开发者ID:FEniCS,项目名称:ufl,代码行数:14,代码来源:conf.py


示例20: run

 def run(self):
   metadata = self.distribution.metadata
   from sphinx.apidoc import main
   """Run command."""
   sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
   exit = main(['sphinx-apidoc', '-F', '-H', metadata.name, '-A', metadata.author, '-V', metadata.version, '-o', './docs', './app'])
   self.run_command('build_sphinx')
开发者ID:kaakaa,项目名称:ticketor,代码行数:7,代码来源:build_apidoc.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python application.Sphinx类代码示例发布时间:2022-05-27
下一篇:
Python addnodes.versionmodified函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap