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),
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, [
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, [
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),
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,
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, ),