parameters: (aar_file)
return_statement: return data
docstring: Extracts and return .info data from an .aar file.
  
    Args:
      aar_file: Path to an input .aar file.
  
    Returns:
      A dict containing .info data.
docstring_summary: Extracts and return .info data from an .aar file.
docstring_tokens: Extracts and return . info data from an . aar file .
function: def _CreateInfo(aar_file):
    """Extracts and return .info data from an .aar file.
  
    Args:
      aar_file: Path to an input .aar file.
  
    Returns:
      A dict containing .info data.
    """
    data = {}
    data['aidl'] = []
    data['assets'] = []
    data['resources'] = []
    data['subjars'] = []
    data['subjar_tuples'] = []
    data['has_classes_jar'] = False
    data['has_proguard_flags'] = False
    data['has_native_libraries'] = False
    data['has_r_text_file'] = False
    with zipfile.ZipFile(aar_file) as z:
      manifest_xml = ElementTree.fromstring(z.read('AndroidManifest.xml'))
      data['is_manifest_empty'] = _IsManifestEmpty(manifest_xml)
      manifest_package = _GetManifestPackage(manifest_xml)
      if manifest_package:
        data['manifest_package'] = manifest_package
  
      for name in z.namelist():
        if name.endswith('/'):
          continue
        if name.startswith('aidl/'):
          data['aidl'].append(name)
        elif name.startswith('res/'):
          data['resources'].append(name)
        elif name.startswith('libs/') and name.endswith('.jar'):
          label = posixpath.basename(name)[:-4]
          label = re.sub(r'[^a-zA-Z0-9._]', '_', label)
          data['subjars'].append(name)
          data['subjar_tuples'].append([label, name])
        elif name.startswith('assets/'):
          data['assets'].append(name)
        elif name.startswith('jni/'):
          data['has_native_libraries'] = True
          if 'native_libraries' in data:
            data['native_libraries'].append(name)
          else:
            data['native_libraries'] = [name]
        elif name == 'classes.jar':
          data['has_classes_jar'] = True
        elif name == _PROGUARD_TXT:
          data['has_proguard_flags'] = True
        elif name == 'R.txt':
          # Some AARs, e.g. gvr_controller_java, have empty R.txt. Such AARs
          # have no resources as well. We treat empty R.txt as having no R.txt.
          data['has_r_text_file'] = bool(z.read('R.txt').strip())
  
    return data
function_tokens: def _CreateInfo ( aar_file ) : data = { } data [ 'aidl' ] = [ ] data [ 'assets' ] = [ ] data [ 'resources' ] = [ ] data [ 'subjars' ] = [ ] data [ 'subjar_tuples' ] = [ ] data [ 'has_classes_jar' ] = False data [ 'has_proguard_flags' ] = False data [ 'has_native_libraries' ] = False data [ 'has_r_text_file' ] = False with zipfile . ZipFile ( aar_file ) as z : manifest_xml = ElementTree . fromstring ( z . read ( 'AndroidManifest.xml' ) ) data [ 'is_manifest_empty' ] = _IsManifestEmpty ( manifest_xml ) manifest_package = _GetManifestPackage ( manifest_xml ) if manifest_package : data [ 'manifest_package' ] = manifest_package for name in z . namelist ( ) : if name . endswith ( '/' ) : continue if name . startswith ( 'aidl/' ) : data [ 'aidl' ] . append ( name ) elif name . startswith ( 'res/' ) : data [ 'resources' ] . append ( name ) elif name . startswith ( 'libs/' ) and name . endswith ( '.jar' ) : label = posixpath . basename ( name ) [ : - 4 ] label = re . sub ( r'[^a-zA-Z0-9._]' , '_' , label ) data [ 'subjars' ] . append ( name ) data [ 'subjar_tuples' ] . append ( [ label , name ] ) elif name . startswith ( 'assets/' ) : data [ 'assets' ] . append ( name ) elif name . startswith ( 'jni/' ) : data [ 'has_native_libraries' ] = True if 'native_libraries' in data : data [ 'native_libraries' ] . append ( name ) else : data [ 'native_libraries' ] = [ name ] elif name == 'classes.jar' : data [ 'has_classes_jar' ] = True elif name == _PROGUARD_TXT : data [ 'has_proguard_flags' ] = True elif name == 'R.txt' : # Some AARs, e.g. gvr_controller_java, have empty R.txt. Such AARs # have no resources as well. We treat empty R.txt as having no R.txt. data [ 'has_r_text_file' ] = bool ( z . read ( 'R.txt' ) . strip ( ) ) return data