More accurate error if input_file is not exists

This patch is intended to make build log is more
accurate if input_file is not exists, then check if
it is a zipfile.

Change-Id: I30da0141ea44fc3ce0947f868a86a15a054a4346
Signed-off-by: jiajia tang <tangjiajia@xiaomi.com>
This commit is contained in:
jiajia tang 2021-04-21 15:49:51 +08:00
parent 50a00289ea
commit 92be6ee9d7
1 changed files with 3 additions and 0 deletions

View File

@ -187,6 +187,9 @@ def ImgFromTargetFiles(input_file, output_file):
Raises:
ValueError: On invalid input.
"""
if not os.path.exists(input_file):
raise ValueError('%s is not exist' % input_file)
if not zipfile.is_zipfile(input_file):
raise ValueError('%s is not a valid zipfile' % input_file)