def ascendant_addresses_to_globs(address_mapper, ascendant_addresses): """Given an AscendantAddresses object, return a PathGlobs object for matching build files.""" patterns = [ join(f, pattern) for pattern in address_mapper.build_patterns for f in _recursive_dirname(ascendant_addresses.directory) ] return PathGlobs.create_from_specs('', patterns)
def descendant_addresses_to_globs(address_mapper, descendant_addresses): """Given a DescendantAddresses object, return a PathGlobs object for matching build files. This allows us to limit our AddressFamily requests to directories that contain build files. """ pattern = address_mapper.build_pattern return PathGlobs.create_from_specs(descendant_addresses.directory, [pattern, join("**", pattern)])
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 descendant_addresses_to_globs(address_mapper, descendant_addresses): """Given a DescendantAddresses object, return a PathGlobs object for matching build files. This allows us to limit our AddressFamily requests to directories that contain build files. """ pattern = address_mapper.build_pattern return PathGlobs.create_from_specs(descendant_addresses.directory, [pattern, join('**', pattern)])
def to_path_globs(self, relpath): """Return two PathGlobs representing the included and excluded Files for these patterns.""" return (PathGlobs.create_from_specs(FSFiles, relpath, self._filespecs), PathGlobs.create_from_specs(FSFiles, relpath, self._excluded_filespecs))
def assert_pg_equals(self, pathglobs, relative_to, filespecs): self.assertEquals(PathGlobs(tuple(pathglobs)), PathGlobs.create_from_specs(relative_to, filespecs))
def specs(self, ftype, relative_to, *filespecs): return PathGlobs.create_from_specs(ftype, relative_to, filespecs)
def specs(self, ftype, relative_to, *filespecs): return PathGlobs.create_from_specs(ftype, relative_to, filespecs)
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('', specs)
def to_path_globs(self, relpath): """Return two PathGlobs representing the included and excluded Files for these patterns.""" return ( PathGlobs.create_from_specs(relpath, self._filespecs), PathGlobs.create_from_specs(relpath, self._excluded_filespecs) )
def assert_pg_equals(self, pathglobs, relative_to, filespecs): self.assertEquals(PathGlobs(tuple(pathglobs)), PathGlobs.create_from_specs(relative_to, filespecs))
def ascendant_addresses_to_globs(address_mapper, ascendant_addresses): """Given an AscendantAddresses object, return a PathGlobs object for matching build files.""" pattern = address_mapper.build_pattern patterns = [join(f, pattern) for f in _recursive_dirname(ascendant_addresses.directory)] return PathGlobs.create_from_specs("", patterns)