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(Files, '', globs=[arg]) for arg in args] visualize_build_request(build_root, goals, path_globs)
def calculate_package_search_path(jvm_package_name, source_roots): """Return Paths for directories where the given JVMPackageName might exist.""" rel_package_dir = jvm_package_name.name.replace('.', os_sep) if not rel_package_dir.endswith(os_sep): rel_package_dir += os_sep specs = [os_path_join(srcroot, rel_package_dir) for srcroot in source_roots.srcroots] return PathGlobs.create_from_specs('', specs)
def main_filespecs(): build_root, goals, args = pop_build_root_and_goals( '[build root path] [filespecs]*', sys.argv[1:]) # Create a PathGlobs object relative to the buildroot. path_globs = PathGlobs.create('', globs=args) visualize_build_request(build_root, BuildRequest(goals=goals, subjects=[path_globs]))
def path_globs(self): """Creates a `PathGlobs` object for the files held by these Sources. This field may be projected to request the content of the files for this Sources object. """ return PathGlobs.create(self.spec_path, files=self.files, globs=self.globs, rglobs=self.rglobs, zglobs=self.zglobs)
def calculate_package_search_path(jvm_package_name, source_roots): """Return Paths for directories where the given JVMPackageName might exist.""" rel_package_dir = jvm_package_name.name.replace('.', os_sep) if not rel_package_dir.endswith(os_sep): rel_package_dir += os_sep specs = [ os_path_join(srcroot, rel_package_dir) for srcroot in source_roots.srcroots ] return PathGlobs.create_from_specs('', specs)
def to_fileset_with_spec(self, engine, scheduler, relpath): """Return a `FilesetWithSpec` object for these files, computed using the given engine. TODO: Simplify the engine API. See: https://github.com/pantsbuild/pants/issues/3070 """ filespecs = self.legacy_globs_class.to_filespec(self.patterns) pathglobs = PathGlobs.create_from_specs(relpath, filespecs.get('globs', [])) lfc = LazyFilesContent(engine, scheduler, pathglobs) return wrapped_globs.FilesetWithSpec('', filespecs, files_calculator=lfc.files, file_content_calculator=lfc.file_content)
def to_fileset_with_spec(self, engine, scheduler, relpath): """Return a `FilesetWithSpec` object for these files, computed using the given engine. TODO: Simplify the engine API. See: https://github.com/pantsbuild/pants/issues/3070 """ filespecs = self.legacy_globs_class.to_filespec(self.patterns) pathglobs = PathGlobs.create_from_specs(FSFiles, relpath, filespecs.get('globs', [])) lfc = LazyFilesContent(engine, scheduler, pathglobs) return wrapped_globs.FilesetWithSpec( '', filespecs, files_calculator=lfc.files, file_content_calculator=lfc.file_content)
def pg(self, *pathglobs): return PathGlobs(pathglobs)
def calculate_package_search_path(jvm_package_name, source_roots): """Return PathGlobs to match directories where the given JVMPackageName might exist.""" rel_package_dir = jvm_package_name.name.replace('.', os_sep) specs = [os_path_join(srcroot, rel_package_dir) for srcroot in source_roots.srcroots] return PathGlobs.create_from_specs(Dirs, '', specs)
def assert_pg_equals(self, ftype, pathglobs, relative_to, filespecs): self.assertEquals(PathGlobs(ftype, tuple(pathglobs)), PathGlobs.create_from_specs(ftype, relative_to, filespecs))
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=['.', '*', '**/*'])
def main_filespecs(): build_root, goals, args = pop_build_root_and_goals('[build root path] [filespecs]*', sys.argv[1:]) # Create a PathGlobs object relative to the buildroot. path_globs = PathGlobs.create('', globs=args) visualize_build_request(build_root, BuildRequest(goals=goals, subjects=[path_globs]))
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)
def specs(self, relative_to, *filespecs): return PathGlobs.create_from_specs(relative_to, filespecs)
def main_filespecs(): build_root, goals, args = pop_build_root_and_goals("[build root path] [filespecs]*", sys.argv[1:]) # Create a PathGlobs object relative to the buildroot. path_globs = PathGlobs.create("", globs=args) visualize_build_request(build_root, goals, [path_globs])