def parse(self, infile):
     """Parse a ZincAnalysis instance from an open text file."""
     with raise_on_eof(infile):
         try:
             return ZincAnalysis(self._underlying_parser.parse(infile))
         except UnderlyingParser.ParseError as e:
             raise ParseError(e)
 def parse_products(self, infile, classes_dir):
     """An efficient parser of just the products section."""
     with raise_on_eof(infile):
         try:
             return self._underlying_parser.parse_products(infile)
         except UnderlyingParser.ParseError as e:
             raise ParseError(e)
 def parse(self, infile):
   """Parse a ZincAnalysis instance from an open text file."""
   with raise_on_eof(infile):
     try:
       return ZincAnalysis(self._underlying_parser.parse(infile))
     except UnderlyingParser.ParseError as e:
       raise ParseError(e)
 def parse_products(self, infile, classes_dir):
   """An efficient parser of just the products section."""
   with raise_on_eof(infile):
     try:
       return self._underlying_parser.parse_products(infile)
     except UnderlyingParser.ParseError as e:
       raise ParseError(e)
 def rebase(self,
            infile,
            outfile,
            pants_home_from,
            pants_home_to,
            java_home=None):
     with raise_on_eof(infile):
         try:
             self._underlying_parser.rebase(infile, outfile,
                                            pants_home_from, pants_home_to,
                                            java_home)
         except UnderlyingParser.ParseError as e:
             raise ParseError(e)
  def parse(self, infile):
    """Parse a ZincAnalysis instance from an open text file."""
    def parse_element(cls):
      parsed_sections = [self._parse_section(infile, header) for header in cls.headers]
      return cls(parsed_sections)

    with raise_on_eof(infile):
      self._verify_version(infile)
      compile_setup = parse_element(CompileSetup)
      relations = parse_element(Relations)
      stamps = parse_element(Stamps)
      apis = parse_element(APIs)
      source_infos = parse_element(SourceInfos)
      compilations = parse_element(Compilations)
      return ZincAnalysis(compile_setup, relations, stamps, apis, source_infos, compilations)
  def parse_deps(self, infile, classpath_indexer, classes_dir):
    with raise_on_eof(infile):
      self._verify_version(infile)
      # Note: relies on the fact that these headers appear in this order in the file.
      bin_deps = self._find_repeated_at_header(infile, 'binary dependencies')
      src_deps = self._find_repeated_at_header(infile, 'direct source dependencies')
      ext_deps = self._find_repeated_at_header(infile, 'direct external dependencies')

    # TODO(benjy): Temporary hack until we inject a dep on the scala runtime jar.
    scalalib_re = re.compile(r'scala-library-\d+\.\d+\.\d+\.jar$')
    filtered_bin_deps = defaultdict(list)
    for src, deps in bin_deps.iteritems():
      filtered_bin_deps[src] = filter(lambda x: scalalib_re.search(x) is None, deps)

    transformed_ext_deps = {}
    def fqcn_to_path(fqcn):
      return os.path.join(classes_dir, fqcn.replace('.', os.sep) + '.class')
    for src, fqcns in ext_deps.items():
      transformed_ext_deps[src] = [fqcn_to_path(fqcn) for fqcn in fqcns]

    ret = defaultdict(list)
    for d in [filtered_bin_deps, src_deps, transformed_ext_deps]:
      ret.update(d)
    return ret
 def parse_deps(self, infile):
     with raise_on_eof(infile):
         try:
             return self._underlying_parser.parse_deps(infile, "")
         except UnderlyingParser.ParseError as e:
             raise ParseError(e)
 def rebase(self, infile, outfile, pants_home_from, pants_home_to, java_home=None):
   with raise_on_eof(infile):
     try:
       self._underlying_parser.rebase(infile, outfile, pants_home_from, pants_home_to, java_home)
     except UnderlyingParser.ParseError as e:
       raise ParseError(e)
 def parse_deps(self, infile, classpath_indexer, classes_dir):
   with raise_on_eof(infile):
     try:
       return self._underlying_parser.parse_deps(infile, classes_dir)
     except UnderlyingParser.ParseError as e:
       raise ParseError(e)
 def parse_deps(self, infile):
   with raise_on_eof(infile):
     try:
       return self._underlying_parser.parse_deps(infile, "")
     except UnderlyingParser.ParseError as e:
       raise ParseError(e)
 def parse_products(self, infile, classes_dir):
   """An efficient parser of just the products section."""
   with raise_on_eof(infile):
     self._verify_version(infile)
     return self._find_repeated_at_header(infile, 'products')
Exemple #13
0
 def parse_deps(self, infile, classpath_indexer, classes_dir):
     with raise_on_eof(infile):
         try:
             return self._underlying_parser.parse_deps(infile, classes_dir)
         except UnderlyingParser.ParseError as e:
             raise ParseError(e)