本文整理汇总了Python中twitter.pants.base.BuildFile类的典型用法代码示例。如果您正苦于以下问题:Python BuildFile类的具体用法?Python BuildFile怎么用?Python BuildFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BuildFile类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: add_target_recursive
def add_target_recursive(self, *specs):
with self.check_errors('There was a problem scanning the '
'following directories for targets:') as error:
for spec in specs:
dir = self.get_dir(spec)
for buildfile in BuildFile.scan_buildfiles(self.root_dir, dir):
self.add_targets(error, dir, buildfile)
开发者ID:soheilhy,项目名称:commons,代码行数:7,代码来源:goal.py
示例2: execute
def execute(self):
for buildfile in BuildFile.scan_buildfiles(self.root_dir):
for address in Target.get_all_addresses(buildfile):
target = Target.get(address)
if hasattr(target, 'sources') and target.sources is not None:
for sourcefile in target.sources:
print sourcefile, address
开发者ID:DikangGu,项目名称:commons,代码行数:7,代码来源:filemap.py
示例3: _addresses
def _addresses(self):
if self.context.target_roots:
for target in self.context.target_roots:
yield target.address
else:
for buildfile in BuildFile.scan_buildfiles(self._root_dir):
for address in Target.get_all_addresses(buildfile):
yield address
开发者ID:pkwarren,项目名称:commons,代码行数:8,代码来源:listtargets.py
示例4: scan_addresses
def scan_addresses(root_dir, base_path = None):
"""Parses all targets available in BUILD files under base_path and returns their addresses. If no
base_path is specified, root_dir is assumed to be the base_path"""
addresses = OrderedSet()
for buildfile in BuildFile.scan_buildfiles(root_dir, base_path):
addresses.update(Target.get_all_addresses(buildfile))
return addresses
开发者ID:DikangGu,项目名称:commons,代码行数:8,代码来源:__init__.py
示例5: _find_targets
def _find_targets(self):
if len(self.context.target_roots) > 0:
for target in self.context.target_roots:
yield target
else:
for buildfile in BuildFile.scan_buildfiles(get_buildroot()):
target_addresses = Target.get_all_addresses(buildfile)
for target_address in target_addresses:
yield Target.get(target_address)
开发者ID:CodeWarltz,项目名称:commons,代码行数:9,代码来源:filemap.py
示例6: execute
def execute(self):
def add_targets(dir, buildfile):
try:
self.targets.extend(Target.get(addr) for addr in Target.get_all_addresses(buildfile))
except (TypeError, ImportError):
error(dir, include_traceback=True)
except (IOError, SyntaxError):
error(dir)
if self.options.recursive_directory:
with self.check_errors('There was a problem scanning the '
'following directories for targets:') as error:
for dir in self.options.recursive_directory:
for buildfile in BuildFile.scan_buildfiles(self.root_dir, dir):
add_targets(dir, buildfile)
if self.options.target_directory:
with self.check_errors("There was a problem loading targets "
"from the following directory's BUILD files") as error:
for dir in self.options.target_directory:
add_targets(dir, BuildFile(self.root_dir, dir))
timer = None
if self.options.time:
class Timer(object):
def now(self):
return time.time()
def log(self, message):
print(message)
timer = Timer()
logger = None
if self.options.log or self.options.log_level:
from twitter.common.log import init
from twitter.common.log.options import LogOptions
LogOptions.set_stderr_log_level((self.options.log_level or 'info').upper())
logdir = self.config.get('goals', 'logdir')
if logdir:
safe_mkdir(logdir)
LogOptions.set_log_dir(logdir)
init('goals')
logger = log
context = Context(self.config, self.options, self.targets, log=logger)
unknown = []
for phase in self.phases:
if not phase.goals():
unknown.append(phase)
if unknown:
print('Unknown goal(s): %s' % ' '.join(phase.name for phase in unknown))
print()
return Phase.execute(context, 'goals')
return Phase.attempt(context, self.phases, timer=timer)
开发者ID:adamsxu,项目名称:commons,代码行数:56,代码来源:goal.py
示例7: execute
def execute(self, expanded_target_addresses):
buildroot = get_buildroot()
if len(self.context.target_roots) > 0:
for target in self.context.target_roots:
self._execute_target(target, buildroot)
else:
for buildfile in BuildFile.scan_buildfiles(buildroot):
target_addresses = Target.get_all_addresses(buildfile)
for target_address in target_addresses:
target = Target.get(target_address)
self._execute_target(target, buildroot)
开发者ID:alfss,项目名称:commons,代码行数:11,代码来源:filemap.py
示例8: _parse_buildfiles
def _parse_buildfiles(self):
buildfiles = OrderedSet()
for spec in self.args:
try:
if self.options.is_directory_list:
for buildfile in BuildFile.scan_buildfiles(self.root_dir, spec):
buildfiles.add(buildfile)
else:
buildfiles.add(Address.parse(self.root_dir, spec).buildfile)
except:
self.error("Problem parsing spec %s: %s" % (spec, traceback.format_exc()))
return buildfiles
开发者ID:DikangGu,项目名称:commons,代码行数:12,代码来源:list.py
示例9: _parse_addresses
def _parse_addresses(self, spec):
if spec.endswith('::'):
dir = self._get_dir(spec[:-len('::')])
for buildfile in BuildFile.scan_buildfiles(self._root_dir, os.path.join(self._root_dir, dir)):
for address in Target.get_all_addresses(buildfile):
yield address
elif spec.endswith(':'):
dir = self._get_dir(spec[:-len(':')])
for address in Target.get_all_addresses(BuildFile(self._root_dir, dir)):
yield address
else:
yield Address.parse(self._root_dir, spec)
开发者ID:patricklaw,项目名称:twitter-commons,代码行数:12,代码来源:goal.py
示例10: __init__
def __init__(self, context):
ConsoleTask.__init__(self, context)
self._print_uptodate = context.options.check_deps_print_uptodate
self.repos = context.config.getdict('jar-publish', 'repos')
self._artifacts_to_targets = {}
all_addresses = (address for buildfile in BuildFile.scan_buildfiles(get_buildroot())
for address in Target.get_all_addresses(buildfile))
for address in all_addresses:
target = Target.get(address)
if target.is_exported:
provided_jar, _, _ = target.get_artifact_info()
artifact = (provided_jar.org, provided_jar.name)
if not artifact in self._artifacts_to_targets:
self._artifacts_to_targets[artifact] = target
开发者ID:CodeWarltz,项目名称:commons,代码行数:15,代码来源:check_published_deps.py
示例11: __init__
def __init__(self, root_dir, parser, argv):
Command.__init__(self, root_dir, parser, argv)
self.buildfiles = self._parse_buildfiles() if self.args else BuildFile.scan_buildfiles(root_dir)
开发者ID:DikangGu,项目名称:commons,代码行数:4,代码来源:list.py
示例12: _addresses
def _addresses(self):
if self.context.target_roots:
return (target.address for target in self.context.target_roots)
else:
return (address for buildfile in BuildFile.scan_buildfiles(self._root_dir)
for address in Target.get_all_addresses(buildfile))
开发者ID:BabyDuncan,项目名称:commons,代码行数:6,代码来源:listtargets.py
注:本文中的twitter.pants.base.BuildFile类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论