Python PathGlobs.create方法代码示例

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


Python PathGlobs.create方法代码示例

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

示例1: main_filespecs

# 需要导入模块: from pants.engine.fs import PathGlobs [as 别名]
# 或者: from pants.engine.fs.PathGlobs import create [as 别名]
def main_filespecs():
  build_root, goals, args = pop_build_root_and_goals(
    '[build root path] [filespecs]*', sys.argv[1:])

  # Create PathGlobs for each arg relative to the buildroot.
  path_globs = PathGlobs.create('', include=args, exclude=[])
  visualize_build_request(build_root, goals, path_globs)
开发者ID:benjyw,项目名称:pants,代码行数:9,代码来源:visualizer.py

示例2: test_gather_snapshot_of_pathglobs

# 需要导入模块: from pants.engine.fs import PathGlobs [as 别名]
# 或者: from pants.engine.fs.PathGlobs import create [as 别名]
  def test_gather_snapshot_of_pathglobs(self):
    project_tree = self.mk_example_fs_tree()
    scheduler = self.mk_scheduler(project_tree=project_tree)
    empty_step_context = StepContext(node_builder=None, project_tree=project_tree, node_states=[], inline_nodes=False)

    request = scheduler.execution_request([Snapshot],
                                          [PathGlobs.create('', globs=['fs_test/a/b/*'])])
    LocalSerialEngine(scheduler).reduce(request)

    root_entries = scheduler.root_entries(request).items()
    self.assertEquals(1, len(root_entries))
    state = self.assertFirstEntryIsReturn(root_entries, scheduler)
    snapshot = state.value
    self.assert_archive_files(['fs_test/a/b/1.txt', 'fs_test/a/b/2'], snapshot,
                              empty_step_context)
开发者ID:CaitieM20,项目名称:pants,代码行数:17,代码来源:test_isolated_process.py

示例3: test_gather_snapshot_of_pathglobs

# 需要导入模块: from pants.engine.fs import PathGlobs [as 别名]
# 或者: from pants.engine.fs.PathGlobs import create [as 别名]
  def test_gather_snapshot_of_pathglobs(self):
    project_tree = self.mk_example_fs_tree()
    scheduler = self.mk_scheduler(project_tree=project_tree, tasks=create_snapshot_tasks(project_tree))
    snapshot_archive_root = os.path.join(project_tree.build_root, '.snapshots')

    request = scheduler.execution_request([Snapshot],
                                          [PathGlobs.create('', globs=['fs_test/a/b/*'])])
    LocalSerialEngine(scheduler).reduce(request)

    root_entries = scheduler.root_entries(request).items()
    self.assertEquals(1, len(root_entries))
    state = self.assertFirstEntryIsReturn(root_entries, scheduler)
    snapshot = state.value
    self.assert_archive_files(['fs_test/a/b/1.txt', 'fs_test/a/b/2'], snapshot,
                              snapshot_archive_root)
开发者ID:mateor,项目名称:pants,代码行数:17,代码来源:test_isolated_process.py

示例4: _spec_to_globs

# 需要导入模块: from pants.engine.fs import PathGlobs [as 别名]
# 或者: from pants.engine.fs.PathGlobs import create [as 别名]
def _spec_to_globs(address_mapper, specs):
  """Given a Specs object, return a PathGlobs object for the build files that it matches."""
  patterns = set()
  for spec in specs.dependencies:
    if type(spec) is DescendantAddresses:
      patterns.update(join(spec.directory, '**', pattern)
                      for pattern in address_mapper.build_patterns)
    elif type(spec) in (SiblingAddresses, SingleAddress):
      patterns.update(join(spec.directory, pattern)
                      for pattern in address_mapper.build_patterns)
    elif type(spec) is AscendantAddresses:
      patterns.update(join(f, pattern)
                      for pattern in address_mapper.build_patterns
                      for f in _recursive_dirname(spec.directory))
    else:
      raise ValueError('Unrecognized Spec type: {}'.format(spec))
  return PathGlobs.create('', include=patterns, exclude=address_mapper.build_ignore_patterns)
开发者ID:traviscrawford,项目名称:pants,代码行数:19,代码来源:build_files.py

示例5: spec_to_globs

# 需要导入模块: from pants.engine.fs import PathGlobs [as 别名]
# 或者: from pants.engine.fs.PathGlobs import create [as 别名]
def spec_to_globs(address_mapper, spec):
  """Given a Spec object, return a PathGlobs object for the build files that it matches."""
  if type(spec) is DescendantAddresses:
    directory = spec.directory
    patterns = [join('**', pattern) for pattern in address_mapper.build_patterns]
  elif type(spec) in (SiblingAddresses, SingleAddress):
    directory = spec.directory
    patterns = address_mapper.build_patterns
  elif type(spec) is AscendantAddresses:
    directory = ''
    patterns = [
      join(f, pattern)
      for pattern in address_mapper.build_patterns
      for f in _recursive_dirname(spec.directory)
    ]
  else:
    raise ValueError('Unrecognized Spec type: {}'.format(spec))
  return PathGlobs.create(directory, include=patterns, exclude=[])
开发者ID:pombredanne,项目名称:pants,代码行数:20,代码来源:build_files.py

示例6: test_failed_output_conversion_propagates_throw

# 需要导入模块: from pants.engine.fs import PathGlobs [as 别名]
# 或者: from pants.engine.fs.PathGlobs import create [as 别名]
  def test_failed_output_conversion_propagates_throw(self):
    scheduler = self.mk_scheduler_in_example_fs([
      # subject to files / product of subject to files for snapshot.
      SnapshottedProcess.create(product_type=Concatted,
                                binary_type=ShellCatToOutFile,
                                input_selectors=(Select(Snapshot),),
                                input_conversion=file_list_to_args_for_cat_with_snapshot_subjects_and_output_file,
                                output_conversion=fail_process_result),
      SingletonRule(ShellCatToOutFile, ShellCatToOutFile()),
    ])

    request = scheduler.execution_request([Concatted],
                                          [PathGlobs.create('', include=['fs_test/a/b/*'])])
    root_entries = scheduler.execute(request).root_products

    self.assertEquals(1, len(root_entries))
    self.assertFirstEntryIsThrow(root_entries,
                                 in_msg='Failed in output conversion!')
开发者ID:grimreaper,项目名称:pants,代码行数:20,代码来源:test_isolated_process.py

示例7: test_failed_command_propagates_throw

# 需要导入模块: from pants.engine.fs import PathGlobs [as 别名]
# 或者: from pants.engine.fs.PathGlobs import create [as 别名]
  def test_failed_command_propagates_throw(self):
    scheduler = self.mk_scheduler_in_example_fs([
      # subject to files / product of subject to files for snapshot.
      SnapshottedProcess.create(product_type=Concatted,
                                binary_type=ShellFailCommand,
                                input_selectors=tuple(),
                                input_conversion=empty_process_request,
                                output_conversion=fail_process_result),
      SingletonRule(ShellFailCommand, ShellFailCommand()),
    ])

    request = scheduler.execution_request([Concatted],
                                          [PathGlobs.create('', include=['fs_test/a/b/*'])])
    root_entries = scheduler.execute(request).root_products

    self.assertEquals(1, len(root_entries))
    self.assertFirstEntryIsThrow(root_entries,
                                 in_msg='Running ShellFailCommand failed with non-zero exit code: 1')
开发者ID:grimreaper,项目名称:pants,代码行数:20,代码来源:test_isolated_process.py

示例8: parse_address_family

# 需要导入模块: from pants.engine.fs import PathGlobs [as 别名]
# 或者: from pants.engine.fs.PathGlobs import create [as 别名]
def parse_address_family(address_mapper, directory):
  """Given an AddressMapper and a directory, return an AddressFamily.

  The AddressFamily may be empty, but it will not be None.
  """
  patterns = tuple(join(directory.path, p) for p in address_mapper.build_patterns)
  path_globs = PathGlobs.create('',
                                include=patterns,
                                exclude=address_mapper.build_ignore_patterns)
  files_content = yield Get(FilesContent, PathGlobs, path_globs)

  if not files_content:
    raise ResolveError('Directory "{}" does not contain build files.'.format(directory.path))
  address_maps = []
  for filecontent_product in files_content.dependencies:
    address_maps.append(AddressMap.parse(filecontent_product.path,
                                         filecontent_product.content,
                                         address_mapper.parser))
  yield AddressFamily.create(directory.path, address_maps)
开发者ID:traviscrawford,项目名称:pants,代码行数:21,代码来源:build_files.py

示例9: test_integration_concat_with_snapshot_subjects_test

# 需要导入模块: from pants.engine.fs import PathGlobs [as 别名]
# 或者: from pants.engine.fs.PathGlobs import create [as 别名]
  def test_integration_concat_with_snapshot_subjects_test(self):
    scheduler = self.mk_scheduler_in_example_fs([
      # subject to files / product of subject to files for snapshot.
      SnapshottedProcess.create(product_type=Concatted,
                                binary_type=ShellCatToOutFile,
                                input_selectors=(Select(Snapshot),),
                                input_conversion=file_list_to_args_for_cat_with_snapshot_subjects_and_output_file,
                                output_conversion=process_result_to_concatted_from_outfile),
      SingletonRule(ShellCatToOutFile, ShellCatToOutFile()),
    ])

    request = scheduler.execution_request([Concatted],
                                          [PathGlobs.create('', include=['fs_test/a/b/*'])])

    root_entries = scheduler.execute(request).root_products
    self.assertEquals(1, len(root_entries))
    state = self.assertFirstEntryIsReturn(root_entries, scheduler)
    concatted = state.value

    self.assertEqual(Concatted('one\ntwo\n'), concatted)
开发者ID:grimreaper,项目名称:pants,代码行数:22,代码来源:test_isolated_process.py

示例10: test_javac_compilation_example

# 需要导入模块: from pants.engine.fs import PathGlobs [as 别名]
# 或者: from pants.engine.fs.PathGlobs import create [as 别名]
  def test_javac_compilation_example(self):
    sources = PathGlobs.create('', files=['scheduler_inputs/src/java/simple/Simple.java'])

    scheduler = self.mk_scheduler_in_example_fs([
      SnapshottedProcess.create(ClasspathEntry,
                                Javac,
                                (Select(Files), Select(Snapshot), SelectLiteral(JavaOutputDir('build'), JavaOutputDir)),
                                java_sources_to_javac_args,
                                process_result_to_classpath_entry),
      [Javac, [], Javac]
    ])

    request = scheduler.execution_request(
      [ClasspathEntry],
      [sources])
    LocalSerialEngine(scheduler).reduce(request)

    root_entries = scheduler.root_entries(request).items()
    self.assertEquals(1, len(root_entries))
    state = self.assertFirstEntryIsReturn(root_entries, scheduler)
    classpath_entry = state.value
    self.assertIsInstance(classpath_entry, ClasspathEntry)
    self.assertTrue(os.path.exists(os.path.join(classpath_entry.path, 'simple', 'Simple.class')))
开发者ID:mateor,项目名称:pants,代码行数:25,代码来源:test_isolated_process.py

示例11: test_javac_compilation_example

# 需要导入模块: from pants.engine.fs import PathGlobs [as 别名]
# 或者: from pants.engine.fs.PathGlobs import create [as 别名]
  def test_javac_compilation_example(self):
    sources = PathGlobs.create('', include=['scheduler_inputs/src/java/simple/Simple.java'])

    scheduler = self.mk_scheduler_in_example_fs([
      SnapshottedProcess.create(ClasspathEntry,
                                Javac,
                                (Select(Snapshot), Select(JavaOutputDir)),
                                java_sources_to_javac_args,
                                process_result_to_classpath_entry),
      SingletonRule(JavaOutputDir, JavaOutputDir('build')),
      SingletonRule(Javac, Javac()),
    ])

    request = scheduler.execution_request(
      [ClasspathEntry],
      [sources])
    root_entries = scheduler.execute(request).root_products

    self.assertEquals(1, len(root_entries))
    state = self.assertFirstEntryIsReturn(root_entries, scheduler)
    classpath_entry = state.value
    self.assertIsInstance(classpath_entry, ClasspathEntry)
    self.assertTrue(os.path.exists(os.path.join(classpath_entry.path, 'simple', 'Simple.class')))
开发者ID:grimreaper,项目名称:pants,代码行数:25,代码来源:test_isolated_process.py

示例12: main_filespecs

# 需要导入模块: from pants.engine.fs import PathGlobs [as 别名]
# 或者: from pants.engine.fs.PathGlobs import create [as 别名]
def main_filespecs():
  build_root, goals, args = pop_build_root_and_goals('[build root path] [filespecs]*', sys.argv[1:])

  # Create PathGlobs for each arg relative to the buildroot.
  path_globs = [PathGlobs.create('', globs=[arg]) for arg in args]
  visualize_build_request(build_root, goals, path_globs)
开发者ID:RobinTec,项目名称:pants,代码行数:8,代码来源:visualizer.py

示例13: specs

# 需要导入模块: from pants.engine.fs import PathGlobs [as 别名]
# 或者: from pants.engine.fs.PathGlobs import create [as 别名]
 def specs(relative_to, *filespecs):
   return PathGlobs.create(relative_to, include=filespecs)
开发者ID:pombredanne,项目名称:pants,代码行数:4,代码来源:test_fs.py

示例14: to_path_globs

# 需要导入模块: from pants.engine.fs import PathGlobs [as 别名]
# 或者: from pants.engine.fs.PathGlobs import create [as 别名]
 def to_path_globs(self, relpath):
   """Return two PathGlobs representing the included and excluded Files for these patterns."""
   return PathGlobs.create(relpath, self._file_globs, self._excluded_file_globs)
开发者ID:grimreaper,项目名称:pants,代码行数:5,代码来源:structs.py

示例15: descendant_addresses_to_globs

# 需要导入模块: from pants.engine.fs import PathGlobs [as 别名]
# 或者: from pants.engine.fs.PathGlobs import create [as 别名]
def descendant_addresses_to_globs(descendant_addresses):
  """Given a DescendantAddresses object, return a PathGlobs object for matching directories."""
  return PathGlobs.create(Dirs, descendant_addresses.directory, globs=['.', '*', '**/*'])
开发者ID:anubnair,项目名称:pants,代码行数:5,代码来源:graph.py

本文标签属性:

示例:示例英文

代码:代码生成器

Python:python什么意思

上一篇:Python Transform.quat2rot方法代码示例
下一篇:Python StaticFileHandler.get_absolute_path方法代码示例

为您推荐