Skip to content
Snippets Groups Projects
Commit 5cfa2db1 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[scripts][rebuild] Improves error condition handling for conda-build API test()

parent 283fb134
No related branches found
No related tags found
No related merge requests found
Pipeline #27705 passed
...@@ -163,14 +163,21 @@ def rebuild(recipe_dir, python, condarc, config, append_file, ...@@ -163,14 +163,21 @@ def rebuild(recipe_dir, python, condarc, config, append_file,
logger.info('Downloading %s -> %s', src, destpath) logger.info('Downloading %s -> %s', src, destpath)
urllib.request.urlretrieve(src, destpath) urllib.request.urlretrieve(src, destpath)
# conda_build may either raise an exception or return ``False`` in case
# 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
try: try:
logger.info('Testing %s', src) logger.info('Testing %s', src)
conda_build.api.test(destpath, config=conda_config) result = conda_build.api.test(destpath, config=conda_config)
should_build = False should_build = not result
logger.info('Test for %s: SUCCESS (package is up-to-date)', src)
except Exception as error: except Exception as error:
logger.exception(error) logger.exception(error)
logger.warn('Test for %s: FAILED. Building...', src) 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)
if should_build: #something wrong happened, run a full build if should_build: #something wrong happened, run a full build
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment