From 2390d3600b72710f858598be74e8d71fd04be8f7 Mon Sep 17 00:00:00 2001 From: pix106 Date: Fri, 13 Aug 2021 08:20:08 +0200 Subject: [PATCH] sdm660-common: update-sha1sums: handle FileNotFound exception Show missing file name and continue Signed-off-by: pix106 --- update-sha1sums.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/update-sha1sums.py b/update-sha1sums.py index 7f0c703b..b1c276d5 100755 --- a/update-sha1sums.py +++ b/update-sha1sums.py @@ -104,10 +104,14 @@ def update(): if filePath[0] == '-': filePath = filePath[1:] - with open(os.path.join(vendorPath, filePath), 'rb') as f: - hash = sha1(f.read()).hexdigest() + try: + with open(os.path.join(vendorPath, filePath), 'rb') as f: + hash = sha1(f.read()).hexdigest() + lines[index] = '%s|%s' % (line, hash) + + except FileNotFoundError: + print("File not found: %s" % filePath) - lines[index] = '%s|%s' % (line, hash) lines.append('')