commit ba4cba3037ca32d3a46a06d3ddea099c67607a98
parent 7798367e61cdc89889a406269b7bbeaf6907f591
Author: parazyd <parazyd@dyne.org>
Date: Sat, 9 Dec 2017 11:38:45 +0100
Add the try/catch logic to other modules
Diffstat:
4 files changed, 31 insertions(+), 19 deletions(-)
diff --git a/amprolla_init.py b/amprolla_init.py
@@ -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):
@@ -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)
diff --git a/amprolla_merge.py b/amprolla_merge.py
@@ -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():
@@ -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)
diff --git a/amprolla_merge_contents.py b/amprolla_merge_contents.py
@@ -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):
@@ -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)
diff --git a/amprolla_update.py b/amprolla_update.py
@@ -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)