Skip to content

Commit 5aa1423

Browse files
committed
Debugging modules without the 'installed' key
Signed-off-by: Ethan Lee <[email protected]>
1 parent b1f3e91 commit 5aa1423

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

src/fosslight_android/android_binary_analysis.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -155,22 +155,19 @@ def get_module_json_obj_by_installed_path(module_name, binary_name_with_path, bi
155155
return js_value
156156
else: # Find binary by installed path
157157
for key in module_info_json_obj:
158-
try:
159-
js_value = module_info_json_obj[key]
160-
output_files = js_value["installed"]
161-
if output_files is not None:
162-
for output_file in output_files:
163-
if output_file == binary_name_with_path:
158+
js_value = module_info_json_obj[key]
159+
output_files = js_value.get("installed",None)
160+
if output_files is not None:
161+
for output_file in output_files:
162+
if output_file == binary_name_with_path:
163+
js_value[MODULE_TYPE_NAME] = key
164+
return js_value
165+
else:
166+
path_with_out_dir = os.path.join(build_out_path, binary_name_with_path)
167+
if path_with_out_dir == output_file:
164168
js_value[MODULE_TYPE_NAME] = key
165169
return js_value
166-
else:
167-
path_with_out_dir = os.path.join(build_out_path, binary_name_with_path)
168-
if path_with_out_dir == output_file:
169-
js_value[MODULE_TYPE_NAME] = key
170-
return js_value
171-
except KeyError as e:
172-
print(f"The 'installed' key does not exist. key: {key}")
173-
return ""
170+
174171
return ""
175172

176173

0 commit comments

Comments
 (0)