コード例 #1
0
ファイル: fs.py プロジェクト: RobinTec/pants
  return stats


def files_content(files, file_values):
  entries = tuple(FileContent(f.path, f_value.content)
                  for f, f_value in zip(files.dependencies, file_values))
  return FilesContent(entries)


def files_digest(files, file_values):
  entries = tuple(FileDigest(f.path, f_value.digest)
                  for f, f_value in zip(files.dependencies, file_values))
  return FilesDigest(entries)


FilesContent = Collection.of(FileContent)
FilesDigest = Collection.of(FileDigest)


def create_fs_tasks():
  """Creates tasks that consume the native filesystem Node type."""
  return [
    # Glob execution.
    (Paths,
     [SelectDependencies(Paths, PathGlobs)],
     merge_paths),
    (Paths,
     [Select(PathRoot)],
     apply_path_root),
    (Paths,
     [SelectProjection(DirectoryListing, Dir, ('canonical_stat',), PathWildcard),
コード例 #2
0
    return FileContent(f.path, project_tree.content(f.path))


def file_digest(project_tree, f):
    """Return a FileDigest for a known-existing File.

  See NB on file_content.
  """
    return FileDigest(f.path, sha1(project_tree.content(f.path)).digest())


def identity(v):
    return v


Dirs = Collection.of(Dir)
Files = Collection.of(File)
FilesContent = Collection.of(FileContent)
FilesDigest = Collection.of(FileDigest)
Links = Collection.of(Link)


def create_fs_tasks():
    """Creates tasks that consume the native filesystem Node type."""
    return [
        # Glob execution.
        (Stats, [
            SelectProjection(Stats, Dir, ('directory', ), PathWildcard),
            Select(PathWildcard)
        ], apply_path_wildcard),
        (PathGlobs, [
コード例 #3
0
def files_content(files, file_values):
    entries = tuple(
        FileContent(f.path, f_value.content)
        for f, f_value in zip(files.dependencies, file_values))
    return FilesContent(entries)


def files_digest(files, file_values):
    entries = tuple(
        FileDigest(f.path, f_value.digest)
        for f, f_value in zip(files.dependencies, file_values))
    return FilesDigest(entries)


FilesContent = Collection.of(FileContent)
FilesDigest = Collection.of(FileDigest)


def create_fs_tasks():
    """Creates tasks that consume the native filesystem Node type."""
    return [
        # Glob execution.
        (Paths, [
            SelectDependencies(
                Paths,
                PathGlobs,
                field_types=(PathWildcard, PathDirWildcard, PathRoot))
        ], merge_paths),
        (Paths, [Select(PathRoot)], apply_path_root),
        (Paths, [
コード例 #4
0
def file_content(project_tree, path):
    try:
        return FileContent(path.path, project_tree.content(path.path))
    except (IOError, OSError) as e:
        if e.errno == errno.ENOENT:
            return FileContent(path.path, None)
        else:
            raise e


def identity(v):
    return v


Files = Collection.of(File)
Dirs = Collection.of(Dir)
FilesContent = Collection.of(FileContent)
Links = Collection.of(Link)


def create_fs_tasks():
    """Creates tasks that consume the native filesystem Node type."""
    return [
        # Glob execution.
        (Stats, [
            SelectProjection(Stats, Dir, ('directory', ), PathWildcard),
            Select(PathWildcard)
        ], apply_path_wildcard),
        (PathGlobs, [
            SelectProjection(Dirs, Path, ('directory', ), PathLiteral),
コード例 #5
0
ファイル: fs.py プロジェクト: ericxsun/pants
  return FileContent(f.path, project_tree.content(f.path))


def file_digest(project_tree, f):
  """Return a FileDigest for a known-existing File.

  See NB on file_content.
  """
  return FileDigest(f.path, sha1(project_tree.content(f.path)).digest())


def identity(v):
  return v


Dirs = Collection.of(Dir)
Files = Collection.of(File)
FilesContent = Collection.of(FileContent)
FilesDigest = Collection.of(FileDigest)
Links = Collection.of(Link)


def create_fs_tasks():
  """Creates tasks that consume the native filesystem Node type."""
  return [
    # Glob execution.
    (Stats,
     [SelectProjection(Stats, Dir, ('directory',), PathWildcard),
      Select(PathWildcard)],
     apply_path_wildcard),
    (PathGlobs,
コード例 #6
0
ファイル: fs.py プロジェクト: weian/pants
def file_content(project_tree, path):
    try:
        return FileContent(path.path, project_tree.content(path.path))
    except (IOError, OSError) as e:
        if e.errno == errno.ENOENT:
            return FileContent(path.path, None)
        else:
            raise e


def identity(v):
    return v


Files = Collection.of(File)
Dirs = Collection.of(Dir)
FilesContent = Collection.of(FileContent)
Links = Collection.of(Link)


def create_fs_tasks():
    """Creates tasks that consume the native filesystem Node type."""
    return (
        [
            # Glob execution.
            (
                Stats,
                [SelectProjection(Stats, Dir, ("directory",), PathWildcard), Select(PathWildcard)],
                apply_path_wildcard,
            ),