def _ParseManifest(manifest_string, jar_file_name):
 manifest_string = '\n'.join(manifest_string.splitlines()).rstrip('\n')
 section_strings = re.split('\n{2,}', manifest_string)
 parsed_sections = [_ParseManifestSection(s, jar_file_name) for s in section_strings]
 main_section = parsed_sections[0]
 sections = {}
 for entry in parsed_sections[1:]:
  name = entry.get('Name')
  if (name is None):
   raise InvalidJarError(('%s: Manifest entry has no Name attribute: %r' % (jar_file_name, entry)))
  else:
   sections[name] = entry
 return Manifest(main_section, sections)

def _ParseManifest ( manifest_string , jar_file_name ) : manifest_string = '\n' . join ( manifest_string . splitlines ( ) ) . rstrip ( '\n' ) section_strings = re . split ( '\n{2,}' , manifest_string ) parsed_sections = [ _ParseManifestSection ( s , jar_file_name ) for s in section_strings ] main_section = parsed_sections [ 0 ] sections = { } for entry in parsed_sections [ 1 : ] : name = entry . get ( 'Name' ) if ( name is None ) : raise InvalidJarError ( ( '%s: Manifest entry has no Name attribute: %r' % ( jar_file_name , entry ) ) ) else : sections [ name ] = entry return Manifest ( main_section , sections )
parse a manifest object out of the given string .