From 9a3c541cf713277c55171b5adc6048a844d32116 Mon Sep 17 00:00:00 2001
From: Andre Anjos <andre.dos.anjos@gmail.com>
Date: Sat, 9 Mar 2019 04:09:12 +0100
Subject: [PATCH] [scripts][rebuild] Test for unexpected exception throwing
 from conda_build.api.test()

---
 bob/devtools/scripts/rebuild.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/bob/devtools/scripts/rebuild.py b/bob/devtools/scripts/rebuild.py
index 18f192a9..6b2c1aeb 100644
--- a/bob/devtools/scripts/rebuild.py
+++ b/bob/devtools/scripts/rebuild.py
@@ -167,17 +167,20 @@ def rebuild(recipe_dir, python, condarc, config, append_file,
       # the build fails, depending on the reason.  This bit of code tries to
       # accomodate both code paths and decides if we should rebuild the package
       # or not
+      logger.info('Testing %s', src)
       try:
-        logger.info('Testing %s', src)
         result = conda_build.api.test(destpath, config=conda_config)
         should_build = not result
       except Exception as error:
         logger.exception(error)
-      finally:
-        if should_build:
-          logger.warn('Test for %s: FAILED. Building...', src)
-        else:
-          logger.info('Test for %s: SUCCESS (package is up-to-date)', src)
+      except:
+        logger.error('conda_build.api.test() threw an unknown exception - ' \
+            'looks like bad programming, but not on our side this time...')
+
+      if should_build:
+        logger.warn('Test for %s: FAILED. Building...', src)
+      else:
+        logger.info('Test for %s: SUCCESS (package is up-to-date)', src)
 
 
     if should_build:  #something wrong happened, run a full build
-- 
GitLab