Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

source: Catch CondaHTTPError so mutliple urls get checked #1683

Merged
merged 1 commit into from
Jan 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions conda_build/conda_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)


Expand Down
4 changes: 3 additions & 1 deletion conda_build/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would like these to be calls to logging rather than print, but I'm going to merge this as-is and refactor it next time I see it.

except RuntimeError as e:
print("Error: %s" % str(e).strip(), file=sys.stderr)
else:
Expand Down