Lines Matching refs:path
40 def makedirs(path, exist_ok): argument
41 if exist_ok and os.path.isdir(path):
43 os.makedirs(path)
113 def __init__(self, name, path): argument
115 self.path = path
120 def _stat_impl(path, follow_symlinks): argument
121 return os.stat(path) if follow_symlinks else os.lstat(path)
127 stat_res = self._stat_impl(self.path, follow_symlinks)
146 def scandir(path): argument
147 for name in os.listdir(path):
148 yield DirEntry(name, os.path.join(path, name))
822 def _parse_from_file(self, path): argument
824 with open(path, 'rb') as f:
832 def _parse_from_dump_lines(self, path, lines): argument
838 .format(path, line_no + 1), file=sys.stderr)
871 .format(path, line_no + 1, key), file=sys.stderr)
874 def _parse_from_dump_file(self, path): argument
876 with open(path, 'r') as f:
877 self._parse_from_dump_lines(path, f)
887 def load(path): argument
890 elf._parse_from_file(path)
903 def load_dump(path): argument
906 elf._parse_from_dump_file(path)
1170 def enumerate_dex_strings(cls, path): argument
1171 if is_zipfile(path):
1172 return DexFileReader.enumerate_dex_strings_apk(path)
1173 if cls.is_vdex_file(path):
1174 return DexFileReader.enumerate_dex_strings_vdex(path)
1381 def create_from_csv_path(path, vndk_lib_dirs=None): argument
1382 with open(path, 'r') as fp:
1396 for path in self._enumerate_paths_with_lib(pattern):
1397 yield path
1401 for path in self._enumerate_paths_with_lib(pattern_with_suffix):
1402 yield path
1405 def add(self, tag, path): argument
1406 if path.startswith('[regex]'):
1407 super(TaggedPathDict, self).add_regex(tag, path[7:])
1409 for path in self._enumerate_paths(path):
1410 super(TaggedPathDict, self).add(tag, path)
1413 def get_path_tag_default(self, path): argument
1414 return 'vnd_only' if path.startswith('/vendor') else 'fwk_only'
1435 d.add(tagged_paths.get_path_tag(lib.path), lib)
1456 return 'vnd_only' if lib.path.startswith('/vendor') else 'fwk_only'
1481 def load_from_path_or_default(cls, path): argument
1482 if not path:
1486 with open(path, 'r') as csv_file:
1501 root, ext = os.path.splitext(tag_file_path)
1509 def is_zipfile(path): argument
1514 with open(path, 'rb') as fp:
1521 return zipfile.is_zipfile(path)
1528 yield (os.path.join(zip_file_path, name),
1553 def is_accessible(path): argument
1555 mode = os.stat(path).st_mode
1565 for path, elf in scan_elf_files(tmp_dir, mount_point, unzip_files):
1566 yield path, elf
1571 manifest_file_path = os.path.join(apex_dir, 'apex_manifest.json')
1589 mount_point = os.path.join(apex_collection_root, apex_name)
1590 img_file_path = os.path.join(apex_dir, 'apex_payload.img')
1591 if os.path.exists(img_file_path):
1592 for path, elf in scan_ext4_image(img_file_path, mount_point,
1594 yield path, elf
1596 for path, elf in scan_elf_files(apex_dir, mount_point, unzip_files):
1597 yield path, elf
1604 for path, elf in scan_apex_dir(apex_collection_root, tmp_dir,
1606 yield path, elf
1612 for path, elf in scan_apex_dir(apex_collection_root, ent.path,
1614 yield path, elf
1616 for path, elf in scan_apex_file(apex_collection_root, ent.path,
1618 yield path, elf
1626 def norm_path(path): argument
1627 return os.path.join(mount_point, path[root_prefix_len:])
1629 def norm_path(path): argument
1630 return path
1635 for path, elf in scan_apex_files(os.path.join(root, 'apex'),
1637 yield (path, elf)
1640 path = os.path.join(base, filename)
1641 if not is_accessible(path):
1647 if unzip_files and is_zipfile(path):
1648 for path, content in scan_zip_file(path):
1650 yield (norm_path(path), ELF.loads(content))
1657 yield (norm_path(path), ELF.load(path))
1711 def extract_path_component(cls, path, index): argument
1715 pos = path.find('/', start)
1719 end = path.find('/', start)
1722 return path[start:end]
1726 def extract_version_from_path(cls, path): argument
1728 component = cls.extract_path_component(path, 3)
1735 def is_in_vndk_dir(cls, path): argument
1737 component = cls.extract_path_component(path, 3)
1747 def is_in_vndk_sp_dir(cls, path): argument
1749 component = cls.extract_path_component(path, 3)
1792 lib_dir_path = os.path.join(base_dir, lib_dir)
1824 component = self.extract_path_component(lib.path, 3)
1855 path = os.path.join(vendor_dir, 'default.prop')
1857 with open(path, 'r') as property_file:
1925 yield os.path.join(os.path.dirname(requester), name)
1930 yield os.path.join(d, name)
1933 yield os.path.join(d, name)
1935 yield os.path.join(d, name)
1939 for path in self.get_candidates(requester, name, dt_rpath, dt_runpath):
1941 return self.lib_set[path]
1948 def __init__(self, partition, path, elf, tag_bit): argument
1950 self.path = path
2106 return self.path < rhs.path
2110 libs = [lib.path for lib in libs]
2140 def add(self, path, lib): argument
2141 self.get_lib_dict(lib.elf.ei_class)[path] = lib
2145 del self.get_lib_dict(lib.elf.ei_class)[lib.path]
2148 def get(self, path, default=None): argument
2150 res = lib_set.get(path, None)
2179 script_dir = os.path.dirname(os.path.abspath(__file__))
2180 dataset_path = os.path.join(
2193 self.lib_pt[lib.partition].add(lib.path, lib)
2202 lib.path = new_path
2206 def add_lib(self, partition, path, elf): argument
2207 lib = ELFLinkData(partition, path, elf,
2208 self.tagged_paths.get_path_tag_bit(path))
2226 def _get_libs_in_elf_class(self, elf_class, path): argument
2228 if '${LIB}' in path:
2230 path = path.replace('${LIB}', lib_dir)
2231 if path.startswith('[regex]'):
2232 patt = re.compile(path[7:])
2235 for path, lib in lib_set.items():
2236 if patt.match(path):
2241 lib = lib_set.get(path)
2247 def get_lib(self, path): argument
2249 lib = lib_set.get(path)
2257 for path in paths:
2258 lib = self.get_lib(path)
2261 raise ValueError('path not found ' + path)
2262 report_error(path)
2283 dirs = [os.path.normpath(os.path.join(root, i)) for i in subdirs]
2291 root = os.path.abspath(root)
2300 for path, elf in scan_elf_files(root, unzip_files=unzip_files):
2306 if ignored_subdirs and ignored_patt.match(path):
2309 short_path = os.path.join('/', partition_name, path[prefix_len:])
2311 if alter_subdirs and alter_patt.match(path):
2317 def add_dlopen_deps(self, path): argument
2319 with open(path, 'r') as dlopen_dep_file:
2327 print('error:{}:{}: {}.'.format(path, line_no, e),
2348 ref_lib = generic_refs.refs.get(imported_lib.path)
2356 dep = resolver.resolve(lib.path, dt_needed, lib.elf.dt_rpath,
2360 lib.path, dt_needed, lib.elf.dt_rpath, lib.elf.dt_runpath))
2362 .format(lib.path, dt_needed, candidates),
2377 if imported_lib.path not in generic_refs.refs:
2550 'not exist.'.format(lib.path, dep.path),
2557 'not exist.'.format(lib.path, dep.path),
2568 if not lib.path.startswith(APEX_PREFIX):
2571 apex_name_end = lib.path.find('/', APEX_PREFIX_LEN)
2572 apex_name = lib.path[APEX_PREFIX_LEN:apex_name_end]
2575 self._rename_lib(lib, '/apex/' + lib.path[APEX_PREFIX_LEN:])
2652 'library {}.'.format(lib.path, dep.path),
2667 if VNDKLibDir.is_in_vndk_sp_dir(lib.path))
2680 if VNDKLibDir.is_in_vndk_sp_dir(lib.path))
2776 tagged_paths.is_path_visible(lib.path, dep.path)
2804 .format(lib.path, dep.path), file=sys.stderr)
2916 for path in system_dirs:
2918 'system', PT_SYSTEM, path, PT_VENDOR,
2923 for path in vendor_dirs:
2925 'vendor', PT_VENDOR, path, PT_SYSTEM,
2930 for path in extra_deps:
2931 graph.add_dlopen_deps(path)
2968 def add(self, path, elf): argument
2969 self.refs[path] = elf
2970 self._lib_names.add(os.path.basename(path))
2974 root = os.path.abspath(root)
2980 path = os.path.join(base, filename)
2981 lib_path = '/' + path[prefix_len:-4]
2982 self.add(lib_path, ELF.load_dump(path))
2993 root = os.path.abspath(root)
2995 for path, elf in scan_elf_files(root):
2996 self.add(os.path.join(prefix, path[root_len:]), elf)
3007 ref_lib = self.refs.get(lib.path)
3023 return os.path.basename(lib.path) in self._lib_names
3032 name = os.path.basename(lib.path)
3033 root, ext = os.path.splitext(name)
3060 path = os.path.join(base, filename)
3061 if not is_accessible(path):
3063 android_path = posixpath.join('/', partition, path[prefix_len:])
3064 yield (android_path, path)
3069 for ap, path in _enumerate_partition_paths('system', root):
3070 yield (ap, path)
3072 for ap, path in _enumerate_partition_paths('vendor', root):
3073 yield (ap, path)
3087 for ap, path in _enumerate_paths(system_dirs, vendor_dirs):
3090 dex_string_iter = DexFileReader.enumerate_dex_strings(path)
3103 print('error: Failed to parse', path, file=sys.stderr)
3115 match = _APP_DIR_PATTERNS.match(dep_file.path)
3123 common = os.path.commonprefix([ap, dep_file.path])
3151 for path in module['installed']:
3152 match = installed_path_patt.match(path)
3154 for path in module['path']:
3155 mods[match.group(1)].add(path)
3170 def load_from_path_or_default(path): argument
3171 if not path:
3173 with open(path, 'r') as f:
3205 ELF.load(args.path).dump()
3207 print('error: {}: Bad ELF file ({})'.format(args.path, e),
3227 root = os.path.abspath(args.dir)
3230 for path, elf in scan_elf_files(root):
3231 name = path[prefix_len:]
3233 out = os.path.join(args.output, name) + '.sym'
3234 makedirs(os.path.dirname(out), exist_ok=True)
3301 for path in dirs:
3302 if not os.path.exists(path):
3304 '"{}"'.format(path, arg_name), file=sys.stderr)
3306 if not os.path.isdir(path):
3308 .format(path, arg_name), file=sys.stderr)
3368 script_dir = os.path.dirname(os.path.abspath(__file__))
3369 minimum_dlopen_deps = os.path.join(
3407 print(error_msg.format(lib.path), file=sys.stderr)
3460 def get_module_name(path): argument
3461 return os.path.splitext(os.path.basename(path))[0]
3464 return sorted({get_module_name(lib.path) for lib in lib_set})
3474 script_dir = os.path.dirname(os.path.abspath(__file__))
3475 template_path = os.path.join(script_dir, 'templates', 'vndk.txt')
3505 lib.path, collect_tags(lib), lib.elf.file_size,
3598 libs.sort(key=lambda lib: lib.path)
3637 return [get_str_idx(path)
3638 for path in module_info.get_module_path(lib.path)]
3649 mods.append([get_str_idx(lib.path),
3675 script_dir = os.path.dirname(os.path.abspath(__file__))
3678 os.path.join(script_dir, 'assets', 'insight', name),
3679 os.path.join(args.output, name))
3681 with open(os.path.join(args.output, 'insight-data.js'), 'w') as f:
3745 data.append((assoc_lib.path,
3749 data.append((assoc_lib.path,
3816 def report_error(path): argument
3817 print('error: no such lib: {}'.format(path), file=sys.stderr)
3836 print(lib.path)
3860 print(lib.path)
3861 for module_path in module_info.get_module_path(lib.path):
3876 libs = [lib for lib in libs if path_filter.match(lib.path)]
3921 print(lib.path)
3922 for module_path in module_info.get_module_path(lib.path):
3925 print('\t' + dep.path)
3926 for module_path in module_info.get_module_path(dep.path):
3994 .format(lib.path, symbol, dep.path),
4003 dep_name = os.path.splitext(os.path.basename(dep.path))[0]
4007 'lib "{}".'.format(lib.path, dep.path),
4013 .format(lib.path, dep.path),
4018 .format(lib.path, dep.path),
4023 '/vendor/lib[64].'.format(lib.path, dep.path),
4051 .format(lib.path, lib.elf.dt_needed), file=sys.stderr)
4061 def is_in_system_partition(path): argument
4062 return path.startswith('/system/') or \
4063 path.startswith('/product/') or \
4064 path.startswith('/oem/')
4163 return hierarchy[tagged_paths.get_path_tag(lib.path)]
4188 'name': lib.path,
4197 lib_item['depends'].append(dep.path)
4200 dep.path, lib.get_dep_linked_symbols(dep)])
4204 violate_libs[lib_tag].append((lib.path, violate_count))
4222 script_dir = os.path.dirname(os.path.abspath(__file__))
4224 shutil.copyfile(os.path.join(script_dir, 'assets', 'visual', name),
4225 os.path.join(args.output, name))
4226 with open(os.path.join(args.output, 'dep-data.js'), 'w') as f: