Returns empty apex_infos if the apex target dir does not exist.
This is needed for partial builds that do not have the apex directory in
their target files package.
Test: build target files for a partial vendor-only build.
Change-Id: I076bfbd1a81cccddcef795f5edeaf2b51538cdec
diff --git a/tools/releasetools/apex_utils.py b/tools/releasetools/apex_utils.py
index 644b92a..1c88053 100644
--- a/tools/releasetools/apex_utils.py
+++ b/tools/releasetools/apex_utils.py
@@ -516,7 +516,7 @@
raise ApexInfoError(
'Failed to get type for {}:\n{}'.format(apex_file, e))
-def GetApexInfoFromTargetFiles(input_file):
+def GetSystemApexInfoFromTargetFiles(input_file):
"""
Get information about system APEX stored in the input_file zip
@@ -538,6 +538,11 @@
tmp_dir = UnzipTemp(input_file, ["SYSTEM/apex/*"])
target_dir = os.path.join(tmp_dir, "SYSTEM/apex/")
+ # Partial target-files packages for vendor-only builds may not contain
+ # a system apex directory.
+ if not os.path.exists(target_dir):
+ return []
+
apex_infos = []
debugfs_path = "debugfs"