From 0f57540d4f4daecd922076774107500dbaa1f237 Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Fri, 20 Jan 2017 00:05:20 +0000 Subject: [PATCH] source: Catch CondaHTTPError so mutliple urls get checked --- conda_build/conda_interface.py | 4 ++++ conda_build/source.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/conda_build/conda_interface.py b/conda_build/conda_interface.py index 417fdfa91f..d8f1cb8a4f 100644 --- a/conda_build/conda_interface.py +++ b/conda_build/conda_interface.py @@ -59,6 +59,7 @@ NoPackagesFoundError = conda.exceptions.NoPackagesFoundError CondaValueError = conda.exceptions.CondaValueError LockError = conda.exceptions.LockError + CondaHTTPError = conda.exceptions.CondaHTTPError # disallow softlinks. This avoids a lot of dumb issues, at the potential cost of disk space. conda.base.context.context.allow_softlinks = False @@ -103,6 +104,9 @@ class NoPackagesFoundError(Exception): class CondaValueError(Exception): pass + class CondaHTTPError(Exception): + pass + env_path_backup_var_exists = os.environ.get('CONDA_PATH_BACKUP', None) diff --git a/conda_build/source.py b/conda_build/source.py index b15fee86ac..da84d6d7a0 100644 --- a/conda_build/source.py +++ b/conda_build/source.py @@ -13,7 +13,7 @@ from .conda_interface import hashsum_file from conda_build.os_utils import external -from conda_build.conda_interface import url_path +from conda_build.conda_interface import url_path, CondaHTTPError from conda_build.utils import (tar_xf, unzip, safe_print_unicode, copy_into, on_win, ensure_list, check_output_env, check_call_env, convert_path_for_cygwin_or_msys2) @@ -59,6 +59,8 @@ def download_to_cache(metadata, config): try: print("Downloading %s" % url) download(url, path) + except CondaHTTPError as e: + print("Error: %s" % str(e).strip(), file=sys.stderr) except RuntimeError as e: print("Error: %s" % str(e).strip(), file=sys.stderr) else: