本文整理汇总了Python中mozbuild.frontend.reader.BuildReader类的典型用法代码示例。如果您正苦于以下问题:Python BuildReader类的具体用法?Python BuildReader怎么用?Python BuildReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BuildReader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: read_build_config
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))
开发者ID:luke-chang,项目名称:gecko-1,代码行数:25,代码来源:__init__.py
示例2: find_paths_and_tags
def find_paths_and_tags(self, verbose):
paths, tags = set(), set()
changed_files = self.find_changed_files()
if changed_files:
if verbose:
print("Pushing tests based on modifications to the "
"following files:\n\t%s" % "\n\t".join(changed_files))
from mozbuild.frontend.reader import (
BuildReader,
EmptyConfig,
)
config = EmptyConfig(self.topsrcdir)
reader = BuildReader(config)
files_info = reader.files_info(changed_files)
for path, info in files_info.items():
paths |= info.test_files
tags |= info.test_tags
if verbose:
if paths:
print("Pushing tests based on the following patterns:\n\t%s" %
"\n\t".join(paths))
if tags:
print("Pushing tests based on the following tags:\n\t%s" %
"\n\t".join(tags))
return paths, tags
开发者ID:linclark,项目名称:gecko-dev,代码行数:29,代码来源:autotry.py
示例3: build_docs
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)
开发者ID:alex-tifrea,项目名称:gecko-dev,代码行数:32,代码来源:mach_commands.py
示例4: build_docs
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 context in reader.walk_topsrcdir():
for dest_dir, source_dir in context['SPHINX_TREES'].items():
manager.add_tree(os.path.join(context.relsrcdir,
source_dir), dest_dir)
for entry in context['SPHINX_PYTHON_PACKAGE_DIRS']:
manager.add_python_package_dir(os.path.join(context.relsrcdir,
entry))
return manager.generate_docs(format)
开发者ID:L2-D2,项目名称:gecko-dev,代码行数:30,代码来源:mach_commands.py
示例5: _emit
def _emit(self, name, env=None):
if not env:
env = self._get_environment(name)
reader = BuildReader(env)
emitter = TreeMetadataEmitter(env)
return env, emitter.emit(reader.read_topsrcdir())
开发者ID:Nebelhom,项目名称:mozilla-central,代码行数:8,代码来源:common.py
示例6: file_info_schedules
def file_info_schedules(self, paths):
"""Show what is scheduled by the given files.
Given a requested set of files (which can be specified using
wildcards), print the total set of scheduled components.
"""
from mozbuild.frontend.reader import EmptyConfig, BuildReader
config = EmptyConfig(TOPSRCDIR)
reader = BuildReader(config)
schedules = set()
for p, m in reader.files_info(paths).items():
schedules |= set(m['SCHEDULES'].components)
print(", ".join(schedules))
开发者ID:luke-chang,项目名称:gecko-1,代码行数:14,代码来源:mach_commands.py
示例7: test_filesystem_traversal_reading
def test_filesystem_traversal_reading(self):
"""Reading moz.build according to filesystem traversal works.
We attempt to read every known moz.build file via filesystem traversal.
If this test fails, it means that metadata extraction will fail.
"""
mb = MozbuildObject.from_environment(detect_virtualenv_mozinfo=False)
config = mb.config_environment
reader = BuildReader(config)
all_paths = self._mozbuilds(reader)
paths, contexts = reader.read_relevant_mozbuilds(all_paths)
self.assertEqual(set(paths), all_paths)
self.assertGreaterEqual(len(contexts), len(paths))
开发者ID:70599,项目名称:Waterfox,代码行数:14,代码来源:test_mozbuild_reading.py
示例8: test_filesystem_traversal_no_config
def test_filesystem_traversal_no_config(self):
"""Reading moz.build files via filesystem traversal mode with no build config.
This is similar to the above test except no build config is applied.
This will likely fail in more scenarios than the above test because a
lot of moz.build files assumes certain variables are present.
"""
here = os.path.abspath(os.path.dirname(__file__))
root = os.path.normpath(os.path.join(here, '..', '..'))
config = EmptyConfig(root)
reader = BuildReader(config)
all_paths = self._mozbuilds(reader)
paths, contexts = reader.read_relevant_mozbuilds(all_paths)
self.assertEqual(set(paths.keys()), all_paths)
self.assertGreaterEqual(len(contexts), len(paths))
开发者ID:70599,项目名称:Waterfox,代码行数:15,代码来源:test_mozbuild_reading.py
示例9: gen_test_backend
def gen_test_backend():
build_obj = MozbuildObject.from_environment()
try:
config = build_obj.config_environment
except BuildEnvironmentNotFoundException:
print("No build detected, test metadata may be incomplete.")
config = EmptyConfig(build_obj.topsrcdir)
config.topobjdir = build_obj.topobjdir
reader = BuildReader(config)
emitter = TreeMetadataEmitter(config)
backend = TestManifestBackend(config)
context = reader.read_topsrcdir()
data = emitter.emit(context, emitfn=emitter._process_test_manifests)
backend.consume(data)
开发者ID:jhector,项目名称:gecko-dev,代码行数:16,代码来源:gen_test_backend.py
示例10: test_mtime_no_change
def test_mtime_no_change(self):
"""Ensure mtime is not updated if file content does not change."""
env = self._consume('stub0', RecursiveMakeBackend)
makefile_path = mozpath.join(env.topobjdir, 'Makefile')
backend_path = mozpath.join(env.topobjdir, 'backend.mk')
makefile_mtime = os.path.getmtime(makefile_path)
backend_mtime = os.path.getmtime(backend_path)
reader = BuildReader(env)
emitter = TreeMetadataEmitter(env)
backend = RecursiveMakeBackend(env)
backend.consume(emitter.emit(reader.read_topsrcdir()))
self.assertEqual(os.path.getmtime(makefile_path), makefile_mtime)
self.assertEqual(os.path.getmtime(backend_path), backend_mtime)
开发者ID:html-shell,项目名称:mozbuild,代码行数:17,代码来源:test_recursivemake.py
示例11: get_outgoing_metadata
def get_outgoing_metadata(self):
paths, tags, flavors = set(), set(), set()
changed_files = self.vcs.get_outgoing_files('AM')
if changed_files:
config = EmptyConfig(self.topsrcdir)
reader = BuildReader(config)
files_info = reader.files_info(changed_files)
for path, info in files_info.items():
paths |= info.test_files
tags |= info.test_tags
flavors |= info.test_flavors
return {
'paths': paths,
'tags': tags,
'flavors': flavors,
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:18,代码来源:resolve.py
示例12: do_test_backend
def do_test_backend(self, *backends, **kwargs):
topobjdir = mkdtemp()
try:
config = ConfigEnvironment(buildconfig.topsrcdir, topobjdir,
**kwargs)
reader = BuildReader(config)
emitter = TreeMetadataEmitter(config)
moz_build = mozpath.join(config.topsrcdir, 'test.mozbuild')
definitions = list(emitter.emit(
reader.read_mozbuild(moz_build, config)))
for backend in backends:
backend(config).consume(definitions)
yield config
except:
raise
finally:
if not os.environ.get('MOZ_NO_CLEANUP'):
shutil.rmtree(topobjdir)
开发者ID:MekliCZ,项目名称:positron,代码行数:19,代码来源:test_build.py
示例13: test_orphan_file_patterns
def test_orphan_file_patterns(self):
if sys.platform == 'win32':
raise unittest.SkipTest('failing on windows builds')
mb = MozbuildObject.from_environment(detect_virtualenv_mozinfo=False)
try:
config = mb.config_environment
except Exception as e:
if e.message == 'config.status not available. Run configure.':
raise unittest.SkipTest('failing without config.status')
raise
if config.substs['MOZ_BUILD_APP'] == 'js':
raise unittest.SkipTest('failing in Spidermonkey builds')
reader = BuildReader(config)
all_paths = self._mozbuilds(reader)
_, contexts = reader.read_relevant_mozbuilds(all_paths)
finder = FileFinder(config.topsrcdir, find_executables=False,
ignore=['obj*'])
def pattern_exists(pat):
return [p for p in finder.find(pat)] != []
for ctx in contexts:
if not isinstance(ctx, Files):
continue
relsrcdir = ctx.relsrcdir
if not pattern_exists(os.path.join(relsrcdir, ctx.pattern)):
self.fail("The pattern '%s' in a Files() entry in "
"'%s' corresponds to no files in the tree.\n"
"Please update this entry." %
(ctx.pattern, ctx.main_path))
test_files = ctx['IMPACTED_TESTS'].files
for p in test_files:
if not pattern_exists(os.path.relpath(p.full_path, config.topsrcdir)):
self.fail("The pattern '%s' in a dependent tests entry "
"in '%s' corresponds to no files in the tree.\n"
"Please update this entry." %
(p, ctx.main_path))
开发者ID:InternalError503,项目名称:cyberfox,代码行数:42,代码来源:test_mozbuild_reading.py
示例14: build_docs
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)
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:38,代码来源:mach_commands.py
示例15: gen_test_backend
def gen_test_backend():
build_obj = MozbuildObject.from_environment()
try:
config = build_obj.config_environment
except BuildEnvironmentNotFoundException:
print("No build detected, test metadata may be incomplete.")
# If 'JS_STANDALONE' is set, tests that don't require an objdir won't
# be picked up due to bug 1345209.
substs = EmptyConfig.default_substs
if 'JS_STANDALONE' in substs:
del substs['JS_STANDALONE']
config = EmptyConfig(build_obj.topsrcdir, substs)
config.topobjdir = build_obj.topobjdir
reader = BuildReader(config)
emitter = TreeMetadataEmitter(config)
backend = TestManifestBackend(config)
context = reader.read_topsrcdir()
data = emitter.emit(context, emitfn=emitter._process_test_manifests)
backend.consume(data)
开发者ID:MrAlex94,项目名称:Waterfox,代码行数:23,代码来源:gen_test_backend.py
示例16: config_status
def config_status(topobjdir='.', topsrcdir='.', defines=None,
non_global_defines=None, substs=None, source=None,
mozconfig=None):
'''Main function, providing config.status functionality.
Contrary to config.status, it doesn't use CONFIG_FILES or CONFIG_HEADERS
variables.
Without the -n option, this program acts as config.status and considers
the current directory as the top object directory, even when config.status
is in a different directory. It will, however, treat the directory
containing config.status as the top object directory with the -n option.
The options to this function are passed when creating the
ConfigEnvironment. These lists, as well as the actual wrapper script
around this function, are meant to be generated by configure.
See build/autoconf/config.status.m4.
'''
if 'CONFIG_FILES' in os.environ:
raise Exception('Using the CONFIG_FILES environment variable is not '
'supported.')
if 'CONFIG_HEADERS' in os.environ:
raise Exception('Using the CONFIG_HEADERS environment variable is not '
'supported.')
if not os.path.isabs(topsrcdir):
raise Exception('topsrcdir must be defined as an absolute directory: '
'%s' % topsrcdir)
default_backends = ['RecursiveMake']
default_backends = (substs or {}).get('BUILD_BACKENDS', ['RecursiveMake'])
parser = ArgumentParser()
parser.add_argument('-v', '--verbose', dest='verbose', action='store_true',
help='display verbose output')
parser.add_argument('-n', dest='not_topobjdir', action='store_true',
help='do not consider current directory as top object directory')
parser.add_argument('-d', '--diff', action='store_true',
help='print diffs of changed files.')
parser.add_argument('-b', '--backend', nargs='+', choices=sorted(backends),
default=default_backends,
help='what backend to build (default: %s).' %
' '.join(default_backends))
parser.add_argument('--dry-run', action='store_true',
help='do everything except writing files out.')
options = parser.parse_args()
# Without -n, the current directory is meant to be the top object directory
if not options.not_topobjdir:
topobjdir = os.path.abspath('.')
env = ConfigEnvironment(topsrcdir, topobjdir, defines=defines,
non_global_defines=non_global_defines, substs=substs,
source=source, mozconfig=mozconfig)
# mozinfo.json only needs written if configure changes and configure always
# passes this environment variable.
if 'WRITE_MOZINFO' in os.environ:
write_mozinfo(os.path.join(topobjdir, 'mozinfo.json'), env, os.environ)
cpu_start = time.clock()
time_start = time.time()
# Make appropriate backend instances, defaulting to RecursiveMakeBackend,
# or what is in BUILD_BACKENDS.
selected_backends = [get_backend_class(b)(env) for b in options.backend]
if options.dry_run:
for b in selected_backends:
b.dry_run = True
reader = BuildReader(env)
emitter = TreeMetadataEmitter(env)
# This won't actually do anything because of the magic of generators.
definitions = emitter.emit(reader.read_topsrcdir())
log_level = logging.DEBUG if options.verbose else logging.INFO
log_manager.add_terminal_logging(level=log_level)
log_manager.enable_unstructured()
print('Reticulating splines...', file=sys.stderr)
if len(selected_backends) > 1:
definitions = list(definitions)
for the_backend in selected_backends:
the_backend.consume(definitions)
execution_time = 0.0
for obj in chain((reader, emitter), selected_backends):
summary = obj.summary()
print(summary, file=sys.stderr)
execution_time += summary.execution_time
cpu_time = time.clock() - cpu_start
wall_time = time.time() - time_start
efficiency = cpu_time / wall_time if wall_time else 100
untracked = wall_time - execution_time
print(
#.........这里部分代码省略.........
开发者ID:brendandahl,项目名称:positron,代码行数:101,代码来源:config_status.py
示例17: config_status
#.........这里部分代码省略.........
# Without -n, the current directory is meant to be the top object directory
if not options.not_topobjdir:
topobjdir = os.path.abspath('.')
env = ConfigEnvironment(topsrcdir, topobjdir, defines=defines,
non_global_defines=non_global_defines, substs=substs, source=source)
# mozinfo.json only needs written if configure changes and configure always
# passes this environment variable.
if 'WRITE_MOZINFO' in os.environ:
write_mozinfo(os.path.join(topobjdir, 'mozinfo.json'), env, os.environ)
# Make an appropriate backend instance, defaulting to RecursiveMakeBackend.
backends_cls = []
for backend in options.backend:
if backend == 'AndroidEclipse':
from mozbuild.backend.android_eclipse import AndroidEclipseBackend
if not MachCommandConditions.is_android(env):
raise Exception('The Android Eclipse backend is not available with this configuration.')
backends_cls.append(AndroidEclipseBackend)
elif backend == 'CppEclipse':
from mozbuild.backend.cpp_eclipse import CppEclipseBackend
backends_cls.append(CppEclipseBackend)
if os.name == 'nt':
raise Exception('Eclipse is not supported on Windows. Consider using Visual Studio instead.')
elif backend == 'VisualStudio':
from mozbuild.backend.visualstudio import VisualStudioBackend
backends_cls.append(VisualStudioBackend)
elif backend == 'FasterMake':
from mozbuild.backend.fastermake import FasterMakeBackend
backends_cls.append(FasterMakeBackend)
elif backend == 'CompileDB':
from mozbuild.compilation.database import CompileDBBackend
backends_cls.append(CompileDBBackend)
else:
backends_cls.append(RecursiveMakeBackend)
cpu_start = time.clock()
time_start = time.time()
backends = [cls(env) for cls in backends_cls]
reader = BuildReader(env)
emitter = TreeMetadataEmitter(env)
# This won't actually do anything because of the magic of generators.
definitions = emitter.emit(reader.read_topsrcdir())
if options.recheck:
# Execute configure from the top object directory
os.chdir(topobjdir)
os.execlp('sh', 'sh', '-c', ' '.join([os.path.join(topsrcdir, 'configure'), env.substs['ac_configure_args'], '--no-create', '--no-recursion']))
log_level = logging.DEBUG if options.verbose else logging.INFO
log_manager.add_terminal_logging(level=log_level)
log_manager.enable_unstructured()
print('Reticulating splines...', file=sys.stderr)
if len(backends) > 1:
definitions = list(definitions)
for the_backend in backends:
the_backend.consume(definitions)
execution_time = 0.0
for obj in chain((reader, emitter), backends):
summary = obj.summary()
print(summary, file=sys.stderr)
execution_time += summary.execution_time
cpu_time = time.clock() - cpu_start
wall_time = time.time() - time_start
efficiency = cpu_time / wall_time if wall_time else 100
untracked = wall_time - execution_time
print(
'Total wall time: {:.2f}s; CPU time: {:.2f}s; Efficiency: '
'{:.0%}; Untracked: {:.2f}s'.format(
wall_time, cpu_time, efficiency, untracked),
file=sys.stderr
)
if options.diff:
for the_backend in backends:
for path, diff in sorted(the_backend.file_diffs.items()):
print('\n'.join(diff))
# Advertise Visual Studio if appropriate.
if os.name == 'nt' and 'VisualStudio' not in options.backend:
print(VISUAL_STUDIO_ADVERTISEMENT)
# Advertise Eclipse if it is appropriate.
if MachCommandConditions.is_android(env):
if 'AndroidEclipse' not in options.backend:
print(ANDROID_IDE_ADVERTISEMENT)
if env.substs.get('MOZ_ARTIFACT_BUILDS', False):
# Execute |mach artifact install| from the top source directory.
os.chdir(topsrcdir)
return subprocess.check_call([sys.executable, os.path.join(topsrcdir, 'mach'), 'artifact', 'install'])
开发者ID:kilikkuo,项目名称:gecko-dev,代码行数:101,代码来源:config_status.py
示例18: config_status
def config_status(topobjdir = '.', topsrcdir = '.',
defines = [], non_global_defines = [], substs = [],
files = [], headers = []):
'''Main function, providing config.status functionality.
Contrary to config.status, it doesn't use CONFIG_FILES or CONFIG_HEADERS
variables, but like config.status from autoconf 2.6, single files may be
generated with the --file and --header options. Several such options can
be given to generate several files at the same time.
Without the -n option, this program acts as config.status and considers
the current directory as the top object directory, even when config.status
is in a different directory. It will, however, treat the directory
containing config.status as the top object directory with the -n option,
while files given to the --file and --header arguments are considered
relative to the current directory.
The --recheck option, like with the original config.status, runs configure
again, with the options given in the "ac_configure_args" subst.
The options to this function are passed when creating the
ConfigEnvironment, except for files and headers, which contain the list
of files and headers to be generated by default. These lists, as well as
the actual wrapper script around this function, are meant to be generated
by configure. See build/autoconf/config.status.m4.
Unlike config.status behaviour with CONFIG_FILES and CONFIG_HEADERS,
but like config.status behaviour with --file and --header, providing
files or headers on the command line inhibits the default generation of
files when given headers and headers when given files.
Unlike config.status, the FILE:TEMPLATE syntax is not supported for
files and headers. The template is always the filename suffixed with
'.in', in the corresponding directory under the top source directory.
'''
if 'CONFIG_FILES' in os.environ:
raise Exception, 'Using the CONFIG_FILES environment variable is not supported. Use --file instead.'
if 'CONFIG_HEADERS' in os.environ:
raise Exception, 'Using the CONFIG_HEADERS environment variable is not supported. Use --header instead.'
parser = OptionParser()
parser.add_option('--recheck', dest='recheck', action='store_true',
help='update config.status by reconfiguring in the same conditions')
parser.add_option('--file', dest='files', metavar='FILE', action='append',
help='instantiate the configuration file FILE')
parser.add_option('--header', dest='headers', metavar='FILE', action='append',
help='instantiate the configuration header FILE')
parser.add_option('-v', '--verbose', dest='verbose', action='store_true',
help='display verbose output')
parser.add_option('-n', dest='not_topobjdir', action='store_true',
help='do not consider current directory as top object directory')
(options, args) = parser.parse_args()
# Without -n, the current directory is meant to be the top object directory
if not options.not_topobjdir:
topobjdir = '.'
env = ConfigEnvironment(topsrcdir, topobjdir, defines=defines,
non_global_defines=non_global_defines, substs=substs)
reader = BuildReader(env)
emitter = TreeMetadataEmitter(env)
backend = RecursiveMakeBackend(env)
# This won't actually do anything because of the magic of generators.
definitions = emitter.emit(reader.read_topsrcdir())
if options.recheck:
# Execute configure from the top object directory
if not os.path.isabs(topsrcdir):
topsrcdir = relpath(topsrcdir, topobjdir)
os.chdir(topobjdir)
os.execlp('sh', 'sh', '-c', ' '.join([os.path.join(topsrcdir, 'configure'), env.substs['ac_configure_args'], '--no-create', '--no-recursion']))
if options.files:
files = options.files
headers = []
if options.headers:
headers = options.headers
if not options.files:
files = []
# Default to display messages when giving --file or --headers on the
# command line.
log_level = logging.INFO
if options.files or options.headers or options.verbose:
log_level = logging.DEBUG
log_manager.add_terminal_logging(level=log_level)
log_manager.enable_unstructured()
if not options.files and not options.headers:
print('Reticulating splines...', file=sys.stderr)
summary = backend.consume(definitions)
for line in summary.summaries():
print(line, file=sys.stderr)
files = [os.path.join(topobjdir, f) for f in files]
headers = [os.path.join(topobjdir, f) for f in headers]
#.........这里部分代码省略.........
开发者ID:Georepublic,项目名称:mozilla-central,代码行数:101,代码来源:ConfigStatus.py
示例19: config_status
def config_status(topobjdir='.', topsrcdir='.',
defines=[], non_global_defines=[], substs=[], source=None):
'''Main function, providing config.status functionality.
Contrary to config.status, it doesn't use CONFIG_FILES or CONFIG_HEADERS
variables.
Without the -n option, this program acts as config.status and considers
the current directory as the top object directory, even when config.status
is in a different directory. It will, however, treat the directory
containing config.status as the top object directory with the -n option.
The --recheck option, like with the original config.status, runs configure
again, with the options given in the "ac_configure_args" subst.
The options to this function are passed when creating the
ConfigEnvironment. These lists, as well as the actual wrapper script
around this function, are meant to be generated by configure.
See build/autoconf/config.status.m4.
'''
if 'CONFIG_FILES' in os.environ:
raise Exception('Using the CONFIG_FILES environment variable is not '
'supported.')
if 'CONFIG_HEADERS' in os.environ:
raise Exception('Using the CONFIG_HEADERS environment variable is not '
'supported.')
if not os.path.isabs(topsrcdir):
raise Exception('topsrcdir must be defined as an absolute directory: '
'%s' % topsrcdir)
parser = OptionParser()
parser.add_option('--recheck', dest='recheck', action='store_true',
help='update config.status by reconfiguring in the same conditions')
parser.add_option('-v', '--verbose', dest='verbose', action='store_true',
help='display verbose output')
parser.add_option('-n', dest='not_topobjdir', action='store_true',
help='do not consider current directory as top object directory')
parser.add_option('-d', '--diff', action='store_true',
help='print diffs of changed files.')
options, args = parser.parse_args()
# Without -n, the current directory is meant to be the top object directory
if not options.not_topobjdir:
topobjdir = os.path.abspath('.')
env = ConfigEnvironment(topsrcdir, topobjdir, defines=defines,
non_global_defines=non_global_defines, substs=substs, source=source)
# mozinfo.json only needs written if configure changes and configure always
# passes this environment variable.
if 'WRITE_MOZINFO' in os.environ:
write_mozinfo(os.path.join(topobjdir, 'mozinfo.json'), env, os.environ)
reader = BuildReader(env)
emitter = TreeMetadataEmitter(env)
backend = RecursiveMakeBackend(env)
# This won't actually do anything because of the magic of generators.
definitions = emitter.emit(reader.read_topsrcdir())
if options.recheck:
# Execute configure from the top object directory
os.chdir(topobjdir)
os.execlp('sh', 'sh', '-c', ' '.join([os.path.join(topsrcdir, 'configure'), env.substs['ac_configure_args'], '--no-create', '--no-recursion']))
log_level = logging.DEBUG if options.verbose else logging.INFO
log_manager.add_terminal_logging(level=log_level)
log_manager.enable_unstructured()
print('Reticulating splines...', file=sys.stderr)
summary = backend.consume(definitions)
for line in summary.summaries():
print(line, file=sys.stderr)
if options.diff:
for path, diff in sorted(summary.file_diffs.items()):
print(diff)
开发者ID:sandhua,项目名称:gecko-dev,代码行数:79,代码来源:config_status.py
示例20: config_status
def config_status(topobjdir='.', topsrcdir='.',
defines=[], non_global_defines=[], substs=[], source=None):
'''Main function, providing config.status functionality.
Contrary to config.status, it doesn't use CONFIG_FILES or CONFIG_HEADERS
variables.
Without the -n option, this program acts as config.status and considers
the current directory as the top object directory, even when config.status
is in a different directory. It will, however, treat the directory
containing config.status as the top object directory with the -n option.
The --recheck option, like with the original config.status, runs configure
again, with the options given in the "ac_configure_args" subst.
The options to this function are passed when creating the
ConfigEnvironment. These lists, as well as the actual wrapper script
around this function, are meant to be generated by configure.
See build/autoconf/config.status.m4.
'''
if 'CONFIG_FILES' in os.environ:
raise Exception('Using the CONFIG_FILES environment variable is not '
'supported.')
if 'CONFIG_HEADERS' in os.environ:
raise Exception('Using the CONFIG_HEADERS environment variable is not '
'supported.')
if not os.path.isabs(topsrcdir):
raise Exception('topsrcdir must be defined as an absolute directory: '
'%s' % topsrcdir)
parser = OptionParser()
parser.add_option('--recheck', dest='recheck', action='store_true',
help='update config.status by reconfiguring in the same conditions')
parser.add_option('-v', '--verbose', dest='verbose', action='store_true',
help='display verbose output')
parser.add_option('-n', dest='not_topobjdir', action='store_true',
help='do not consider current directory as top object directory')
parser.add_option('-d', '--diff', action='store_true',
help='print diffs of changed files.')
parser.add_option('-b', '--backend',
choices=['RecursiveMake', 'AndroidEclipse', 'CppEclipse', 'VisualStudio'],
default='RecursiveMake',
help='what backend to build (default: RecursiveMake).')
options, args = parser.parse_args()
# Without -n, the current directory is meant to be the top object directory
if not options.not_topobjdir:
topobjdir = os.path.abspath('.')
env = ConfigEnvironment(topsrcdir, topobjdir, defines=defines,
non_global_defines=non_global_defines, substs=substs, source=source)
# mozinfo.json only needs written if configure changes and configure always
# passes this environment variable.
if 'WRITE_MOZINFO' in os.environ:
write_mozinfo(os.path.join(topobjdir, 'mozinfo.json'), env, os.environ)
# Make an appropriate backend instance, defaulting to RecursiveMakeBackend.
backend_cls = RecursiveMakeBackend
if options.backend == 'AndroidEclipse':
from mozbuild.backend.android_eclipse import AndroidEclipseBackend
if not MachCommandConditions.is_android(env):
raise Exception('The Android Eclipse backend is not available with this configuration.')
backend_cls = AndroidEclipseBackend
elif options.backend == 'CppEclipse':
from mozbuild.backend.cpp_eclipse import CppEclipseBackend
backend_cls = CppEclipseBackend
if os.name == 'nt':
raise Exception('Eclipse is not supported on Windows. Consider using Visual Studio instead.')
elif options.backend == 'VisualStudio':
from mozbuild.backend.visualstudio import VisualStudioBackend
backend_cls = VisualStudioBackend
the_backend = backend_cls(env)
reader = BuildReader(env)
emitter = TreeMetadataEmitter(env)
# This won't actually do anything because of the magic of generators.
definitions = emitter.emit(reader.read_topsrcdir())
if options.recheck:
# Execute configure from the top object directory
os.chdir(topobjdir)
os.execlp('sh', 'sh', '-c', ' '.join([os.path.join(topsrcdir, 'configure'), env.substs['ac_configure_args'], '--no-create', '--no-recursion']))
log_level = logging.DEBUG if options.verbose else logging.INFO
log_manager.add_terminal_logging(level=log_level)
log_manager.enable_unstructured()
print('Reticulating splines...', file=sys.stderr)
summary = the_backend.consume(definitions)
for line in summary.summaries():
print(line, file=sys.stderr)
if options.diff:
for path, diff in sorted(summary.file_diffs.items()):
print('\n'.join(diff))
#.........这里部分代码省略.........
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:101,代码来源:config_status.py
注:本文中的mozbuild.frontend.reader.BuildReader类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论