本文整理汇总了Python中mozbuild.frontend.reader.BuildReader.find_sphinx_variables方法的典型用法代码示例。如果您正苦于以下问题:Python BuildReader.find_sphinx_variables方法的具体用法?Python BuildReader.find_sphinx_variables怎么用?Python BuildReader.find_sphinx_variables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mozbuild.frontend.reader.BuildReader
的用法示例。
在下文中一共展示了BuildReader.find_sphinx_variables方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_docs
# 需要导入模块: from mozbuild.frontend.reader import BuildReader [as 别名]
# 或者: from mozbuild.frontend.reader.BuildReader import find_sphinx_variables [as 别名]
def build_docs(self, format=None, outdir=None):
self._activate_virtualenv()
self.virtualenv_manager.install_pip_package('mdn-sphinx-theme==0.4')
from moztreedocs import SphinxManager
if outdir == '<DEFAULT>':
outdir = os.path.join(self.topobjdir, 'docs')
manager = SphinxManager(self.topsrcdir, os.path.join(self.topsrcdir,
'tools', 'docs'), outdir)
# We don't care about GYP projects, so don't process them. This makes
# scanning faster and may even prevent an exception.
def remove_gyp_dirs(context):
context['GYP_DIRS'][:] = []
reader = BuildReader(self.config_environment,
sandbox_post_eval_cb=remove_gyp_dirs)
for path, name, key, value in reader.find_sphinx_variables():
reldir = os.path.dirname(path)
if name == 'SPHINX_TREES':
assert key
manager.add_tree(os.path.join(reldir, value),
os.path.join(reldir, key))
if name == 'SPHINX_PYTHON_PACKAGE_DIRS':
manager.add_python_package_dir(os.path.join(reldir, value))
return manager.generate_docs(format)
示例2: read_build_config
# 需要导入模块: from mozbuild.frontend.reader import BuildReader [as 别名]
# 或者: from mozbuild.frontend.reader.BuildReader import find_sphinx_variables [as 别名]
def read_build_config(self):
"""Read the active build config and add docs to this instance."""
# Reading the Sphinx variables doesn't require a full build context.
# Only define the parts we need.
class fakeconfig(object):
def __init__(self, topsrcdir):
self.topsrcdir = topsrcdir
config = fakeconfig(self._topsrcdir)
reader = BuildReader(config)
for path, name, key, value in reader.find_sphinx_variables():
reldir = os.path.dirname(path)
if name == 'SPHINX_TREES':
assert key
if key.startswith('/'):
key = key[1:]
else:
key = os.path.join(reldir, key)
self.add_tree(os.path.join(reldir, value), key)
if name == 'SPHINX_PYTHON_PACKAGE_DIRS':
self.add_python_package_dir(os.path.join(reldir, value))
示例3: build_docs
# 需要导入模块: from mozbuild.frontend.reader import BuildReader [as 别名]
# 或者: from mozbuild.frontend.reader.BuildReader import find_sphinx_variables [as 别名]
def build_docs(self, format=None, outdir=None):
self._activate_virtualenv()
self.virtualenv_manager.install_pip_package('sphinx_rtd_theme==0.1.6')
from moztreedocs import SphinxManager
if outdir == '<DEFAULT>':
outdir = os.path.join(self.topobjdir, 'docs')
manager = SphinxManager(self.topsrcdir, os.path.join(self.topsrcdir,
'tools', 'docs'), outdir)
# We don't care about GYP projects, so don't process them. This makes
# scanning faster and may even prevent an exception.
def remove_gyp_dirs(context):
context['GYP_DIRS'][:] = []
# Reading the Sphinx variables doesn't require a full build context.
# Only define the parts we need.
class fakeconfig(object):
def __init__(self, topsrcdir):
self.topsrcdir = topsrcdir
config = fakeconfig(self.topsrcdir)
reader = BuildReader(config)
for path, name, key, value in reader.find_sphinx_variables():
reldir = os.path.dirname(path)
if name == 'SPHINX_TREES':
assert key
manager.add_tree(os.path.join(reldir, value),
os.path.join(reldir, key))
if name == 'SPHINX_PYTHON_PACKAGE_DIRS':
manager.add_python_package_dir(os.path.join(reldir, value))
return manager.generate_docs(format)