def scan_addresses(self, root=None, spec_excludes=None): """Recursively gathers all addresses visible under `root` of the virtual address space. :param string root: The absolute path of the root to scan; defaults to the root directory of the pants project. :rtype: set of :class:`pants.build_graph.address.Address` :raises AddressLookupError: if there is a problem parsing a BUILD file """ root_dir = get_buildroot() base_path = None if root: try: base_path = fast_relpath(root, root_dir) except ValueError as e: raise self.InvalidRootError(e) addresses = set() try: for build_file in BuildFile.scan_project_tree_build_files(self._project_tree, base_relpath=base_path, spec_excludes=spec_excludes): for address in self.addresses_in_spec_path(build_file.spec_path): addresses.add(address) except BuildFile.BuildFileError as e: # Handle exception from BuildFile out of paranoia. Currently, there is no way to trigger it. raise self.BuildFileScanError("{message}\n while scanning BUILD files in '{root}'." .format(message=e, root=root)) return addresses
def scan_project_tree_build_files(self, base_path, spec_excludes): return BuildFile.scan_project_tree_build_files(self._project_tree, base_path, spec_excludes)
def scan_buildfiles(self, base_relpath=None, spec_excludes=None): return BuildFile.scan_project_tree_build_files(self._project_tree, base_relpath, spec_excludes)