From 48c50865540bbc75e8852dff90bc4aaab867c0c1 Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Sun, 12 Jan 2014 16:06:08 +0100 Subject: [PATCH] Add helper _exit_with_error() which log and exit with return code --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5d371fbd5..b61192649 100755 --- a/setup.py +++ b/setup.py @@ -68,6 +68,10 @@ ext_modules = [ Extension('picard.util.astrcmp', sources=['picard/util/astrcmp.c']), ] +def _exit_with_error(msg, code=1): + log.error("%s (code=%d)" % (msg, code)) + raise SystemExit(code) + class picard_test(Command): description = "run automated tests" @@ -321,7 +325,7 @@ class picard_get_po_files(Command): log.info("Running %s" % TXPULL_CMD) retcode = subprocess.call(TXPULL_CMD, shell=True) if retcode: - log.error("Failed to update po files (retcode=%d)" % (retcode)) + _exit_with_error("Failed to update po files", retcode) class picard_update_countries(Command):