tAdd the try/catch logic to other modules - amprolla - devuan's apt repo merger HTML git clone git://parazyd.org/amprolla.git DIR Log DIR Files DIR Refs DIR README DIR LICENSE --- DIR commit ba4cba3037ca32d3a46a06d3ddea099c67607a98 DIR parent 7798367e61cdc89889a406269b7bbeaf6907f591 HTML Author: parazyd <parazyd@dyne.org> Date: Sat, 9 Dec 2017 11:38:45 +0100 Add the try/catch logic to other modules Diffstat: M amprolla_init.py | 16 ++++++++++------ M amprolla_merge.py | 16 ++++++++++------ M amprolla_merge_contents.py | 16 ++++++++++------ M amprolla_update.py | 2 +- 4 files changed, 31 insertions(+), 19 deletions(-) --- DIR diff --git a/amprolla_init.py b/amprolla_init.py t@@ -15,6 +15,7 @@ from lib.config import (aliases, arches, categories, cpunm, mainrepofiles, from lib.lock import check_lock, free_lock from lib.net import download from lib.parse import parse_release +from lib.log import die, info def pop_dirs(repo): t@@ -86,9 +87,12 @@ def main(): if __name__ == '__main__': - t1 = time() - check_lock() - main() - free_lock() - t2 = time() - print('total time: %s' % (t2 - t1)) + try + t1 = time() + check_lock() + main() + free_lock() + t2 = time() + info('Total time: %s' % (t2 - t1)) + except Exception as e: + die(e) DIR diff --git a/amprolla_merge.py b/amprolla_merge.py t@@ -18,6 +18,7 @@ from lib.lock import check_lock, free_lock from lib.package import (load_packages_file, merge_packages_many, write_packages) from lib.release import write_release +from lib.log import info, die def prepare_merge_dict(): t@@ -194,9 +195,12 @@ def main(): if __name__ == '__main__': - t1 = time() - check_lock() - main() - free_lock() - t2 = time() - print('total time: %s' % (t2 - t1)) + try: + t1 = time() + check_lock() + main() + free_lock() + t2 = time() + info('Total time: %s' % (t2 - t1)) + except Exception as e: + die(e) DIR diff --git a/amprolla_merge_contents.py b/amprolla_merge_contents.py t@@ -16,6 +16,7 @@ from amprolla_merge import prepare_merge_dict from lib.config import (arches, categories, cpunm, mergedir, mergesubdir, repos, spooldir) from lib.lock import check_lock, free_lock +from lib.log import die, info def merge_contents(filelist): t@@ -105,9 +106,12 @@ def main(): if __name__ == '__main__': - t1 = time() - check_lock() - main() - free_lock() - t2 = time() - print('total time: %s' % (t2 - t1)) + try: + t1 = time() + check_lock() + main() + free_lock() + t2 = time() + info('Total time: %s' % (t2 - t1)) + except Exception as e: + die(e) DIR diff --git a/amprolla_update.py b/amprolla_update.py t@@ -149,6 +149,6 @@ if __name__ == '__main__': main() free_lock() t2 = time() - print('total time: %s' % (t2 - t1)) + info('Total time: %s' % (t2 - t1)) except Exception as e: die(e)