Ejemplo n.º 1
0
    def _address_map_from_spec_path(self, spec_path):
        """Returns a resolution map of all addresses in a "directory" in the virtual address space.

    :returns {Address: (Address, <resolved Object>)}:
    """
        if spec_path not in self._spec_path_to_address_map_map:
            try:
                try:
                    build_file = self._build_file_type.from_cache(
                        self.root_dir, spec_path)
                except BuildFile.BuildFileError as e:
                    raise self.BuildFileScanError(
                        "{message}\n searching {spec_path}".format(
                            message=e, spec_path=spec_path))
                mapping = self._build_file_parser.address_map_from_build_file(
                    build_file)
            except BuildFileParser.BuildFileParserError as e:
                raise AddressLookupError(
                    "{message}\n Loading addresses from '{spec_path}' failed.".
                    format(message=e, spec_path=spec_path))

            address_map = {
                address: (address, addressed)
                for address, addressed in mapping.items()
            }
            self._spec_path_to_address_map_map[spec_path] = address_map
        return self._spec_path_to_address_map_map[spec_path]
Ejemplo n.º 2
0
  def address_map_from_spec_path(self, spec_path):
    """Returns a resolution map of all addresses in a "directory" in the virtual address space.

    :returns {Address: <resolved Object>}:
    """
    if spec_path not in self._spec_path_to_address_map_map:
      try:
        address_map = self._build_file_parser.address_map_from_spec_path(spec_path)
      except BuildFileParser.BuildFileParserError as e:
        raise AddressLookupError("{message}\n Loading addresses from '{spec_path}' failed."
                                  .format(message=e, spec_path=spec_path))
      self._spec_path_to_address_map_map[spec_path] = address_map
    return self._spec_path_to_address_map_map[spec_path]