Remove bare excepts in CreatePatch.py
authorAntoni <a.adaszkiewi@samsung.com>
Fri, 15 Jul 2022 13:15:25 +0000 (15:15 +0200)
committerAntoni <a.adaszkiewi@samsung.com>
Mon, 18 Jul 2022 11:25:32 +0000 (13:25 +0200)
Change-Id: I78c7a4d88057f21eaf5fb708a94c0a7378a0b742

mk_delta/common/bin/CreatePatch.py

index 75c371d..f449e19 100755 (executable)
@@ -198,9 +198,9 @@ def main():
                logging.info('Time start [%s] - Time end [%s]' % (start, end))
                print('Done with [%s][%d]---- Time start [%s] - Time end [%s]' % (PART_NAME, MEM_REQ, start, end))
 
-       except:
+       except Exception as exc:
                logging.error('Usage: {} <Update_Type> <Part_Name> <OLD_Base> <NEW_Base> <OUT_DIR>'.format(os.path.basename(sys.argv[0])))
-               raise
+               raise exc
 
 def SS_update_cfg(DELTA_BIN, UPDATE_CFG_PATH):
        f = open(UPDATE_CFG_PATH, 'r')
@@ -833,17 +833,17 @@ def SS_Generate_Delta(PART_NAME, BASE_OLD, Old_files, Old_dirs, BASE_NEW, New_fi
                        if not os.path.isdir(destdir):
                                try:
                                        os.makedirs(destdir)
-                               except:
+                               except Exception as exc:
                                        logging.critical('Error in NEW files DIR entry -%s' % destdir)
-                                       raise
+                                       raise exc
 
                        try:
                                if not stat.S_ISFIFO(os.stat(dst_file).st_mode):
                                        shutil.copy2(dst_file, destpath)
                                        logging.debug('New files copied from- %s to- %s' % (dst_file, destpath))
-                       except:
+                       except Exception as exc:
                                logging.critical('Error in NEW files entry -%s -%s' % (dst_file, destpath))
-                               raise
+                               raise exc
 
        for elt in Dir_Added:
                newfiles_dest_path = 'run/upgrade-sysroot/'