Python sphinx.build_main() Examples
The following are 11
code examples of sphinx.build_main().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
sphinx
, or try the search function
.
Example #1
Source File: test_docs.py From resolwe with Apache License 2.0 | 6 votes |
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)
Example #2
Source File: build.py From travis-sphinx with GNU General Public License v3.0 | 6 votes |
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")
Example #3
Source File: docs.py From flexx with BSD 2-Clause "Simplified" License | 6 votes |
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)
Example #4
Source File: docs.py From pscript with BSD 2-Clause "Simplified" License | 6 votes |
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)
Example #5
Source File: docgen.py From D-VAE with MIT License | 5 votes |
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)
Example #6
Source File: sphinx_.py From sphinxcontrib-versioning with MIT License | 5 votes |
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
Example #7
Source File: build_documentation.py From imperialism-remake with GNU General Public License v3.0 | 5 votes |
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)])
Example #8
Source File: docgen.py From attention-lvcsr with MIT License | 5 votes |
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)
Example #9
Source File: docgen.py From LearningApacheSpark with MIT License | 5 votes |
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)
Example #10
Source File: setup.py From btrfs-sxbackup with GNU General Public License v2.0 | 5 votes |
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)
Example #11
Source File: BuildDocs.py From EventGhost with GNU General Public License v2.0 | 5 votes |
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, ] )