当前位置: 首页>>代码示例>>Python>>正文


Python BuildFile.scan_buildfiles方法代码示例

本文整理汇总了Python中twitter.pants.base.BuildFile.scan_buildfiles方法的典型用法代码示例。如果您正苦于以下问题:Python BuildFile.scan_buildfiles方法的具体用法?Python BuildFile.scan_buildfiles怎么用?Python BuildFile.scan_buildfiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twitter.pants.base.BuildFile的用法示例。


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

示例1: add_target_recursive

# 需要导入模块: from twitter.pants.base import BuildFile [as 别名]
# 或者: from twitter.pants.base.BuildFile import scan_buildfiles [as 别名]
 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,代码行数:9,代码来源:goal.py

示例2: execute

# 需要导入模块: from twitter.pants.base import BuildFile [as 别名]
# 或者: from twitter.pants.base.BuildFile import scan_buildfiles [as 别名]
 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,代码行数:9,代码来源:filemap.py

示例3: _addresses

# 需要导入模块: from twitter.pants.base import BuildFile [as 别名]
# 或者: from twitter.pants.base.BuildFile import scan_buildfiles [as 别名]
 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,代码行数:10,代码来源:listtargets.py

示例4: scan_addresses

# 需要导入模块: from twitter.pants.base import BuildFile [as 别名]
# 或者: from twitter.pants.base.BuildFile import scan_buildfiles [as 别名]
  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,代码行数:10,代码来源:__init__.py

示例5: _find_targets

# 需要导入模块: from twitter.pants.base import BuildFile [as 别名]
# 或者: from twitter.pants.base.BuildFile import scan_buildfiles [as 别名]
 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,代码行数:11,代码来源:filemap.py

示例6: execute

# 需要导入模块: from twitter.pants.base import BuildFile [as 别名]
# 或者: from twitter.pants.base.BuildFile import scan_buildfiles [as 别名]
  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,代码行数:58,代码来源:goal.py

示例7: execute

# 需要导入模块: from twitter.pants.base import BuildFile [as 别名]
# 或者: from twitter.pants.base.BuildFile import scan_buildfiles [as 别名]
 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,代码行数:13,代码来源:filemap.py

示例8: _parse_buildfiles

# 需要导入模块: from twitter.pants.base import BuildFile [as 别名]
# 或者: from twitter.pants.base.BuildFile import scan_buildfiles [as 别名]
 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,代码行数:14,代码来源:list.py

示例9: _parse_addresses

# 需要导入模块: from twitter.pants.base import BuildFile [as 别名]
# 或者: from twitter.pants.base.BuildFile import scan_buildfiles [as 别名]
 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,代码行数:14,代码来源:goal.py

示例10: __init__

# 需要导入模块: from twitter.pants.base import BuildFile [as 别名]
# 或者: from twitter.pants.base.BuildFile import scan_buildfiles [as 别名]
  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,代码行数:17,代码来源:check_published_deps.py

示例11: __init__

# 需要导入模块: from twitter.pants.base import BuildFile [as 别名]
# 或者: from twitter.pants.base.BuildFile import scan_buildfiles [as 别名]
  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,代码行数:6,代码来源:list.py

示例12: _addresses

# 需要导入模块: from twitter.pants.base import BuildFile [as 别名]
# 或者: from twitter.pants.base.BuildFile import scan_buildfiles [as 别名]
 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,代码行数:8,代码来源:listtargets.py


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