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)
1185 def enumerate_dex_strings(cls, path): argument
1186 if is_zipfile(path):
1187 return DexFileReader.enumerate_dex_strings_apk(path)
1188 if cls.is_vdex_file(path):
1189 return DexFileReader.enumerate_dex_strings_vdex(path)
1197 def _is_under_dir(dir_path, path): argument
1198 dir_path = os.path.abspath(dir_path)
1199 path = os.path.abspath(path)
1200 return path == dir_path or path.startswith(dir_path + os.path.sep)
1430 def create_from_csv_path(path, vndk_lib_dirs=None): argument
1431 with open(path, 'r') as fp:
1445 for path in self._enumerate_paths_with_lib(pattern):
1446 yield path
1450 for path in self._enumerate_paths_with_lib(pattern_with_suffix):
1451 yield path
1454 def add(self, tag, path): argument
1455 if path.startswith('[regex]'):
1456 super(TaggedPathDict, self).add_regex(tag, path[7:])
1458 for path in self._enumerate_paths(path):
1459 super(TaggedPathDict, self).add(tag, path)
1463 def get_path_tag_default(path): argument
1464 if _is_under_dir('/vendor', path):
1466 if _is_under_dir('/product', path):
1468 if _is_under_dir('/system_ext', path):
1491 d.add(tagged_paths.get_path_tag(lib.path), lib)
1520 return TaggedPathDict.get_path_tag_default(lib.path)
1545 def load_from_path_or_default(cls, path): argument
1546 if not path:
1550 with open(path, 'r') as csv_file:
1565 root, ext = os.path.splitext(tag_file_path)
1586 def is_public_lib(self, path): argument
1587 lib_name = os.path.basename(path)
1595 def is_zipfile(path): argument
1600 with open(path, 'rb') as fp:
1607 return zipfile.is_zipfile(path)
1614 yield (os.path.join(zip_file_path, name),
1639 def is_accessible(path): argument
1641 mode = os.stat(path).st_mode
1651 for path, elf in scan_elf_files(tmp_dir, mount_point, unzip_files):
1652 yield path, elf
1657 manifest_file_path = os.path.join(apex_dir, 'apex_manifest.json')
1675 mount_point = os.path.join(apex_collection_root, apex_name)
1676 img_file_path = os.path.join(apex_dir, 'apex_payload.img')
1677 if os.path.exists(img_file_path):
1678 for path, elf in scan_ext4_image(img_file_path, mount_point,
1680 yield path, elf
1682 for path, elf in scan_elf_files(apex_dir, mount_point, unzip_files):
1683 yield path, elf
1690 for path, elf in scan_apex_dir(apex_collection_root, tmp_dir,
1692 yield path, elf
1698 for path, elf in scan_apex_dir(apex_collection_root, ent.path,
1700 yield path, elf
1702 for path, elf in scan_apex_file(apex_collection_root, ent.path,
1704 yield path, elf
1712 def norm_path(path): argument
1713 return os.path.join(mount_point, path[root_prefix_len:])
1715 def norm_path(path): argument
1716 return path
1721 for path, elf in scan_apex_files(os.path.join(root, 'apex'),
1723 yield (path, elf)
1726 path = os.path.join(base, filename)
1727 if not is_accessible(path):
1733 if unzip_files and is_zipfile(path):
1734 for path, content in scan_zip_file(path):
1736 yield (norm_path(path), ELF.loads(content))
1743 yield (norm_path(path), ELF.load(path))
1799 def extract_path_component(cls, path, index): argument
1803 pos = path.find('/', start)
1807 end = path.find('/', start)
1810 return path[start:end]
1814 def extract_version_from_path(cls, path): argument
1816 component = cls.extract_path_component(path, 3)
1823 def is_in_vndk_dir(cls, path): argument
1825 component = cls.extract_path_component(path, 3)
1835 def is_in_vndk_sp_dir(cls, path): argument
1837 component = cls.extract_path_component(path, 3)
1880 lib_dir_path = os.path.join(base_dir, lib_dir)
1912 component = self.extract_path_component(lib.path, 3)
1943 path = os.path.join(vendor_dir, 'default.prop')
1945 with open(path, 'r') as property_file:
2013 yield os.path.join(os.path.dirname(requester), name)
2018 yield os.path.join(d, name)
2021 yield os.path.join(d, name)
2023 yield os.path.join(d, name)
2027 for path in self.get_candidates(requester, name, dt_rpath, dt_runpath):
2029 return self.lib_set[path]
2036 def __init__(self, partition, path, elf, tag_bit): argument
2038 self.path = path
2189 return self.path < rhs.path
2193 libs = [lib.path for lib in libs]
2227 def add(self, path, lib): argument
2228 self.get_lib_dict(lib.elf.ei_class)[path] = lib
2232 del self.get_lib_dict(lib.elf.ei_class)[lib.path]
2235 def get(self, path, default=None): argument
2237 res = lib_set.get(path, None)
2266 script_dir = os.path.dirname(os.path.abspath(__file__))
2267 dataset_path = os.path.join(
2280 self.lib_pt[lib.partition].add(lib.path, lib)
2289 lib.path = new_path
2294 def add_lib(self, partition, path, elf): argument
2295 lib = ELFLinkData(partition, path, elf,
2296 self.tagged_paths.get_path_tag_bit(path))
2314 def _get_libs_in_elf_class(self, elf_class, path): argument
2316 if '${LIB}' in path:
2318 path = path.replace('${LIB}', lib_dir)
2319 if path.startswith('[regex]'):
2320 patt = re.compile(path[7:])
2323 for path, lib in lib_set.items():
2324 if patt.match(path):
2329 lib = lib_set.get(path)
2335 def get_lib(self, path): argument
2337 lib = lib_set.get(path)
2345 for path in paths:
2346 lib = self.get_lib(path)
2349 raise ValueError('path not found ' + path)
2350 report_error(path)
2371 dirs = [os.path.normpath(os.path.join(root, i)) for i in subdirs]
2379 root = os.path.abspath(root)
2388 for path, elf in scan_elf_files(root, unzip_files=unzip_files):
2394 if ignored_subdirs and ignored_patt.match(path):
2397 short_path = os.path.join('/', partition_name, path[prefix_len:])
2399 if alter_subdirs and alter_patt.match(path):
2405 def add_dlopen_deps(self, path): argument
2407 with open(path, 'r') as dlopen_dep_file:
2415 print('error:{}:{}: {}.'.format(path, line_no, e),
2436 ref_lib = generic_refs.refs.get(imported_lib.path)
2444 dep = resolver.resolve(lib.path, dt_needed, lib.elf.dt_rpath,
2448 lib.path, dt_needed, lib.elf.dt_rpath, lib.elf.dt_runpath))
2450 .format(lib.path, dt_needed, candidates),
2465 if imported_lib.path not in generic_refs.refs:
2712 'not exist.'.format(lib.path, dep.path),
2719 'not exist.'.format(lib.path, dep.path),
2730 if not lib.path.startswith(APEX_PREFIX):
2733 apex_name_end = lib.path.find('/', APEX_PREFIX_LEN)
2734 apex_name = lib.path[APEX_PREFIX_LEN:apex_name_end]
2737 self._rename_lib(lib, '/apex/' + lib.path[APEX_PREFIX_LEN:])
2810 'library {}.'.format(lib.path, dep.path),
2825 if VNDKLibDir.is_in_vndk_sp_dir(lib.path))
2838 if VNDKLibDir.is_in_vndk_sp_dir(lib.path))
2931 tagged_paths.is_path_visible(lib.path, dep.path)
2959 .format(lib.path, dep.path), file=sys.stderr)
3071 for path in system_dirs:
3073 'system', PT_SYSTEM, path, PT_VENDOR,
3078 for path in vendor_dirs:
3080 'vendor', PT_VENDOR, path, PT_SYSTEM,
3085 for path in product_dirs:
3087 'product', PT_PRODUCT, path, None, None, None,
3091 for path in system_ext_dirs:
3093 'system_ext', PT_SYSTEM_EXT, path, None, None, None,
3097 for path in extra_deps:
3098 graph.add_dlopen_deps(path)
3122 def add(self, path, elf): argument
3123 self.refs[path] = elf
3124 self._lib_names.add(os.path.basename(path))
3128 root = os.path.abspath(root)
3134 path = os.path.join(base, filename)
3135 lib_path = '/' + path[prefix_len:-4]
3136 self.add(lib_path, ELF.load_dump(path))
3147 root = os.path.abspath(root)
3149 for path, elf in scan_elf_files(root):
3150 self.add(os.path.join(prefix, path[root_len:]), elf)
3161 ref_lib = self.refs.get(lib.path)
3177 return os.path.basename(lib.path) in self._lib_names
3186 name = os.path.basename(lib.path)
3187 root, ext = os.path.splitext(name)
3214 path = os.path.join(base, filename)
3215 if not is_accessible(path):
3217 android_path = posixpath.join('/', partition, path[prefix_len:])
3218 yield (android_path, path)
3223 for ap, path in _enumerate_partition_paths('system', root):
3224 yield (ap, path)
3226 for ap, path in _enumerate_partition_paths('vendor', root):
3227 yield (ap, path)
3229 for ap, path in _enumerate_partition_paths('product', root):
3230 yield (ap, path)
3232 for ap, path in _enumerate_partition_paths('system_ext', root):
3233 yield (ap, path)
3248 for ap, path in _enumerate_paths(system_dirs, vendor_dirs, product_dirs,
3252 dex_string_iter = DexFileReader.enumerate_dex_strings(path)
3265 print('error: Failed to parse', path, file=sys.stderr)
3277 match = _APP_DIR_PATTERNS.match(dep_file.path)
3285 common = os.path.commonprefix([ap, dep_file.path])
3313 for path in module['installed']:
3314 match = installed_path_patt.match(path)
3316 for path in module['path']:
3317 mods[match.group(1)].add(path)
3332 def load_from_path_or_default(path): argument
3333 if not path:
3335 with open(path, 'r') as f:
3367 ELF.load(args.path).dump()
3369 print('error: {}: Bad ELF file ({})'.format(args.path, e),
3389 root = os.path.abspath(args.dir)
3392 for path, elf in scan_elf_files(root):
3393 name = path[prefix_len:]
3395 out = os.path.join(args.output, name) + '.sym'
3396 makedirs(os.path.dirname(out), exist_ok=True)
3473 for path in dirs:
3474 if not os.path.exists(path):
3476 '"{}"'.format(path, arg_name), file=sys.stderr)
3478 if not os.path.isdir(path):
3480 .format(path, arg_name), file=sys.stderr)
3544 script_dir = os.path.dirname(os.path.abspath(__file__))
3545 minimum_dlopen_deps = os.path.join(
3583 print(error_msg.format(lib.path), file=sys.stderr)
3635 def get_module_name(path): argument
3636 return os.path.splitext(os.path.basename(path))[0]
3639 return sorted({get_module_name(lib.path) for lib in lib_set})
3649 script_dir = os.path.dirname(os.path.abspath(__file__))
3650 template_path = os.path.join(script_dir, 'templates', 'vndk.txt')
3680 lib.path, collect_tags(lib), lib.elf.file_size,
3773 libs.sort(key=lambda lib: lib.path)
3812 return [get_str_idx(path)
3813 for path in module_info.get_module_path(lib.path)]
3824 mods.append([get_str_idx(lib.path),
3850 script_dir = os.path.dirname(os.path.abspath(__file__))
3853 os.path.join(script_dir, 'assets', 'insight', name),
3854 os.path.join(args.output, name))
3856 with open(os.path.join(args.output, 'insight-data.js'), 'w') as f:
3920 data.append((assoc_lib.path,
3924 data.append((assoc_lib.path,
3991 def report_error(path): argument
3992 print('error: no such lib: {}'.format(path), file=sys.stderr)
4011 print(lib.path)
4035 print(lib.path)
4036 for module_path in module_info.get_module_path(lib.path):
4051 libs = [lib for lib in libs if path_filter.match(lib.path)]
4097 print(lib.path)
4098 for module_path in module_info.get_module_path(lib.path):
4101 print('\t' + dep.path)
4102 for module_path in module_info.get_module_path(dep.path):
4152 config_path = os.path.join(base, 'etc', 'public.libraries.txt')
4180 return any(_is_under_dir(d, lib.path) for d in app_dirs)
4193 .format(lib.path, symbol, dep.path),
4199 if _is_app_lib(lib) and public_libs.is_public_lib(dep.path):
4208 dep_name = os.path.splitext(os.path.basename(dep.path))[0]
4212 'lib "{}".'.format(lib.path, dep.path),
4218 .format(lib.path, dep.path),
4223 .format(lib.path, dep.path),
4228 '/vendor/lib[64].'.format(lib.path, dep.path),
4256 .format(lib.path, lib.elf.dt_needed), file=sys.stderr)
4267 def is_in_system_partition(path): argument
4268 return path.startswith('/system/') or \
4269 path.startswith('/product/') or \
4270 path.startswith('/oem/')
4374 return hierarchy[tagged_paths.get_path_tag(lib.path)]
4399 'name': lib.path,
4408 lib_item['depends'].append(dep.path)
4411 dep.path, lib.get_dep_linked_symbols(dep)])
4415 violate_libs[lib_tag].append((lib.path, violate_count))
4433 script_dir = os.path.dirname(os.path.abspath(__file__))
4435 shutil.copyfile(os.path.join(script_dir, 'assets', 'visual', name),
4436 os.path.join(args.output, name))
4437 with open(os.path.join(args.output, 'dep-data.js'), 'w') as f: