tools/android/modularization/convenience/lookup_dep.py
def _read_jar_namelist(abs_build_output_dir: pathlib.Path,
                         abs_jar_path: pathlib.Path) -> List[str]:
    """Returns list of jar members by name."""

    # Caching namelist speeds up lookup_dep.py runtime by 1.5s.
    cache_path = abs_jar_path.with_suffix(abs_jar_path.suffix +
                                          '.namelist_cache')
    if (not ClassLookupIndex._is_path_relative_to(abs_jar_path,
                                                  abs_build_output_dir)):
      cache_path = (abs_build_output_dir / 'gen' /
                    cache_path.relative_to(_SRC_DIR))
    if (cache_path.exists()
        and os.path.getmtime(cache_path) > os.path.getmtime(abs_jar_path)):
      with open(cache_path) as f:
        return [s.strip() for s in f.readlines()]

    with zipfile.ZipFile(abs_jar_path) as z:
      namelist = z.namelist()

    cache_path.parent.mkdir(parents=True, exist_ok=True)
    with open(cache_path, 'w') as f:
      f.write('\n'.join(namelist))

    return namelist
Returns list of jar members by name.
Returns list of jar members by name.
Returns list of jar members by name .
def _read_jar_namelist(abs_build_output_dir: pathlib.Path,
                         abs_jar_path: pathlib.Path) -> List[str]:
    cache_path = abs_jar_path.with_suffix(abs_jar_path.suffix +
                                          '.namelist_cache')
    if (not ClassLookupIndex._is_path_relative_to(abs_jar_path,
                                                  abs_build_output_dir)):
      cache_path = (abs_build_output_dir / 'gen' /
                    cache_path.relative_to(_SRC_DIR))
    if (cache_path.exists()
        and os.path.getmtime(cache_path) > os.path.getmtime(abs_jar_path)):
      with open(cache_path) as f:
        return [s.strip() for s in f.readlines()]
    with zipfile.ZipFile(abs_jar_path) as z:
      namelist = z.namelist()
    cache_path.parent.mkdir(parents=True, exist_ok=True)
    with open(cache_path, 'w') as f:
      f.write('\n'.join(namelist))
    return namelist
def _read_jar_namelist ( abs_build_output_dir : pathlib . Path , abs_jar_path : pathlib . Path ) -> List [ str ] : cache_path = abs_jar_path . with_suffix ( abs_jar_path . suffix + '.namelist_cache' ) if ( not ClassLookupIndex . _is_path_relative_to ( abs_jar_path , abs_build_output_dir ) ) : cache_path = ( abs_build_output_dir / 'gen' / cache_path . relative_to ( _SRC_DIR ) ) if ( cache_path . exists ( ) and os . path . getmtime ( cache_path ) > os . path . getmtime ( abs_jar_path ) ) : with open ( cache_path ) as f : return [ s . strip ( ) for s in f . readlines ( ) ] with zipfile . ZipFile ( abs_jar_path ) as z : namelist = z . namelist ( ) cache_path . parent . mkdir ( parents = True , exist_ok = True ) with open ( cache_path , 'w' ) as f : f . write ( '\n' . join ( namelist ) ) return namelist
Returns list of jar members by name.
Returns list of jar members by name .
"""Returns list of jar members by name.""" # Caching namelist speeds up lookup_dep.py runtime by 1.5s.
abs_build_output_dir
pathlib.Path
abs_jar_path
pathlib.Path